Module: OneTouch::PortBuild::ClassMethods

Defined in:
lib/one_touch/core/bridge.rb

Instance Method Summary collapse

Instance Method Details

#append_relation(opts = {}) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
# File 'lib/one_touch/core/bridge.rb', line 57

def append_relation(opts={})
  opts.reverse_merge!(bridge_klass: :Bridge, portname: :host)
  opts.merge!(port_group: {opts[:portname] => [name.to_sym]})
  RelationRecorder.update_or_new(opts)
  define_singleton_method "#{opts[:bridge_klass].underscore}_class" do
    opts[:bridge_klass].constantize
  end
  define_singleton_method "#{opts[:bridge_klass].underscore}_klass" do
    opts[:bridge_klass]
  end
end