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.


4
5
6
# File 'lib/dizby/utility/delegator.rb', line 4

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)


24
25
26
# File 'lib/dizby/utility/delegator.rb', line 24

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

Instance Method Details

#__undelegated_get__(sym)


16
17
18
# File 'lib/dizby/utility/delegator.rb', line 16

def __undelegated_get__(sym)
  __instance_variable_get__(sym)
end

#__undelegated_set__(sym, value)


20
21
22
# File 'lib/dizby/utility/delegator.rb', line 20

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

#instance_variable_get(sym)


8
9
10
# File 'lib/dizby/utility/delegator.rb', line 8

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

#instance_variable_set(sym, value)


12
13
14
# File 'lib/dizby/utility/delegator.rb', line 12

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