Sha256: 736831c02153dbb3379bad0eb6a3388173951d2ac0405159cb92a2575ed190e1

Contents?: true

Size: 211 Bytes

Versions: 3

Compression:

Stored size: 211 Bytes

Contents

require 'ruby-measurement/measurement'

class String
  def to_measurement
    Measurement.parse(self)
  end
  
  def to_unit
    Measurement::Unit[self] or raise ArgumentError, "Invalid unit: #{self}"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-measurement-1.2.2 lib/ruby-measurement/core_ext/string.rb
ruby-measurement-1.2.1 lib/ruby-measurement/core_ext/string.rb
ruby-measurement-1.2.0 lib/ruby-measurement/core_ext/string.rb