def unite(unit=nil,power=1,measure=nil)
if !unit
self
else
if (unit.kind_of? Array)
units = UnitsHash.new
unit.each {|u| units.merge! 1.unite(u)}
unit = units
elsif (unit.kind_of? String)||(unit.kind_of? Symbol)
s = unit.to_s
as = s.split('_and_')
if as.size == 1
units = Units.lookup(as[0])
case units.size
when 1 then unit = units[0]
when 0 then
as = as[0].split('_')
units_problem("usage",
AmbiguousUnitsException.new(unit),
:unit=,unit) if as.size == 0
unit = unite(as,power,measure).unit
else
units_problem("usage",
AmbiguousUnitsException.new(unit),
:unit=,unit)
end
else
unit = unite(as,power,measure).unit
end
elsif unit.kind_of? NumericWithUnits
unit = unit.unit
end
NumericWithUnits.new(self,unit,power)
end
end