Class: Flexirest::RequestDelegator

Inherits:
Delegator
  • Object
show all
Defined in:
lib/flexirest/request_delegator.rb

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ RequestDelegator

Returns a new instance of RequestDelegator.



3
4
5
6
# File 'lib/flexirest/request_delegator.rb', line 3

def initialize(obj)
  super
  @delegate_obj = obj
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



20
21
22
23
24
25
26
# File 'lib/flexirest/request_delegator.rb', line 20

def method_missing(name, *args, &block)
  # Handles issue with private method 'test' on base Ruby Object
  return @delegate_obj.test if name.to_sym == :test

  # Forward request to delegate
  @delegate_obj.send(name, *args, &block)
end

Instance Method Details

#__getobj__Object



8
9
10
# File 'lib/flexirest/request_delegator.rb', line 8

def __getobj__
  @delegate_obj
end

#__setobj__(obj) ⇒ Object



12
13
14
# File 'lib/flexirest/request_delegator.rb', line 12

def __setobj__(obj)
  @delegate_obj = obj
end

#_delegate?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/flexirest/request_delegator.rb', line 40

def _delegate?
  return true
end

#classObject



16
17
18
# File 'lib/flexirest/request_delegator.rb', line 16

def class
  @delegate_obj.class
end

#instance_of?(obj) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/flexirest/request_delegator.rb', line 36

def instance_of?(obj)
  @delegate_obj.instance_of?(obj)
end

#is_a?(obj) ⇒ Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/flexirest/request_delegator.rb', line 32

def is_a?(obj)
  @delegate_obj.is_a?(obj)
end

#kind_of?(obj) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/flexirest/request_delegator.rb', line 28

def kind_of?(obj)
  @delegate_obj.kind_of?(obj)
end