Class: KablameUser
- Inherits:
-
Object
- Object
- KablameUser
- Defined in:
- lib/kablame.rb
Instance Attribute Summary collapse
-
#line_count ⇒ Object
Returns the value of attribute line_count.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #increment ⇒ Object
-
#initialize(name) ⇒ KablameUser
constructor
A new instance of KablameUser.
- #to_s ⇒ Object
Constructor Details
#initialize(name) ⇒ KablameUser
Returns a new instance of KablameUser.
96 97 98 99 |
# File 'lib/kablame.rb', line 96 def initialize(name) @line_count = 1 @name = name end |
Instance Attribute Details
#line_count ⇒ Object
Returns the value of attribute line_count.
93 94 95 |
# File 'lib/kablame.rb', line 93 def line_count @line_count end |
#name ⇒ Object
Returns the value of attribute name.
94 95 96 |
# File 'lib/kablame.rb', line 94 def name @name end |
Instance Method Details
#<=>(other) ⇒ Object
101 102 103 |
# File 'lib/kablame.rb', line 101 def <=>(other) other.line_count <=> @line_count end |
#increment ⇒ Object
109 110 111 |
# File 'lib/kablame.rb', line 109 def increment @line_count = @line_count.next end |
#to_s ⇒ Object
105 106 107 |
# File 'lib/kablame.rb', line 105 def to_s "#{@name.ljust(20)} ==> #{@line_count.to_s.rjust(4)}" end |