Class: Plumbus::Port
- Inherits:
-
Object
- Object
- Plumbus::Port
- Defined in:
- lib/plumbus/port.rb
Constant Summary collapse
- SUPPORTED_DIRECTIONS =
[:request, :response]
Instance Attribute Summary collapse
-
#direction ⇒ Object
readonly
Returns the value of attribute direction.
-
#driver_module_klass ⇒ Object
readonly
Returns the value of attribute driver_module_klass.
Instance Method Summary collapse
- #attach! ⇒ Object
-
#initialize(driver_module_klass:, direction:) ⇒ Port
constructor
A new instance of Port.
-
#opposite_direction ⇒ Object
end.
Constructor Details
#initialize(driver_module_klass:, direction:) ⇒ Port
Returns a new instance of Port.
10 11 12 13 14 15 16 17 |
# File 'lib/plumbus/port.rb', line 10 def initialize driver_module_klass:, direction: @driver_module_klass = driver_module_klass @direction = direction #@driver = Plumbus::PortDriver.new extend DriverFacilities extend "#{@driver_module_klass.name}::PlumbusHandlers".constantize end |
Instance Attribute Details
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
8 9 10 |
# File 'lib/plumbus/port.rb', line 8 def direction @direction end |
#driver_module_klass ⇒ Object (readonly)
Returns the value of attribute driver_module_klass.
8 9 10 |
# File 'lib/plumbus/port.rb', line 8 def driver_module_klass @driver_module_klass end |
Instance Method Details
#attach! ⇒ Object
19 20 21 |
# File 'lib/plumbus/port.rb', line 19 def attach! Ports.attach_port self end |
#opposite_direction ⇒ Object
end
27 28 29 |
# File 'lib/plumbus/port.rb', line 27 def opposite_direction @direction == :request ? :response : :request end |