Class: SurroGate::Pair
- Inherits:
-
Object
- Object
- SurroGate::Pair
- Defined in:
- lib/surro-gate/pair.rb
Instance Attribute Summary collapse
-
#left ⇒ Object
readonly
Returns the value of attribute left.
-
#right ⇒ Object
readonly
Returns the value of attribute right.
Instance Method Summary collapse
-
#initialize(left, right) ⇒ Pair
constructor
A new instance of Pair.
- #mark_rd ⇒ Object
- #mark_wr ⇒ Object
- #marked_rd? ⇒ Boolean
- #marked_wr? ⇒ Boolean
- #ready? ⇒ Boolean
- #unmark ⇒ Object
Constructor Details
#initialize(left, right) ⇒ Pair
Returns a new instance of Pair.
7 8 9 10 11 |
# File 'lib/surro-gate/pair.rb', line 7 def initialize(left, right) @left = left @right = right unmark end |
Instance Attribute Details
#left ⇒ Object (readonly)
Returns the value of attribute left.
5 6 7 |
# File 'lib/surro-gate/pair.rb', line 5 def left @left end |
#right ⇒ Object (readonly)
Returns the value of attribute right.
5 6 7 |
# File 'lib/surro-gate/pair.rb', line 5 def right @right end |
Instance Method Details
#mark_rd ⇒ Object
25 26 27 |
# File 'lib/surro-gate/pair.rb', line 25 def mark_rd @rd_rdy = true end |
#mark_wr ⇒ Object
29 30 31 |
# File 'lib/surro-gate/pair.rb', line 29 def mark_wr @wr_rdy = true end |
#marked_rd? ⇒ Boolean
17 18 19 |
# File 'lib/surro-gate/pair.rb', line 17 def marked_rd? @rd_rdy end |
#marked_wr? ⇒ Boolean
21 22 23 |
# File 'lib/surro-gate/pair.rb', line 21 def marked_wr? @wr_rdy end |
#ready? ⇒ Boolean
13 14 15 |
# File 'lib/surro-gate/pair.rb', line 13 def ready? @rd_rdy && @wr_rdy || @left.closed? || @right.closed? end |
#unmark ⇒ Object
33 34 35 |
# File 'lib/surro-gate/pair.rb', line 33 def unmark @rd_rdy = @wr_rdy = false end |