Class: Attribeautiful::Attribute::Name
- Inherits:
-
Object
- Object
- Attribeautiful::Attribute::Name
- Defined in:
- lib/attribeautiful/attribute/name.rb
Instance Attribute Summary collapse
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(name) ⇒ Name
constructor
A new instance of Name.
- #to_s ⇒ Object
- #use_dashes ⇒ Object
- #use_dashes? ⇒ Boolean
- #use_underscores ⇒ Object
Constructor Details
#initialize(name) ⇒ Name
Returns a new instance of Name.
7 8 9 10 |
# File 'lib/attribeautiful/attribute/name.rb', line 7 def initialize(name) self.text = name self.use_dashes end |
Instance Attribute Details
#text ⇒ Object
Returns the value of attribute text.
5 6 7 |
# File 'lib/attribeautiful/attribute/name.rb', line 5 def text @text end |
Instance Method Details
#to_s ⇒ Object
26 27 28 |
# File 'lib/attribeautiful/attribute/name.rb', line 26 def to_s use_dashes? ? text.gsub('_', '-') : text.gsub('-', '_') end |
#use_dashes ⇒ Object
16 17 18 19 |
# File 'lib/attribeautiful/attribute/name.rb', line 16 def use_dashes @use_dashes = true self end |
#use_dashes? ⇒ Boolean
12 13 14 |
# File 'lib/attribeautiful/attribute/name.rb', line 12 def use_dashes? @use_dashes end |
#use_underscores ⇒ Object
21 22 23 24 |
# File 'lib/attribeautiful/attribute/name.rb', line 21 def use_underscores @use_dashes = false self end |