Sha256: bea333d7ea709286a6d82b9890ba94e4ca2be88cc3db4788d440eb3ecf959e44
Contents?: true
Size: 641 Bytes
Versions: 23
Compression:
Stored size: 641 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| 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 end end end end end end
Version data entries
23 entries across 23 versions & 1 rubygems