Something (i.e. MathViz::Term) which has MathViz::Units.
Statefull toggle numerator/denominator of unit assignment; e.g. m/s = .m.per.s
# File lib/mathviz.rb, line 268 def per @unit_sign ||= 1 @unit_sign *= -1 self end
api method for unwrapping terms
# File lib/mathviz.rb, line 280 def to_value to_f end
Add the named unit to our units and return self. See also MathViz::Units::Class#new_units
# File lib/mathviz.rb, line 256 def unit(x) @unit ||= MathViz::Unit.new @unit_sign ||= 1 if (@unit_sign > 0) @unit *= MathViz::Unit.new(x) else @unit /= MathViz::Unit.new(x) end self end
Generated with the Darkfish Rdoc Generator 2.