class ConnectionFactory
Attributes
connection[R]
Public Class Methods
new(args)
click to toggle source
# 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
Public Instance Methods
port_config_string()
click to toggle source
# File lib/connection_factory.rb, line 16 def port_config_string @connection.port_config_string end
Private Instance Methods
hash_with_indifferent_access(args)
click to toggle source
# File lib/connection_factory.rb, line 21 def hash_with_indifferent_access(args) args.default_proc = proc do |h, k| case k when String then sym = k.to_sym; h[sym] if h.key?(sym) when Symbol then str = k.to_s; h[str] if h.key?(str) end end end