Class: SurroGate::Pair

Inherits:
Object
  • Object
show all
Defined in:
lib/surro-gate/pair.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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
  @rd_rdy = @wr_rdy = false
end

Instance Attribute Details

#leftObject (readonly)

Returns the value of attribute left.



5
6
7
# File 'lib/surro-gate/pair.rb', line 5

def left
  @left
end

#rightObject (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

#ready?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/surro-gate/pair.rb', line 13

def ready?
  @rd_rdy && @wr_rdy || @left.closed? || @right.closed?
end