Class: RailsIcons::Icon::Attributes
- Inherits:
-
Object
- Object
- RailsIcons::Icon::Attributes
- Defined in:
- lib/rails_icons/icon/attributes.rb
Instance Method Summary collapse
- #attach(to:) ⇒ Object
-
#initialize(default_attributes: {}, arguments: {}) ⇒ Attributes
constructor
A new instance of Attributes.
Constructor Details
#initialize(default_attributes: {}, arguments: {}) ⇒ Attributes
6 7 8 |
# File 'lib/rails_icons/icon/attributes.rb', line 6 def initialize(default_attributes: {}, arguments: {}) @merged_attributes = default_attributes.merge(arguments) end |
Instance Method Details
#attach(to:) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rails_icons/icon/attributes.rb', line 10 def attach(to:) @merged_attributes.each do |key, value| if key == :class class_attribute(key, value, to) elsif value.is_a?(Hash) hash_attributes(key, value, to) else string_attributes(key, value, to) end end end |