Sha256: 22ce78cf91bf5a97244f6f113a37bbd962667ec5959234064be5235d97f8f494

Contents?: true

Size: 640 Bytes

Versions: 35

Compression:

Stored size: 640 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 == "" ? 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

35 entries across 35 versions & 1 rubygems

Version Path
eco-helpers-1.3.1 lib/eco/api/common/people/default_parsers/numeric_parser.rb
eco-helpers-1.2.2 lib/eco/api/common/people/default_parsers/numeric_parser.rb
eco-helpers-1.2.1 lib/eco/api/common/people/default_parsers/numeric_parser.rb
eco-helpers-1.1.8 lib/eco/api/common/people/default_parsers/numeric_parser.rb
eco-helpers-1.1.7 lib/eco/api/common/people/default_parsers/numeric_parser.rb
eco-helpers-1.1.6 lib/eco/api/common/people/default_parsers/numeric_parser.rb
eco-helpers-1.1.5 lib/eco/api/common/people/default_parsers/numeric_parser.rb
eco-helpers-1.1.4 lib/eco/api/common/people/default_parsers/numeric_parser.rb
eco-helpers-1.1.3 lib/eco/api/common/people/default_parsers/numeric_parser.rb
eco-helpers-1.1.2 lib/eco/api/common/people/default_parsers/numeric_parser.rb
eco-helpers-1.1.1 lib/eco/api/common/people/default_parsers/numeric_parser.rb
eco-helpers-1.0.14 lib/eco/api/common/people/default_parsers/numeric_parser.rb
eco-helpers-1.0.13 lib/eco/api/common/people/default_parsers/numeric_parser.rb
eco-helpers-1.0.12 lib/eco/api/common/people/default_parsers/numeric_parser.rb
eco-helpers-1.0.11 lib/eco/api/common/people/default_parsers/numeric_parser.rb
eco-helpers-1.0.10 lib/eco/api/common/people/default_parsers/numeric_parser.rb
eco-helpers-1.0.9 lib/eco/api/common/people/default_parsers/numeric_parser.rb
eco-helpers-1.0.8 lib/eco/api/common/people/default_parsers/numeric_parser.rb
eco-helpers-1.0.7 lib/eco/api/common/people/default_parsers/numeric_parser.rb
eco-helpers-1.0.6 lib/eco/api/common/people/default_parsers/numeric_parser.rb