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.
-
#svg_not_found_css_class ⇒ Object
Returns the value of attribute svg_not_found_css_class.
Instance Method Summary collapse
- #add_custom_transformation(options) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #raise_on_file_not_found=(value) ⇒ Object
- #raise_on_file_not_found? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
23 24 25 26 27 28 |
# File 'lib/inline_svg.rb', line 23 def initialize @custom_transformations = {} @asset_file = InlineSvg::AssetFile @svg_not_found_css_class = nil @raise_on_file_not_found = false end |
Instance Attribute Details
#asset_file ⇒ Object
Returns the value of attribute asset_file.
21 22 23 |
# File 'lib/inline_svg.rb', line 21 def asset_file @asset_file end |
#asset_finder ⇒ Object
Returns the value of attribute asset_finder.
21 22 23 |
# File 'lib/inline_svg.rb', line 21 def asset_finder @asset_finder end |
#custom_transformations ⇒ Object (readonly)
Returns the value of attribute custom_transformations.
21 22 23 |
# File 'lib/inline_svg.rb', line 21 def custom_transformations @custom_transformations end |
#svg_not_found_css_class ⇒ Object
Returns the value of attribute svg_not_found_css_class.
21 22 23 |
# File 'lib/inline_svg.rb', line 21 def svg_not_found_css_class @svg_not_found_css_class end |
Instance Method Details
#add_custom_transformation(options) ⇒ Object
63 64 65 66 67 68 |
# File 'lib/inline_svg.rb', line 63 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 |
#raise_on_file_not_found=(value) ⇒ Object
70 71 72 |
# File 'lib/inline_svg.rb', line 70 def raise_on_file_not_found=(value) @raise_on_file_not_found = value end |
#raise_on_file_not_found? ⇒ Boolean
74 75 76 |
# File 'lib/inline_svg.rb', line 74 def raise_on_file_not_found? !!@raise_on_file_not_found end |