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.
24 25 26 27 28 29 |
# File 'lib/inline_svg.rb', line 24 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.
22 23 24 |
# File 'lib/inline_svg.rb', line 22 def asset_file @asset_file end |
#asset_finder ⇒ Object
Returns the value of attribute asset_finder.
22 23 24 |
# File 'lib/inline_svg.rb', line 22 def asset_finder @asset_finder end |
#custom_transformations ⇒ Object (readonly)
Returns the value of attribute custom_transformations.
22 23 24 |
# File 'lib/inline_svg.rb', line 22 def custom_transformations @custom_transformations end |
#svg_not_found_css_class ⇒ Object
Returns the value of attribute svg_not_found_css_class.
22 23 24 |
# File 'lib/inline_svg.rb', line 22 def svg_not_found_css_class @svg_not_found_css_class end |
Instance Method Details
#add_custom_transformation(options) ⇒ Object
64 65 66 67 68 69 |
# File 'lib/inline_svg.rb', line 64 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
71 72 73 |
# File 'lib/inline_svg.rb', line 71 def raise_on_file_not_found=(value) @raise_on_file_not_found = value end |
#raise_on_file_not_found? ⇒ Boolean
75 76 77 |
# File 'lib/inline_svg.rb', line 75 def raise_on_file_not_found? !!@raise_on_file_not_found end |