Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/number_name_string.rb
Overview
Would be ideal if we could only add this functionality only if included
Instance Method Summary collapse
Instance Method Details
#old_to_i ⇒ Object
16 |
# File 'lib/number_name_string.rb', line 16 alias_method :old_to_i, :to_i |
#to_comma ⇒ Object
18 19 20 |
# File 'lib/number_name_string.rb', line 18 def to_comma self.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse end |
#to_i ⇒ Object
22 23 24 25 26 |
# File 'lib/number_name_string.rb', line 22 def to_i result = NumberNameString[self] # TODO: verify output of above may be a string result.is_a?(String) ? result.old_to_i : result end |