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.
21 22 23 24 25 26 |
# File 'lib/inline_svg.rb', line 21 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.
19 20 21 |
# File 'lib/inline_svg.rb', line 19 def asset_file @asset_file end |
#asset_finder ⇒ Object
Returns the value of attribute asset_finder.
19 20 21 |
# File 'lib/inline_svg.rb', line 19 def asset_finder @asset_finder end |
#custom_transformations ⇒ Object (readonly)
Returns the value of attribute custom_transformations.
19 20 21 |
# File 'lib/inline_svg.rb', line 19 def custom_transformations @custom_transformations end |
#svg_not_found_css_class ⇒ Object
Returns the value of attribute svg_not_found_css_class.
19 20 21 |
# File 'lib/inline_svg.rb', line 19 def svg_not_found_css_class @svg_not_found_css_class end |
Instance Method Details
#add_custom_transformation(options) ⇒ Object
59 60 61 62 63 64 |
# File 'lib/inline_svg.rb', line 59 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
66 67 68 |
# File 'lib/inline_svg.rb', line 66 def raise_on_file_not_found=(value) @raise_on_file_not_found = value end |
#raise_on_file_not_found? ⇒ Boolean
70 71 72 |
# File 'lib/inline_svg.rb', line 70 def raise_on_file_not_found? !!@raise_on_file_not_found end |