Module: FlightConfig::Links::ClassMethods

Includes:
Globber::ClassMethods
Defined in:
lib/flight_config/links.rb

Instance Method Summary collapse

Methods included from Globber::ClassMethods

#glob_read

Instance Method Details



37
38
39
40
41
42
43
# File 'lib/flight_config/links.rb', line 37

def define_link(key, klass, glob: false, &b)
  links_class.define_method(key) do
    args = config.instance_exec(&b)
    method = (glob ? :glob_read : :read)
    klass.public_send(method, *args, registry: config.__registry__)
  end
end


45
46
47
# File 'lib/flight_config/links.rb', line 45

def links_class
  @links_class ||= Struct.new(:config)
end