Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Moneta::Memory fetch(key, &block) throws warnings #7

nanodeath opened this Issue Nov 21, 2010 · 1 comment


None yet
2 participants

If you try to call .fetch("key") {|el| ... } Ruby 1.8.7 and 1.9.2 with the Memory implementation both print "warning: block supersedes default value argument". This is because Moneta's signature is "def fetch(key, value=nil, &block)" and defers to Hash's fetch(key, &block) implementation, which then checks the number of arguments -- i.e. if you pass two arguments to it (and the second is nil, like in my original example) it will print a warning. It's not as clean, but the value variable should be checked for nil before explicitly calling super with arguments.


minad commented Dec 20, 2012


@minad minad closed this Dec 20, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment