Class: Attribeautiful::Attribute
- Inherits:
-
Object
- Object
- Attribeautiful::Attribute
- Defined in:
- lib/attribeautiful/attribute.rb,
lib/attribeautiful/attribute/name.rb,
lib/attribeautiful/attribute/value.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#attr_name ⇒ Object
Returns the value of attribute attr_name.
-
#attr_value ⇒ Object
Returns the value of attribute attr_value.
Instance Method Summary collapse
- #add(*args) ⇒ Object
-
#initialize(name) ⇒ Attribute
constructor
A new instance of Attribute.
- #to_s ⇒ Object
- #use_dashes ⇒ Object
- #use_semicolons ⇒ Object
- #use_spaces ⇒ Object
- #use_underscores ⇒ Object
Constructor Details
#initialize(name) ⇒ Attribute
Returns a new instance of Attribute.
13 14 15 16 17 |
# File 'lib/attribeautiful/attribute.rb', line 13 def initialize(name) self.attr_name = Attribeautiful::Attribute::Name.new(name) self.attr_value = Attribeautiful::Attribute::Value.new self end |
Instance Attribute Details
#attr_name ⇒ Object
Returns the value of attribute attr_name.
10 11 12 |
# File 'lib/attribeautiful/attribute.rb', line 10 def attr_name @attr_name end |
#attr_value ⇒ Object
Returns the value of attribute attr_value.
11 12 13 |
# File 'lib/attribeautiful/attribute.rb', line 11 def attr_value @attr_value end |
Instance Method Details
#add(*args) ⇒ Object
29 30 31 32 |
# File 'lib/attribeautiful/attribute.rb', line 29 def add(*args) self.attr_value.add(*args) self end |
#to_s ⇒ Object
44 45 46 47 |
# File 'lib/attribeautiful/attribute.rb', line 44 def to_s return "" if attr_value.to_s.empty? return "#{attr_name}=\"#{attr_value}\"".html_safe end |
#use_dashes ⇒ Object
24 25 26 27 |
# File 'lib/attribeautiful/attribute.rb', line 24 def use_dashes self.attr_name.use_dashes self end |
#use_semicolons ⇒ Object
39 40 41 42 |
# File 'lib/attribeautiful/attribute.rb', line 39 def use_semicolons self.attr_value.use_semicolons self end |
#use_spaces ⇒ Object
34 35 36 37 |
# File 'lib/attribeautiful/attribute.rb', line 34 def use_spaces self.attr_value.use_spaces self end |
#use_underscores ⇒ Object
19 20 21 22 |
# File 'lib/attribeautiful/attribute.rb', line 19 def use_underscores self.attr_name.use_underscores self end |