Class: Ting::MemoizeCall

Inherits:
Object
  • Object
show all
Includes:
Procable
Defined in:
lib/ting/memoize_call.rb

Instance Method Summary collapse

Methods included from Procable

#memoize, #to_proc

Constructor Details

#initialize(target) ⇒ MemoizeCall

Returns a new instance of MemoizeCall.



5
6
7
8
# File 'lib/ting/memoize_call.rb', line 5

def initialize(target)
  @target = target
  @map = {}
end

Instance Method Details

#call(*args) ⇒ Object



10
11
12
# File 'lib/ting/memoize_call.rb', line 10

def call(*args)
  @map[args] ||= @target.call(*args)
end