Class: Jcsv::RBParseFloat
Overview
Instance Attribute Summary collapse
-
#dfs ⇒ Object
readonly
Returns the value of attribute dfs.
-
#locale ⇒ Object
readonly
Returns the value of attribute locale.
Attributes included from NextFilter
Instance Method Summary collapse
- #execute(value, context) ⇒ Object
-
#initialize(locale) ⇒ RBParseFloat
constructor
A new instance of RBParseFloat.
Methods included from NextFilter
Constructor Details
#initialize(locale) ⇒ RBParseFloat
Returns a new instance of RBParseFloat.
91 92 93 94 95 96 97 |
# File 'lib/numeric_filters.rb', line 91 def initialize(locale) @locale = locale @dfs = DFSymbols.new(locale) @grouping_separator = @dfs.grouping_separator @decimal_separator = @dfs.decimal_separator super() end |
Instance Attribute Details
#dfs ⇒ Object (readonly)
Returns the value of attribute dfs.
89 90 91 |
# File 'lib/numeric_filters.rb', line 89 def dfs @dfs end |
#locale ⇒ Object (readonly)
Returns the value of attribute locale.
88 89 90 |
# File 'lib/numeric_filters.rb', line 88 def locale @locale end |
Instance Method Details
#execute(value, context) ⇒ Object
99 100 101 102 103 104 |
# File 'lib/numeric_filters.rb', line 99 def execute(value, context) validateInputNotNull(value, context) value = value.gsub(@grouping_separator.chr, ""). gsub(@decimal_separator.chr, ".").to_f exec_next(value, context) end |