class ConfigX::NamespaceDelegator

Attributes

target[RW]

Public Class Methods

new(target, namespace = []) click to toggle source
# File lib/config_x/namespace_delegator.rb, line 3
def initialize(target, namespace = [])
  @target = target
  @namespace = namespace
end

Public Instance Methods

method_missing(*args, &block) click to toggle source
# File lib/config_x/namespace_delegator.rb, line 10
def method_missing(*args, &block)
  method_name = args.shift
  target.send(config_prefixed_name(method_name), *args, &block)
end

Private Instance Methods

config_prefixed_name(name) click to toggle source
# File lib/config_x/namespace_delegator.rb, line 17
def config_prefixed_name(name)
  parts = ([CONFIG_NAMESPACE] + @namespace + [name]).compact
  parts.join(Interface::NAMESPACE_SEPARATOR)
end