Class: MasterDelegator

Inherits:
Object
  • Object
show all
Defined in:
lib/restfulie/client/master_delegator.rb

Direct Known Subclasses

Restfulie::Client::HTTP::Recipe

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/restfulie/client/master_delegator.rb', line 9

def method_missing(sym, *args, &block)
  if original_respond_to?(sym)
    result = super(sym, *args, &block)
  elsif @requester.respond_to?(sym)
    result = @requester.send(sym, *args, &block)
  else
    # let it go
    return super(sym, *args, &block)
  end
  delegate_parse result
end

Instance Method Details

#original_respond_to?Object



3
# File 'lib/restfulie/client/master_delegator.rb', line 3

alias_method :original_respond_to?, :respond_to?

#respond_to?(sym) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/restfulie/client/master_delegator.rb', line 5

def respond_to?(sym)
  original_respond_to?(sym) || @requester.respond_to?(sym)
end