Method: RubyUnits::String#to_unit

Defined in:
lib/ruby_units/string.rb

#to_unit(other = nil) ⇒ RubyUnits::Unit

Make a string into a unit

Parameters:

  • (defaults to: nil)

    unit to convert to

Returns:



13
14
15
# File 'lib/ruby_units/string.rb', line 13

def to_unit(other = nil)
  other ? RubyUnits::Unit.new(self).convert_to(other) : RubyUnits::Unit.new(self)
end