matthewrudy / memoist

ActiveSupport::Memoizable with a few enhancements
MIT License
920 stars 99 forks source link

Optional value not supported for last argument? #23

Closed gamov closed 9 years ago

gamov commented 10 years ago

I have a method defined this way:

def latest_duty_tax(cat, country_code=@country)
…
end
memoize :latest_duty_tax

It works with ActiveSupport::Memoizable but triggers an exception with Memoist:

sidr.latest_duty_tax(cat, country_code, :reload)
# =>
#ArgumentError:   wrong number of arguments (3 for 2)
#/app/services/shipping_item_data_retriever.rb:24:in `latest_duty_tax'
#/.rvm/gems/ruby-1.9.3-p545@ector/gems/memoist-0.9.3/lib/memoist.rb:174:in `latest_duty_tax'
matthewrudy commented 10 years ago

good one. need to look at this.

findchris commented 10 years ago

Good catch :+1:

ajmurmann commented 10 years ago

just encountered the same issue with an optional Hash as the last argument. :+1: