Sha256: 13477df632a90546a2eedb2eb86f338f0e1170d5c7f5c4727580dfa94151e3f5
Contents?: true
Size: 714 Bytes
Versions: 9
Compression:
Stored size: 714 Bytes
Contents
module Eco module API module Common module People class DefaultParsers 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) 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 end end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems