Class: Bemer::ModifierList
- Inherits:
-
Object
- Object
- Bemer::ModifierList
- Defined in:
- lib/bemer/modifier_list.rb
Instance Method Summary collapse
-
#initialize(block, element, mods) ⇒ ModifierList
constructor
A new instance of ModifierList.
- #to_a ⇒ Object
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(block, element, mods) ⇒ ModifierList
8 9 10 11 12 |
# File 'lib/bemer/modifier_list.rb', line 8 def initialize(block, element, mods) @bem_class = Bemer.bem_class(block, element) @modifiers = nil @mods = mods end |
Instance Method Details
#to_a ⇒ Object
14 15 16 |
# File 'lib/bemer/modifier_list.rb', line 14 def to_a @to_a ||= to_h.map { |name, value| build_css_class(name, value) } end |
#to_h ⇒ Object
22 23 24 |
# File 'lib/bemer/modifier_list.rb', line 22 def to_h modifiers.nil? ? build_modifiers : modifiers end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/bemer/modifier_list.rb', line 18 def to_s @to_s ||= to_a.join(' ') end |