Class: InlineSvg::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/inline_svg.rb

Defined Under Namespace

Classes: Invalid

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



19
20
21
# File 'lib/inline_svg.rb', line 19

def initialize
  @custom_transformations = {}
end

Instance Attribute Details

#asset_finderObject

Returns the value of attribute asset_finder.



17
18
19
# File 'lib/inline_svg.rb', line 17

def asset_finder
  @asset_finder
end

#custom_transformationsObject (readonly)

Returns the value of attribute custom_transformations.



17
18
19
# File 'lib/inline_svg.rb', line 17

def custom_transformations
  @custom_transformations
end

Instance Method Details

#add_custom_transformation(options) ⇒ Object



35
36
37
38
39
40
# File 'lib/inline_svg.rb', line 35

def add_custom_transformation(options)
  if incompatible_transformation?(options.fetch(:transform))
    raise InlineSvg::Configuration::Invalid.new("#{options.fetch(:transform)} should implement the .create_with_value and #transform methods")
  end
  @custom_transformations.merge!(Hash[ *[options.fetch(:attribute, :no_attribute), options] ])
end