Sha256: 7cb49678f613acebb2a47f247d5d59c94ceea096740756a7f84d07f5eed2fe21
Contents?: true
Size: 443 Bytes
Versions: 1
Compression:
Stored size: 443 Bytes
Contents
module SafeYAML class Transform class ToInteger def transform?(value) return true, Integer(value) rescue try_edge_cases?(value) end def try_edge_cases?(value) return true, Parse::Hexadecimal.value(value) if Parse::Hexadecimal::MATCHER.match(value) return true, Parse::Sexagesimal.value(value) if Parse::Sexagesimal::INTEGER_MATCHER.match(value) return false end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
safe_yaml-0.8.4 | lib/safe_yaml/transform/to_integer.rb |