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.
52 53 54 55 56 |
# File 'lib/wire.rb', line 52 def initialize extend(MonitorMixin) @i = 0 @cond = new_cond end |
Instance Attribute Details
#cond ⇒ Object (readonly)
Returns the value of attribute cond.
49 50 51 |
# File 'lib/wire.rb', line 49 def cond @cond end |
#i ⇒ Object (readonly)
Returns the value of attribute i.
49 50 51 |
# File 'lib/wire.rb', line 49 def i @i end |
#last ⇒ Object
Returns the value of attribute last.
50 51 52 |
# File 'lib/wire.rb', line 50 def last @last end |
Instance Method Details
#dec ⇒ Object
62 63 64 |
# File 'lib/wire.rb', line 62 def dec @i -= 1 end |
#inc ⇒ Object
58 59 60 |
# File 'lib/wire.rb', line 58 def inc @i += 1 end |