Class: Integer

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

Overview

String

Instance Method Summary collapse

Instance Method Details

#to_eng(pa = 6, unit = nil) ⇒ Object



1589
1590
1591
# File 'lib/gstring.rb', line 1589

def to_eng(pa=6, unit=nil)
  return self.to_f.to_eng(pa, unit)
end

#to_numObject



1581
1582
1583
# File 'lib/gstring.rb', line 1581

def to_num
  self
end

#to_scd(dp = 0, delim = ',.') ⇒ Object



1584
1585
1586
1587
1588
# File 'lib/gstring.rb', line 1584

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

#to_subscript(html = false) ⇒ Object



1598
1599
1600
# File 'lib/gstring.rb', line 1598

def to_subscript(html=false)
  to_s.to_subscript(html)
end

#to_superscript(html = false) ⇒ Object



1595
1596
1597
# File 'lib/gstring.rb', line 1595

def to_superscript(html=false)
  to_s.to_superscript(html)
end

#uchrObject



1592
1593
1594
# File 'lib/gstring.rb', line 1592

def uchr
  chr(Encoding::UTF_8)
end