module InlineSvg::TransformPipeline::Transformations

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/inline_svg/transform_pipeline/transformations.rbs

module InlineSvg::TransformPipeline::Transformations
  def self.all_default_values: () -> Hash
  def self.all_transformations: () -> untyped
  def self.built_in_transformations: () -> untyped
  def self.custom_transformations: () -> Hash
  def self.in_priority_order: (Hash transforms) -> untyped
  def self.lookup: (Hash transform_params) -> Array[InlineSvg::TransformPipeline::Transformations::ClassAttribute]
  def self.magnify_priorities: (Hash transforms) -> Hash
  def self.no_transform: () -> Class
  def self.params_with_defaults: (Hash params) -> untyped
  def self.without_empty_values: (Hash params) -> Hash
end

def self.all_default_values

Experimental RBS support (using type sampling data from the type_fusion project).

def self.all_default_values: () ->

This signature was generated using 4 samples from 2 applications.

def self.all_default_values
  custom_transformations
    .values
    .select {|opt| opt[:default_value] != nil}
    .map {|opt| [opt[:attribute], opt[:default_value]]}
    .inject({}) {|options, attrs| options.merge!(attrs[0] => attrs[1])}
end

def self.all_transformations

Experimental RBS support (using type sampling data from the type_fusion project).

def self.all_transformations: () -> untyped

This signature was generated using 1 sample from 1 application.

def self.all_transformations
  in_priority_order(built_in_transformations.merge(custom_transformations))
end

def self.built_in_transformations

Experimental RBS support (using type sampling data from the type_fusion project).

def self.built_in_transformations: () -> untyped

This signature was generated using 1 sample from 1 application.

Transformations are run in priority order, lowest number first:
def self.built_in_transformations
  {
    id: { transform: IdAttribute, priority: 1 },
    desc: { transform: Description, priority: 2 },
    title: { transform: Title, priority: 3 },
    aria: { transform: AriaAttributes },
    aria_hidden: { transform: AriaHiddenAttribute },
    class: { transform: ClassAttribute },
    style: { transform: StyleAttribute },
    data: { transform: DataAttributes },
    nocomment: { transform: NoComment },
    preserve_aspect_ratio: { transform: PreserveAspectRatio },
    size: { transform: Size },
    width: { transform: Width },
    height: { transform: Height },
    view_box: { transform: ViewBox },
  }
end

def self.custom_transformations

Experimental RBS support (using type sampling data from the type_fusion project).

def self.custom_transformations: () ->

This signature was generated using 3 samples from 2 applications.

def self.custom_transformations
  magnify_priorities(InlineSvg.configuration.custom_transformations)
end

def self.in_priority_order(transforms)

Experimental RBS support (using type sampling data from the type_fusion project).

def self.in_priority_order: (id | transform | Class | priority | Integer | desc | transform | Class | priority | Integer | title | transform | Class | priority | Integer | aria | transform | Class | aria_hidden | transform | Class | class | transform | Class | style | transform | Class | data | transform | Class | nocomment | transform | Class | preserve_aspect_ratio | transform | Class | size | transform | Class | width | transform | Class | height | transform | Class | view_box | transform | Class transforms) -> untyped

This signature was generated using 1 sample from 1 application.

def self.in_priority_order(transforms)
  transforms.sort_by { |_, options| options.fetch(:priority, transforms.size) }
end

def self.lookup(transform_params)

Experimental RBS support (using type sampling data from the type_fusion project).

def self.lookup: (class | String transform_params) ->

This signature was generated using 1 sample from 1 application.

def self.lookup(transform_params)
  return [] unless transform_params.any? || custom_transformations.any?
  transform_params_with_defaults = params_with_defaults(transform_params)
  all_transformations.map { |name, definition|
    value = transform_params_with_defaults[name]
    definition.fetch(:transform, no_transform).create_with_value(value) if value
  }.compact
end

def self.magnify(priority=0)

def self.magnify(priority=0)
  (priority + 1) * built_in_transformations.size
end

def self.magnify_priorities(transforms)

Experimental RBS support (using type sampling data from the type_fusion project).

def self.magnify_priorities: ( transforms) ->

This signature was generated using 1 sample from 1 application.

def self.magnify_priorities(transforms)
  transforms.inject({}) do |output, (name, definition)|
    priority = definition.fetch(:priority, built_in_transformations.size)
    output[name] = definition.merge( { priority: magnify(priority) } )
    output
  end
end

def self.no_transform

Experimental RBS support (using type sampling data from the type_fusion project).

def self.no_transform: () -> Class

This signature was generated using 4 samples from 2 applications.

def self.no_transform
  InlineSvg::TransformPipeline::Transformations::NullTransformation
end

def self.params_with_defaults(params)

Experimental RBS support (using type sampling data from the type_fusion project).

def self.params_with_defaults: ((class | String | styles | String | title | String | aria | TrueClass | nocomment | TrueClass | class | String) params) -> untyped

This signature was generated using 4 samples from 2 applications.

def self.params_with_defaults(params)
  without_empty_values(all_default_values.merge(params))
end

def self.without_empty_values(params)

Experimental RBS support (using type sampling data from the type_fusion project).

def self.without_empty_values: (class | String params) -> class | String

This signature was generated using 2 samples from 2 applications.

def self.without_empty_values(params)
  params.reject {|key, value| value.nil?}
end