module Saneitized::Converter
Public Instance Methods
false?(unknown)
click to toggle source
# File lib/saneitized/converter.rb, line 39 def false?(unknown) (unknown == 'false') ? false : :nope end
float?(unknown)
click to toggle source
# File lib/saneitized/converter.rb, line 59 def float?(unknown) Float(unknown) rescue ArgumentError, TypeError :nope end
integer?(unknown)
click to toggle source
# File lib/saneitized/converter.rb, line 53 def integer?(unknown) Integer(unknown) rescue ArgumentError, TypeError :nope end
json?(unknown)
click to toggle source
# File lib/saneitized/converter.rb, line 47 def json?(unknown) JSON.parse(unknown) rescue JSON::ParserError, TypeError :nope end
nil?(unknown)
click to toggle source
# File lib/saneitized/converter.rb, line 43 def nil?(unknown) (%w(nil null NULL).include? unknown) ? nil : :nope end
time?(unknown)
click to toggle source
# File lib/saneitized/converter.rb, line 65 def time?(unknown) value = Chronic.parse(unknown) value.nil? ? :nope : value end
true?(unknown)
click to toggle source
# File lib/saneitized/converter.rb, line 35 def true?(unknown) (unknown == 'true') ? true : :nope end