Class: LastModCache::Proxy
- Inherits:
-
Object
- Object
- LastModCache::Proxy
- Defined in:
- lib/last_mod_cache.rb
Overview
Proxy class that sends all method calls to a block.
Instance Method Summary collapse
-
#initialize(&block) ⇒ Proxy
constructor
A new instance of Proxy.
- #method_missing(method, *args, &block) ⇒ Object
Constructor Details
#initialize(&block) ⇒ Proxy
Returns a new instance of Proxy.
254 255 256 |
# File 'lib/last_mod_cache.rb', line 254 def initialize(&block) @block = block end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
258 259 260 261 |
# File 'lib/last_mod_cache.rb', line 258 def method_missing(method, *args, &block) @object = @block.call unless defined?(@object) @object.send(method, *args, &block) end |