Skip to content

Check the type of the default #435

New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 27, 2014
Merged

Check the type of the default #435

merged 1 commit into from
Aug 27, 2014

Conversation

huwr
Copy link

@huwr huwr commented Aug 27, 2014

Hi,

I think the default option should match the type. This is a problem I ran into while using Thor. I had code like this:

method_option :foo, :aliases => '-f', :default => '50', :type => :numeric

I expect the default value '50' to be a numeric, but of course it was a string.

Hopefully, this pull request solves the problem. ;-)

Cheers,
Huw.

It should match the type of the option.
@sferik
Copy link
Contributor

sferik commented Aug 27, 2014

Nice!

sferik added a commit that referenced this pull request Aug 27, 2014
Check the type of the default
@sferik sferik merged commit 81dadf4 into rails:master Aug 27, 2014
@rafaelfranca
Copy link
Member

I believe this will be a breaking change to some project. While they can forward fix the mismatch in the type the current releases of those project will now start to raise errors when loading the generator. This was the case of rails rails/rails#22789.

I agree this is a good change but I think we should release it in a non-backward compatible release. Maybe a warning instead of an exception for the current release?

@robdimarco
Copy link

@rafaelfranca comment above is spot on and is the cause of issue #533

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants