Class: Formatters::FormatInteger
- Includes:
- ActionView::Helpers::NumberHelper
- Defined in:
- lib/formatters/format_integer.rb
Instance Method Summary collapse
- #from(value, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ FormatInteger
constructor
A new instance of FormatInteger.
- #to(str, options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ FormatInteger
8 9 |
# File 'lib/formatters/format_integer.rb', line 8 def initialize( = {}) end |
Instance Method Details
#from(value, options = {}) ⇒ Object
11 12 13 14 |
# File 'lib/formatters/format_integer.rb', line 11 def from(value, = {}) = {:delimiter => ','}.merge() number_with_delimiter value, end |
#to(str, options = {}) ⇒ Object
16 17 18 19 |
# File 'lib/formatters/format_integer.rb', line 16 def to(str, = {}) return nil if str.nil? or str.empty? str.gsub(/,/, '').to_i end |