Skip to content

Commit

Permalink
Revert "Loading order of units is broken in Ruby 1.8.7"
Browse files Browse the repository at this point in the history
This reverts commit 32a8d6f.
  • Loading branch information
minad committed Jan 17, 2013
1 parent 40cd58e commit 50b811c
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/unit/system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@ def load(input)
load_factors(data['factors']) if data['factors']
load_units(data['units']) if data['units']

@unit.each do |name, unit|
defs = unit.delete(:defs)
unit[:def] = parse_unit(defs) if defs
validate_unit(unit[:def])
end
@unit.each {|name, unit| validate_unit(unit[:def]) }

true
end
Expand Down Expand Up @@ -155,7 +151,7 @@ def load_units(units)
name = name.to_sym
symbols = [unit['sym'] || []].flatten
$stderr.puts "Unit #{name} already defined" if @unit[name]
@unit[name] = { :symbol => symbols.first, :defs => unit['def'] }
@unit[name] = { :symbol => symbols.first, :def => parse_unit(unit['def']) }
symbols.each do |sym|
$stderr.puts "Unit symbol #{sym} for #{name} already defined" if @unit_symbol[name]
@unit_symbol[sym] = name
Expand Down

0 comments on commit 50b811c

Please sign in to comment.