Method: Tins::Unit.parse
- Defined in:
- lib/tins/unit.rb
.parse(string, format: '%f %U', unit: ?b, prefix: nil) ⇒ Object
Parse the string string if it matches format with the unit unit and the prefixes specified by prefix.
169 170 171 172 |
# File 'lib/tins/unit.rb', line 169 def parse(string, format: '%f %U', unit: ?b, prefix: nil) prefixes = prefixes(prefix) FormatParser.new(format, UnitParser.new(string, unit, prefixes)).parse end |