Class: SocketSwitcher::Device
- Inherits:
-
Object
- Object
- SocketSwitcher::Device
- Defined in:
- lib/socket_switcher/device.rb
Instance Attribute Summary collapse
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
-
#initialize(port, number) ⇒ Device
constructor
A new instance of Device.
- #off ⇒ Object
- #on ⇒ Object
- #to_s ⇒ Object (also: #inspect)
Constructor Details
#initialize(port, number) ⇒ Device
Returns a new instance of Device.
2 3 4 5 |
# File 'lib/socket_switcher/device.rb', line 2 def initialize(port, number) @port = port @number = number end |
Instance Attribute Details
#number ⇒ Object (readonly)
Returns the value of attribute number.
9 10 11 |
# File 'lib/socket_switcher/device.rb', line 9 def number @number end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
7 8 9 |
# File 'lib/socket_switcher/device.rb', line 7 def port @port end |
Instance Method Details
#off ⇒ Object
15 16 17 |
# File 'lib/socket_switcher/device.rb', line 15 def off @port.__send__(:set_state, self, 0) end |
#on ⇒ Object
11 12 13 |
# File 'lib/socket_switcher/device.rb', line 11 def on @port.__send__(:set_state, self, 1) end |
#to_s ⇒ Object Also known as: inspect
19 20 21 |
# File 'lib/socket_switcher/device.rb', line 19 def to_s "#<#{self.class} number=#{number}>" end |