Class: Counter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCounter

Returns a new instance of Counter.



63
64
65
66
67
# File 'lib/wire.rb', line 63

def initialize
  extend(MonitorMixin)
  @i = 0
  @cond = new_cond
end

Instance Attribute Details

#condObject (readonly)

Returns the value of attribute cond.



60
61
62
# File 'lib/wire.rb', line 60

def cond
  @cond
end

#iObject (readonly)

Returns the value of attribute i.



60
61
62
# File 'lib/wire.rb', line 60

def i
  @i
end

#lastObject

Returns the value of attribute last.



61
62
63
# File 'lib/wire.rb', line 61

def last
  @last
end

Instance Method Details

#decObject



73
74
75
# File 'lib/wire.rb', line 73

def dec
  @i -= 1
end

#incObject



69
70
71
# File 'lib/wire.rb', line 69

def inc
  @i += 1
end