Class: Tool

Inherits:
Object
  • Object
show all
Defined in:
lib/rresume/tool.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/rresume/tool.rb', line 3

def name
  @name
end

#totalObject (readonly)

Returns the value of attribute total.



3
4
5
# File 'lib/rresume/tool.rb', line 3

def total
  @total
end

#zuletztObject (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_usedObject



19
20
21
22
# File 'lib/rresume/tool.rb', line 19

def last_used
  #@zuletzt
  "#{@zuletzt.month}/#{@zuletzt.year}"
end

#total_forObject



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