Class: NameQ::Support::Suffix
- Inherits:
-
Object
- Object
- NameQ::Support::Suffix
- Defined in:
- lib/nameq/support/suffix.rb
Constant Summary collapse
- TOKEN =
"%{index}"
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
Returns the value of attribute index.
Instance Method Summary collapse
-
#initialize(index, template: nil) ⇒ Suffix
constructor
A new instance of Suffix.
- #strip(text) ⇒ Object
- #to_s ⇒ Object
Constructor Details
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index.
7 8 9 |
# File 'lib/nameq/support/suffix.rb', line 7 def index @index end |
Instance Method Details
#strip(text) ⇒ Object
14 15 16 |
# File 'lib/nameq/support/suffix.rb', line 14 def strip(text) text.sub(regex, "") end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/nameq/support/suffix.rb', line 18 def to_s @template % {index: index} end |