Class: RailsIcons::Icon::Attributes

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_icons/icon/attributes.rb

Instance Method Summary collapse

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