Class: ConfigX::NamespaceDelegator

Inherits:
Object
  • Object
show all
Defined in:
lib/config_x/namespace_delegator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target, namespace = []) ⇒ NamespaceDelegator

Returns a new instance of NamespaceDelegator.



3
4
5
6
# File 'lib/config_x/namespace_delegator.rb', line 3

def initialize(target, namespace = [])
  @target = target
  @namespace = namespace
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block) ⇒ Object



10
11
12
13
# 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

Instance Attribute Details

#targetObject

Returns the value of attribute target.



8
9
10
# File 'lib/config_x/namespace_delegator.rb', line 8

def target
  @target
end