Class: Tool
- Inherits:
-
Object
- Object
- Tool
- Defined in:
- lib/rresume/tool.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
-
#zuletzt ⇒ Object
readonly
Returns the value of attribute zuletzt.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(name) ⇒ Tool
constructor
A new instance of Tool.
- #last_used ⇒ Object
- #total_for ⇒ Object
- #update(dauer, zuletzt) ⇒ Object
Constructor Details
#initialize(name) ⇒ Tool
Returns a new instance of Tool.
5 6 7 8 9 |
# File 'lib/rresume/tool.rb', line 5 def initialize(name) @name = name @total = 0 @zuletzt = Date.new(1970,1,1) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/rresume/tool.rb', line 3 def name @name end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
3 4 5 |
# File 'lib/rresume/tool.rb', line 3 def total @total end |
#zuletzt ⇒ Object (readonly)
Returns the value of attribute zuletzt.
3 4 5 |
# File 'lib/rresume/tool.rb', line 3 def zuletzt @zuletzt end |
Instance Method Details
#<=>(other) ⇒ Object
11 12 13 |
# File 'lib/rresume/tool.rb', line 11 def <=>(other) self.name <=> other.name end |
#last_used ⇒ Object
19 20 21 22 |
# File 'lib/rresume/tool.rb', line 19 def last_used #@zuletzt "#{@zuletzt.month}/#{@zuletzt.year}" end |
#total_for ⇒ Object
15 16 17 |
# File 'lib/rresume/tool.rb', line 15 def total_for @total end |
#update(dauer, zuletzt) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/rresume/tool.rb', line 24 def update(dauer,zuletzt) @total += dauer if zuletzt > @zuletzt @zuletzt = zuletzt end end |