Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/ruby-measurement/core_ext/string.rb
Instance Method Summary collapse
Instance Method Details
#to_measurement ⇒ Object
4 5 6 |
# File 'lib/ruby-measurement/core_ext/string.rb', line 4 def to_measurement Measurement.parse(self) end |
#to_unit ⇒ Object
8 9 10 |
# File 'lib/ruby-measurement/core_ext/string.rb', line 8 def to_unit Measurement::Unit[self] or raise ArgumentError, "Invalid unit: '#{self}'" end |