class SafeYAML::Transform::ToFloat

Constants

Infinity
MATCHER
NaN
PREDEFINED_VALUES

Public Instance Methods

transform?(value) click to toggle source
# File lib/safe_yaml/transform/to_float.rb, line 21
def transform?(value)
  return true, Float(value) if MATCHER.match(value)
  try_edge_cases?(value)
end
try_edge_cases?(value) click to toggle source
# File lib/safe_yaml/transform/to_float.rb, line 26
def try_edge_cases?(value)
  return true, PREDEFINED_VALUES[value] if PREDEFINED_VALUES.include?(value)
  return true, Parse::Sexagesimal.value(value) if Parse::Sexagesimal::FLOAT_MATCHER.match(value)
  return false
end