Sha256: fbc61b71dc80ec5b9ed4852b28037d69455778f438b574a83795c7e48c94ac8f

Contents?: true

Size: 220 Bytes

Versions: 5

Compression:

Stored size: 220 Bytes

Contents

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

      allow Float, Fixnum

      parser do |val, options|
        val.scan(REGEX).join.try(:to_f)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
decanter-0.9.0 lib/decanter/parser/float_parser.rb
decanter-0.8.2 lib/decanter/parser/float_parser.rb
decanter-0.8.1 lib/decanter/parser/float_parser.rb
decanter-0.8.0 lib/decanter/parser/float_parser.rb
decanter-0.7.2 lib/decanter/parser/float_parser.rb