Skip to content

ArgumentError: Unknown target unit type: ary #6

Open
brundage opened this Issue Aug 27, 2012 · 2 comments

2 participants

@brundage
1.9.3p0 :001 > require 'quantity'
 => true 
1.9.3p0 :002 > Quantity::VERSION
 => 0.1.2 
1.9.3p0 :003 > [1.gallon, 1.gallon].flatten
ArgumentError: Unknown target unit type: ary
    from /home/brundage/.rvm/gems/ruby-1.9.3-p0/gems/quantity-0.1.2/lib/quantity.rb:356:in `method_missing'
    from (irb):3:in `flatten'
    from (irb):3
    from /home/brundage/.rvm/rubies/ruby-1.9.3-p0/bin/irb:16:in `<main>'
@bhuga
Owner
bhuga commented Aug 27, 2012

This would be a result of Ruby 1.9's new flattening behavior. Quantity is incorrectly assuming here that to_* is a unit conversion attempt and failing; it should probably return NoMethodError instead, which would fix the flattening and probably some other unknown bugs. See http://yehudakatz.com/2010/01/02/the-craziest-fing-bug-ive-ever-seen/

In other news, I don't really work on this anymore, but am happy to give you gem push rights if you're running with it.

@brundage

I patched it by calling super. I'll change to NoMethodError & submit a pull.

Thanks, I'll take gem push rights. I'm brundage on rubygems. Would you add me as a collaborator on this repo too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.