Sha256: 414cbbea70267d85db2c0d5428069365687180767feeeacf1e21966b9f88a0c3

Contents?: true

Size: 269 Bytes

Versions: 10

Compression:

Stored size: 269 Bytes

Contents

module Decanter
  module ValueParser
    class IntegerParser < Base
      REGEX = /(\d|[.])/

      allow Fixnum

      parser do |name, val, options|
        val.is_a?(Float) ?
          val.to_i :
          val.scan(REGEX).join.try(:to_i)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
decanter-0.7.1 lib/decanter/value_parser/integer_parser.rb
decanter-0.7.0 lib/decanter/value_parser/integer_parser.rb
decanter-0.6.3 lib/decanter/value_parser/integer_parser.rb
decanter-0.6.2 lib/decanter/value_parser/integer_parser.rb
decanter-0.6.1 lib/decanter/value_parser/integer_parser.rb
decanter-0.6.0 lib/decanter/value_parser/integer_parser.rb
decanter-0.5.5 lib/decanter/value_parser/integer_parser.rb
decanter-0.5.4 lib/decanter/value_parser/integer_parser.rb
decanter-0.5.3 lib/decanter/value_parser/integer_parser.rb
decanter-0.5.2 lib/decanter/value_parser/integer_parser.rb