lib/eco/api/common/people/default_parsers/numeric_parser.rb in eco-helpers-0.6.6 vs lib/eco/api/common/people/default_parsers/numeric_parser.rb in eco-helpers-0.6.7
- old
+ new
@@ -6,10 +6,11 @@
class NumericParser < People::BaseParser
def process
@parsers.define_attribute(:number, dependencies: @options) do |parser|
parser.def_parser do |value, deps|
- deps[:schema]&.fields[deps["attr"]].parse_text(value)
+ #deps[:schema]&.fields[deps["attr"]].parse_text(value)
+ value = value.to_s.strip == "" ? 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