Module: WrAPI::RespondTo

Included in:
WrAPI
Defined in:
lib/wrapi/respond_to.rb

Overview

Module to delegate methods to the Client

Class Method Summary collapse

Class Method Details

.method_missing(method, *args, &block) ⇒ Object

Delegate method calls to the Client

Parameters:

  • method (Symbol)

    the method name

  • args (Array)

    the arguments passed to the method

  • block (Proc)

    an optional block



11
12
13
14
15
# File 'lib/wrapi/respond_to.rb', line 11

def self.method_missing(method, *args, &block)
  return super unless client.respond_to?(method)

  client.send(method, *args, &block)
end

.respond_to?(method, include_all = false) ⇒ Boolean

Checks if the Client responds to a method

Parameters:

  • method (Symbol)

    the method name

  • include_all (Boolean) (defaults to: false)

    whether to include private methods

Returns:

  • (Boolean)

    true if the Client responds to the method, false otherwise



22
23
24
# File 'lib/wrapi/respond_to.rb', line 22

def self.respond_to?(method, include_all = false)
  client.respond_to?(method, include_all) || super
end