Class: ConnectionFactory

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ ConnectionFactory

Returns a new instance of ConnectionFactory.



7
8
9
10
11
12
13
14
# File 'lib/connection_factory.rb', line 7

def initialize(args)
  hash_with_indifferent_access(args)
  if args[:host].nil?
    @connection = ComConnection.new(args)
  else
    @connection = EthernetConnection.new(args)
  end  
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



5
6
7
# File 'lib/connection_factory.rb', line 5

def connection
  @connection
end

Instance Method Details

#port_config_stringObject



16
17
18
# File 'lib/connection_factory.rb', line 16

def port_config_string
  @connection.port_config_string
end