Class: Amcss::Html::Attribute
- Inherits:
-
Object
- Object
- Amcss::Html::Attribute
- Defined in:
- lib/amcss/html/attribute.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, value) ⇒ Attribute
constructor
A new instance of Attribute.
- #to_hash ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name, value) ⇒ Attribute
Returns a new instance of Attribute.
16 17 18 |
# File 'lib/amcss/html/attribute.rb', line 16 def initialize(name, value) @name, @value = name, value end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/amcss/html/attribute.rb', line 3 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/amcss/html/attribute.rb', line 3 def value @value end |
Class Method Details
.from(modüle, *variations_or_traits) ⇒ Object
6 7 8 |
# File 'lib/amcss/html/attribute.rb', line 6 def from(modüle, *variations_or_traits) new("#{namespace}-#{modüle}", variations_or_traits.compact.map(&:to_s).join(' ')) end |
Instance Method Details
#to_hash ⇒ Object
20 21 22 |
# File 'lib/amcss/html/attribute.rb', line 20 def to_hash {name => value} end |
#to_s ⇒ Object
24 25 26 |
# File 'lib/amcss/html/attribute.rb', line 24 def to_s %Q{#{name}="#{value}"} end |