Class: SafeYAML::Transform::ToFloat

Inherits:
Object
  • Object
show all
Defined in:
lib/safe_yaml/transform/to_float.rb

Constant Summary collapse

MATCHER =
/\A\d*\.\d+\Z/.freeze

Instance Method Summary collapse

Instance Method Details

#transform?(value) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
# File 'lib/safe_yaml/transform/to_float.rb', line 6

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