Module: MathViz::Measurable
Overview
Something (i.e. Numeric) which does not have MathViz::Units, but can be turned into something which does (i.e., MathViz::Constant)
Instance Method Summary collapse
-
#per ⇒ Object
return term wrapping self with new units assigned to the denominator.
-
#to_value ⇒ Object
api method for unwrapping terms.
-
#unit(x) ⇒ Object
return term wrapping self with the specified units; see also MathViz::Units::Class#new_units.
Methods included from Units::Class
Instance Method Details
#per ⇒ Object
return term wrapping self with new units assigned to the denominator
227 228 229 |
# File 'lib/mathviz.rb', line 227 def per MathViz.default_term.new(self).per end |
#to_value ⇒ Object
api method for unwrapping terms
232 233 234 235 236 237 238 |
# File 'lib/mathviz.rb', line 232 def to_value if kind_of? Numeric to_f else self end end |
#unit(x) ⇒ Object
return term wrapping self with the specified units; see also MathViz::Units::Class#new_units
222 223 224 |
# File 'lib/mathviz.rb', line 222 def unit(x) MathViz.default_term.new(self).unit(x) end |