Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/numeric_with_unit.rb

Instance Method Summary collapse

Instance Method Details

#to_nwu(mthd = :to_r) ⇒ Object



189
190
191
192
# File 'lib/numeric_with_unit.rb', line 189

def to_nwu(mthd=:to_r)
  m = self.match /(?<value>.+) (?<unit>.+)/ # 適当
  NumericWithUnit.new(m[:value].__send__(mthd), m[:unit])
end