Sha256: a2a32c0220877d40b6877a7decfa15726654979410fdcfffe90778cea2dea9d7

Contents?: true

Size: 221 Bytes

Versions: 11

Compression:

Stored size: 221 Bytes

Contents

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

      allow Float, Integer

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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
decanter-1.1.10 lib/decanter/parser/float_parser.rb
decanter-1.1.8 lib/decanter/parser/float_parser.rb
decanter-1.1.7 lib/decanter/parser/float_parser.rb
decanter-1.1.6 lib/decanter/parser/float_parser.rb
decanter-1.1.5 lib/decanter/parser/float_parser.rb
decanter-1.1.4 lib/decanter/parser/float_parser.rb
decanter-1.0.3 lib/decanter/parser/float_parser.rb
decanter-1.0.2 lib/decanter/parser/float_parser.rb
decanter-1.0.1 lib/decanter/parser/float_parser.rb
decanter-0.9.2 lib/decanter/parser/float_parser.rb
decanter-0.9.1 lib/decanter/parser/float_parser.rb