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.



6
7
8
9
# File 'lib/pages_core/templates/configuration_proxy.rb', line 6

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



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

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)


23
24
25
# File 'lib/pages_core/templates/configuration_proxy.rb', line 23

def respond_to_missing?
  true
end