class Bifrossht::Connection
Attributes
connections[R]
Public Class Methods
connection(hop)
click to toggle source
# File lib/bifrossht/connection.rb, line 44 def connection(hop) @connections[hop] end
find(target)
click to toggle source
# File lib/bifrossht/connection.rb, line 22 def find(target) c = match(target) return c unless c.nil? probe(target) end
match(target)
click to toggle source
# File lib/bifrossht/connection.rb, line 29 def match(target) connections.values.select do |c| c.match(target) end.first end
probe(target)
click to toggle source
# File lib/bifrossht/connection.rb, line 35 def probe(target) connections.values.reject(&:skip_probe).each do |c| Logger.debug("probing #{c.name}...") return c if c.probe(target) end nil end
register_connection(config)
click to toggle source
# File lib/bifrossht/connection.rb, line 15 def register_connection(config) @connections ||= {} klass = build_class_name(config.type) @connections[config.name] = klass.new(config) end
register_connections(connections = [])
click to toggle source
# File lib/bifrossht/connection.rb, line 11 def register_connections(connections = []) connections.each { |c| register_connection(c) } end
Private Class Methods
build_class_name(type)
click to toggle source
# File lib/bifrossht/connection.rb, line 50 def build_class_name(type) Object.const_get("Bifrossht::Connection::#{type}") rescue NameError => e raise ParameterError, "Cant load connection: #{e.message}" end