Class: AgnosticSlugs::Slug
- Inherits:
-
Object
- Object
- AgnosticSlugs::Slug
- Defined in:
- lib/agnostic_slugs/slug.rb
Instance Attribute Summary collapse
-
#counter ⇒ Object
readonly
Returns the value of attribute counter.
-
#original ⇒ Object
readonly
Returns the value of attribute original.
Instance Method Summary collapse
-
#initialize(original, counter = 1) ⇒ Slug
constructor
A new instance of Slug.
- #next ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(original, counter = 1) ⇒ Slug
Returns a new instance of Slug.
5 6 7 8 |
# File 'lib/agnostic_slugs/slug.rb', line 5 def initialize(original, counter = 1) @original = original @counter = counter end |
Instance Attribute Details
#counter ⇒ Object (readonly)
Returns the value of attribute counter.
3 4 5 |
# File 'lib/agnostic_slugs/slug.rb', line 3 def counter @counter end |
#original ⇒ Object (readonly)
Returns the value of attribute original.
3 4 5 |
# File 'lib/agnostic_slugs/slug.rb', line 3 def original @original end |
Instance Method Details
#next ⇒ Object
10 11 12 |
# File 'lib/agnostic_slugs/slug.rb', line 10 def next self.class.new(original, counter + 1) end |
#to_s ⇒ Object
14 15 16 |
# File 'lib/agnostic_slugs/slug.rb', line 14 def to_s @slug ||= generate end |