Class: VisionMate::Connection
- Inherits:
-
Object
- Object
- VisionMate::Connection
- Defined in:
- lib/vision_mate/connection.rb
Overview
Connection is an abstract interface used to wrap the Telnet connection to the scanner. It provides a high level API for the scanner and standardizes the output returned.
Instance Attribute Summary collapse
-
#telnet_connection ⇒ Object
Returns the value of attribute telnet_connection.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(host, port, telnet_class = Telnet) ⇒ Connection
constructor
A new instance of Connection.
- #scan ⇒ Object
Constructor Details
#initialize(host, port, telnet_class = Telnet) ⇒ Connection
Returns a new instance of Connection.
9 10 11 |
# File 'lib/vision_mate/connection.rb', line 9 def initialize(host, port, telnet_class = Telnet) self.telnet_connection = Telnet.connect(host, port) end |
Instance Attribute Details
#telnet_connection ⇒ Object
Returns the value of attribute telnet_connection.
7 8 9 |
# File 'lib/vision_mate/connection.rb', line 7 def telnet_connection @telnet_connection end |
Instance Method Details
#close ⇒ Object
17 18 19 |
# File 'lib/vision_mate/connection.rb', line 17 def close telnet_connection.close end |
#scan ⇒ Object
13 14 15 |
# File 'lib/vision_mate/connection.rb', line 13 def scan VisionMate::Rack.new(telnet_connection.scan) end |