Class: EthernetConnection

Inherits:
Object
  • Object
show all
Defined in:
lib/ethernet_connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ EthernetConnection

Returns a new instance of EthernetConnection.



3
4
5
6
7
8
9
# File 'lib/ethernet_connection.rb', line 3

def initialize(args)
  @portname          = 'TCP/IP'
  @host              = args[:host]
  @port              = args[:port]              || default_port
  @connectiontimeout = args[:connectiontimeout] || default_connectiontimeout
  @timeout           = args[:timeout]           || default_timeout
end

Instance Attribute Details

#connectiontimeoutObject (readonly)

Returns the value of attribute connectiontimeout.



2
3
4
# File 'lib/ethernet_connection.rb', line 2

def connectiontimeout
  @connectiontimeout
end

#hostObject (readonly)

Returns the value of attribute host.



2
3
4
# File 'lib/ethernet_connection.rb', line 2

def host
  @host
end

#portObject (readonly)

Returns the value of attribute port.



2
3
4
# File 'lib/ethernet_connection.rb', line 2

def port
  @port
end

#portnameObject (readonly)

Returns the value of attribute portname.



2
3
4
# File 'lib/ethernet_connection.rb', line 2

def portname
  @portname
end

#timeoutObject (readonly)

Returns the value of attribute timeout.



2
3
4
# File 'lib/ethernet_connection.rb', line 2

def timeout
  @timeout
end

Instance Method Details

#port_config_stringObject



11
12
13
# File 'lib/ethernet_connection.rb', line 11

def port_config_string  
  "PortName=#{portname};Host=#{host};Port=#{port};ConnectionTimeout=#{connectiontimeout};Timeout=timeout"
end