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.



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

def initialize
  @custom_transformations = {}
  @asset_file = InlineSvg::AssetFile
end

Instance Attribute Details

#asset_fileObject

Returns the value of attribute asset_file.



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

def asset_file
  @asset_file
end

#asset_finderObject

Returns the value of attribute asset_finder.



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

def asset_finder
  @asset_finder
end

#custom_transformationsObject (readonly)

Returns the value of attribute custom_transformations.



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

def custom_transformations
  @custom_transformations
end

Instance Method Details

#add_custom_transformation(options) ⇒ Object



50
51
52
53
54
55
# File 'lib/inline_svg.rb', line 50

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