Module: ROM::SettingProxy

Extended by:
Dry::Core::ClassAttributes
Included in:
Command, Mapper, Relation
Defined in:
lib/rom/compat/setting_proxy.rb

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object (private)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Delegate to config when accessing deprecated class attributes



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/rom/compat/setting_proxy.rb', line 19

def method_missing(name, *args, &block)
  return super unless setting_mapping.key?(name)

  mapping = setting_mapping[name]
  ns, key = mapping

  if args.empty?
    if mapping.empty?
      config[name]
    else
      config[ns][Array(key).first]
    end
  else
    value = args.first

    if mapping.empty?
      config[name] = value
    else
      Array(key).each { |k| config[ns][k] = value }
    end

    value
  end
end