Class: LastModCache::Proxy

Inherits:
Object
  • Object
show all
Defined in:
lib/last_mod_cache.rb

Overview

Proxy class that sends all method calls to a block.

Instance Method Summary collapse

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