Sha256: 41ea43172936de40e3f7ab453e63d41cb0515cb3843555acb78471090de2225a

Contents?: true

Size: 411 Bytes

Versions: 9

Compression:

Stored size: 411 Bytes

Contents

# this patch is necessary for ruby 1.8 because cases where
# Integers are divided by Units don't work quite right

if RUBY_VERSION < "1.9"
  class Fixnum
    alias quo_without_units quo
  
    def quo_with_units(other)
      case other
      when Unit
        self * other.inverse
      else
        quo_without_units(other)
      end
    end
  
    alias quo quo_with_units
    alias / quo_with_units
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
rails-units-1.7.1 lib/rails_units/fixnum.rb
rails-units-1.6.0 lib/rails_units/fixnum.rb
ruby-units-1.3.2 lib/ruby_units/fixnum.rb
ruby-units-1.3.2.a lib/ruby_units/fixnum.rb
rails-units-1.5.2 lib/rails_units/fixnum.rb
rails-units-1.5.1 lib/rails_units/fixnum.rb
rails-units-1.4.1 lib/ruby_units/fixnum.rb
rails-units-1.3.1 lib/ruby_units/fixnum.rb
ruby-units-1.3.1 lib/ruby_units/fixnum.rb