Class: Counter
- Inherits:
-
Object
- Object
- Counter
- Defined in:
- lib/wire.rb
Instance Attribute Summary collapse
-
#cond ⇒ Object
readonly
Returns the value of attribute cond.
-
#i ⇒ Object
readonly
Returns the value of attribute i.
-
#last ⇒ Object
Returns the value of attribute last.
Instance Method Summary collapse
- #dec ⇒ Object
- #inc ⇒ Object
-
#initialize ⇒ Counter
constructor
A new instance of Counter.
Constructor Details
#initialize ⇒ Counter
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
#cond ⇒ Object (readonly)
Returns the value of attribute cond.
60 61 62 |
# File 'lib/wire.rb', line 60 def cond @cond end |
#i ⇒ Object (readonly)
Returns the value of attribute i.
60 61 62 |
# File 'lib/wire.rb', line 60 def i @i end |
#last ⇒ Object
Returns the value of attribute last.
61 62 63 |
# File 'lib/wire.rb', line 61 def last @last end |
Instance Method Details
#dec ⇒ Object
73 74 75 |
# File 'lib/wire.rb', line 73 def dec @i -= 1 end |
#inc ⇒ Object
69 70 71 |
# File 'lib/wire.rb', line 69 def inc @i += 1 end |