Class: SafeYAML::Transform::ToFloat

### Home Classes Methods

### In Files

- lib/safe_yaml/transform/to_float.rb

### Parent

Object

### Methods

- #transform?
- #try_edge_cases?

### Class/Module Index

Quicksearch

- SafeYAML
- SafeYAML::Deep
- SafeYAML::Parse
- SafeYAML::Parse::Date
- SafeYAML::Parse::Hexadecimal
- SafeYAML::Parse::Sexagesimal
- SafeYAML::PsychHandler
- SafeYAML::PsychResolver
- SafeYAML::Resolver
- SafeYAML::SafeToRubyVisitor
- SafeYAML::SyckResolver
- SafeYAML::Transform
- SafeYAML::Transform::ToBoolean
- SafeYAML::Transform::ToDate
- SafeYAML::Transform::ToFloat
- SafeYAML::Transform::ToInteger
- SafeYAML::Transform::ToNil
- SafeYAML::Transform::ToSymbol
- SafeYAML::Transform::TransformationMap
- SafeYAML::Transform::TransformationMap::CaseAgnosticMap
- SafeYAML::Transform::TransformationMap::ClassMethods
- Object
- YAML

No matching classes.

# 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

[Validate]

Generated with the Darkfish Rdoc Generator 2.