Class: Artoo::Port
- Inherits:
-
Object
- Object
- Artoo::Port
- Defined in:
- lib/artoo/port.rb
Overview
The Artoo::Port class represents port and/or host to be used to connect tp a specific individual hardware device.
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
-
#initialize(data) ⇒ Port
constructor
A new instance of Port.
- #is_serial? ⇒ Boolean
- #is_tcp? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(data) ⇒ Port
Returns a new instance of Port.
7 8 9 10 |
# File 'lib/artoo/port.rb', line 7 def initialize(data) @is_tcp, @is_serial = false parse(data) end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
5 6 7 |
# File 'lib/artoo/port.rb', line 5 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
5 6 7 |
# File 'lib/artoo/port.rb', line 5 def port @port end |
Instance Method Details
#is_serial? ⇒ Boolean
12 13 14 |
# File 'lib/artoo/port.rb', line 12 def is_serial? @is_serial == true end |
#is_tcp? ⇒ Boolean
16 17 18 |
# File 'lib/artoo/port.rb', line 16 def is_tcp? @is_tcp == true end |
#to_s ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/artoo/port.rb', line 20 def to_s if is_serial? port else "#{host}:#{port}" end end |