Class: Apitizer::Routing::Proxy

Inherits:
Object
  • Object
show all
Defined in:
lib/apitizer/routing/proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(owner, options = {}) ⇒ Proxy

Returns a new instance of Proxy.



4
5
6
7
# File 'lib/apitizer/routing/proxy.rb', line 4

def initialize(owner, options = {})
  @owner = owner
  @options = options
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *arguments, &block) ⇒ Object



9
10
11
12
13
14
# File 'lib/apitizer/routing/proxy.rb', line 9

def method_missing(name, *arguments, &block)
  name = :"define_#{ name }"
  return super unless @owner.respond_to?(name)
  options = Helper.extract_hash!(arguments)
  @owner.send(name, *arguments, options.merge(@options), &block)
end