Class: Teapot::Name
- Inherits:
-
Object
- Object
- Teapot::Name
- Defined in:
- lib/teapot/name.rb
Instance Attribute Summary collapse
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
- #identifier ⇒ Object
-
#initialize(text) ⇒ Name
constructor
A new instance of Name.
- #macro ⇒ Object
- #target ⇒ Object
Constructor Details
#initialize(text) ⇒ Name
Returns a new instance of Name.
23 24 25 |
# File 'lib/teapot/name.rb', line 23 def initialize(text) @text = text end |
Instance Attribute Details
#text ⇒ Object (readonly)
Returns the value of attribute text.
27 28 29 |
# File 'lib/teapot/name.rb', line 27 def text @text end |
Instance Method Details
#identifier ⇒ Object
29 30 31 |
# File 'lib/teapot/name.rb', line 29 def identifier @identifier ||= @text.gsub(/\s+/, '') end |
#macro ⇒ Object
37 38 39 |
# File 'lib/teapot/name.rb', line 37 def macro @guard ||= @text.upcase.gsub(/\s+/, '_') end |
#target ⇒ Object
33 34 35 |
# File 'lib/teapot/name.rb', line 33 def target @target ||= @text.gsub(/\s+/, '-').downcase end |