Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/numeric_with_unit.rb
Instance Method Summary collapse
Instance Method Details
#to_nwu(mthd = :to_r) ⇒ Object
189 190 191 192 193 194 195 |
# File 'lib/numeric_with_unit.rb', line 189 def to_nwu(mthd=:to_r) # 適当 m = self.match /.*?(?=[\s\(\[])/ value = m.to_s unit = m.post_match.strip.gsub(/^\[|\]$/, '') NumericWithUnit.new(value.__send__(mthd), unit) end |