Class: RubyPatterns::VirtualProxy
- Inherits:
-
Object
- Object
- RubyPatterns::VirtualProxy
show all
- Defined in:
- lib/ruby_patterns/virtual_proxy.rb
Constant Summary
collapse
- GHOST =
"GHOST"
- LOADED =
"LOADED"
Instance Method Summary
collapse
Constructor Details
Returns a new instance of VirtualProxy.
13
14
15
16
|
# File 'lib/ruby_patterns/virtual_proxy.rb', line 13
def initialize(key)
@__key = key
@__real = nil
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
28
29
30
31
32
33
|
# File 'lib/ruby_patterns/virtual_proxy.rb', line 28
def method_missing(name, *args, &block)
if !__real
__load
end
__real.send(name, *args, &block)
end
|
Instance Method Details
#inspect ⇒ Object
22
23
24
|
# File 'lib/ruby_patterns/virtual_proxy.rb', line 22
def inspect
"#<#{self.class.name} key=#{__key.inspect} #{__state}>"
end
|
#to_s ⇒ Object
18
19
20
|
# File 'lib/ruby_patterns/virtual_proxy.rb', line 18
def to_s
__key
end
|