Class: Integer
- Inherits:
-
Object
- Object
- Integer
- Defined in:
- lib/gstring.rb
Overview
String
Instance Method Summary collapse
- #to_eng(pa = 6, unit = nil) ⇒ Object
- #to_num ⇒ Object
- #to_scd(dp = 0, delim = ',.') ⇒ Object
- #to_subscript(html = false) ⇒ Object
- #to_superscript(html = false) ⇒ Object
- #uchr ⇒ Object
Instance Method Details
#to_eng(pa = 6, unit = nil) ⇒ Object
1767 1768 1769 |
# File 'lib/gstring.rb', line 1767 def to_eng(pa=6, unit=nil) return self.to_f.to_eng(pa, unit) end |
#to_num ⇒ Object
1759 1760 1761 |
# File 'lib/gstring.rb', line 1759 def to_num self end |
#to_scd(dp = 0, delim = ',.') ⇒ Object
1762 1763 1764 1765 1766 |
# File 'lib/gstring.rb', line 1762 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
1776 1777 1778 |
# File 'lib/gstring.rb', line 1776 def to_subscript(html=false) to_s.to_subscript(html) end |
#to_superscript(html = false) ⇒ Object
1773 1774 1775 |
# File 'lib/gstring.rb', line 1773 def to_superscript(html=false) to_s.to_superscript(html) end |
#uchr ⇒ Object
1770 1771 1772 |
# File 'lib/gstring.rb', line 1770 def uchr chr(Encoding::UTF_8) end |