Sha256: 084d498804363628018e8c28ad8719b3f134be741632e5f35cad71968d6c538e

Contents?: true

Size: 228 Bytes

Versions: 5

Compression:

Stored size: 228 Bytes

Contents

module SafeYAML
  class Transform
    class ToFloat
      MATCHER = /\A\d*\.\d+\Z/.freeze

      def transform?(value)
        return false unless MATCHER.match(value)
        return true, value.to_f
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
safe_yaml-0.8.3 lib/safe_yaml/transform/to_float.rb
safe_yaml-0.8.2 lib/safe_yaml/transform/to_float.rb
safe_yaml-0.8.1 lib/safe_yaml/transform/to_float.rb
safe_yaml-0.8.0 lib/safe_yaml/transform/to_float.rb
safe_yaml-0.7.1 lib/safe_yaml/transform/to_float.rb