Class: Dizby::Delegator

Inherits:
Object
  • Object
show all
Defined in:
lib/dizby/utility/delegator.rb

Direct Known Subclasses

SecureProtocol::DirectTunnel

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ Delegator

Returns a new instance of Delegator.


6
7
8
# File 'lib/dizby/utility/delegator.rb', line 6

def initialize(obj)
  @__delegated_object__ = obj
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block)


26
27
28
# File 'lib/dizby/utility/delegator.rb', line 26

def method_missing(name, *args, &block)
  @__delegated_object__.__delegate__(name, self, *args, &block)
end

Instance Method Details

#__undelegated_get__(sym)


18
19
20
# File 'lib/dizby/utility/delegator.rb', line 18

def __undelegated_get__(sym)
  __instance_variable_get__(sym)
end

#__undelegated_set__(sym, value)


22
23
24
# File 'lib/dizby/utility/delegator.rb', line 22

def __undelegated_set__(sym, value)
  __instance_variable_set__(sym, value)
end

#instance_variable_get(sym)


10
11
12
# File 'lib/dizby/utility/delegator.rb', line 10

def instance_variable_get(sym)
  @__delegated_object__.instance_variable_get(sym)
end

#instance_variable_set(sym, value)


14
15
16
# File 'lib/dizby/utility/delegator.rb', line 14

def instance_variable_set(sym, value)
  @__delegated_object__.instance_variable_set(sym, value)
end