Class: PagesCore::Templates::ConfigurationProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/pages_core/templates/configuration_proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(callback, parent = nil) ⇒ ConfigurationProxy

Returns a new instance of ConfigurationProxy.


4
5
6
7
# File 'lib/pages_core/templates/configuration_proxy.rb', line 4

def initialize(callback, parent = nil)
  @callback = callback
  @parent = parent
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object


9
10
11
12
13
14
15
16
17
18
19
# File 'lib/pages_core/templates/configuration_proxy.rb', line 9

def method_missing(method_name, *args, &block)
  if @parent && block_given?
    @callback.call(@parent, method_name, block)
  elsif @parent
    @callback.call(@parent, method_name, *args)
  elsif block_given?
    @callback.call(method_name, block)
  else
    @callback.call(method_name, *args)
  end
end

Instance Method Details

#respond_to_missing?Boolean

Returns:

  • (Boolean)

21
22
23
# File 'lib/pages_core/templates/configuration_proxy.rb', line 21

def respond_to_missing?
  true
end