Class: InlineSvg::Configuration
- Inherits:
-
Object
- Object
- InlineSvg::Configuration
- Defined in:
- lib/inline_svg.rb
Defined Under Namespace
Classes: Invalid
Instance Attribute Summary collapse
-
#asset_file ⇒ Object
Returns the value of attribute asset_file.
-
#asset_finder ⇒ Object
Returns the value of attribute asset_finder.
-
#custom_transformations ⇒ Object
readonly
Returns the value of attribute custom_transformations.
Instance Method Summary collapse
- #add_custom_transformation(options) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
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_file ⇒ Object
Returns the value of attribute asset_file.
18 19 20 |
# File 'lib/inline_svg.rb', line 18 def asset_file @asset_file end |
#asset_finder ⇒ Object
Returns the value of attribute asset_finder.
18 19 20 |
# File 'lib/inline_svg.rb', line 18 def asset_finder @asset_finder end |
#custom_transformations ⇒ Object (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() if incompatible_transformation?(.fetch(:transform)) raise InlineSvg::Configuration::Invalid.new("#{.fetch(:transform)} should implement the .create_with_value and #transform methods") end @custom_transformations.merge!(Hash[ *[.fetch(:attribute, :no_attribute), ] ]) end |