Class: AndSon::Connection

Inherits:
Struct
  • Object
show all
Defined in:
lib/and-son/connection.rb

Defined Under Namespace

Modules: NoRequest

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#hostObject

Returns the value of attribute host

Returns:

  • (Object)

    the current value of host



6
7
8
# File 'lib/and-son/connection.rb', line 6

def host
  @host
end

#portObject

Returns the value of attribute port

Returns:

  • (Object)

    the current value of port



6
7
8
# File 'lib/and-son/connection.rb', line 6

def port
  @port
end

Instance Method Details

#openObject



11
12
13
14
15
16
# File 'lib/and-son/connection.rb', line 11

def open
  protocol_connection = Sanford::Protocol::Connection.new(tcp_socket)
  yield protocol_connection if block_given?
ensure
  protocol_connection.close if protocol_connection
end