Class: Integer
- Inherits:
-
Object
- Object
- Integer
- Defined in:
- lib/gstring.rb
Overview
String
Instance Method Summary collapse
Instance Method Details
#to_eng(pa = 6, unit = nil) ⇒ Object
1348 1349 1350 |
# File 'lib/gstring.rb', line 1348 def to_eng(pa=6, unit=nil) return self.to_f.to_eng(pa, unit) end |
#to_num ⇒ Object
1340 1341 1342 |
# File 'lib/gstring.rb', line 1340 def to_num self end |
#to_scd(dp = 0, delim = ',.') ⇒ Object
1343 1344 1345 1346 1347 |
# File 'lib/gstring.rb', line 1343 def to_scd(dp=0, delim = ',.') return self.to_f.to_scd(dp, delim) unless dp.zero? str = self.to_s.reverse.scan(/\d{1,3}/).join(delim.first).reverse (self < 0) ? "-" + str : str end |