Skip to content
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

Cannot create Unit object with hash #138

Open
Nowaker opened this issue Jun 12, 2016 · 1 comment
Open

Cannot create Unit object with hash #138

Nowaker opened this issue Jun 12, 2016 · 1 comment
Labels

Comments

@Nowaker
Copy link

Nowaker commented Jun 12, 2016

    # Create a new Unit object.  Can be initialized using a String, a Hash, an Array, Time, DateTime
    #
    # @example Valid options include:
    # ...
    #  [1, 'kg']
    #  {:scalar => 1, :numerator=>'kg'}
    def initialize(*options)

The latter doesn't work as promised:

2.2.2 :012 > Unit.new({:scalar => 1, :numerator=>'kg'})
TypeError: no implicit conversion of Array into String
        from /home/nowaker/.rvm/gems/ruby-2.2.2/gems/ruby-units-2.0.0/lib/ruby_units/unit.rb:410:in `+'
        from /home/nowaker/.rvm/gems/ruby-2.2.2/gems/ruby-units-2.0.0/lib/ruby_units/unit.rb:410:in `is_base?'
        from /home/nowaker/.rvm/gems/ruby-2.2.2/gems/ruby-units-2.0.0/lib/ruby_units/unit.rb:1246:in `update_base_scalar'
        from /home/nowaker/.rvm/gems/ruby-2.2.2/gems/ruby-units-2.0.0/lib/ruby_units/unit.rb:344:in `initialize'
@olbrich olbrich added the bug label Jun 13, 2016
@sshaw
Copy link

sshaw commented Jul 7, 2019

At least remove this usage from the documentation.

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

No branches or pull requests

3 participants