Callable defaults #99

wants to merge 1 commit into


None yet

5 participants


For dynamic defaults.


I think it would be better to do it like this:

options[key] = value.respond_to?(:call) ? : value

Since both a lambda and a Proc respond to call (plus any other Object the user could create that responds to call as well

sferik commented Feb 23, 2013

This seems like a good feature but could you please add tests?

rweng commented Jan 7, 2014



+1 on this. I would like to configure defaults for certain parameters to be read from environment variables (in my case AWS credentials.)

While this works by simply doing :default => ENV['FOO'] it can't be unit tested because by the time tests run, the Thor class is already configured since it was done at load time.

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