lib/eco/api/common/people/default_parsers/numeric_parser.rb in eco-helpers-1.3.1 vs lib/eco/api/common/people/default_parsers/numeric_parser.rb in eco-helpers-1.3.2
- old
+ new
@@ -6,10 +6,10 @@
class NumericParser < People::BaseParser
def process
@parsers.define_attribute(:number, dependencies: @options) do |parser|
parser.def_parser do |value, deps|
- value = value.to_s.strip == "" ? nil : (value.to_f rescue nil)
+ value = value.to_s.strip.empty? ? nil : (value.to_f rescue nil)
end.def_serializer do |value|
value.is_a?(Array) ? value.map { |v| v.to_s } : value.to_s
end
end
end