Class: MyJSON

Inherits:
Object
  • Object
show all
Defined in:
lib/imperituroard.rb

Class Method Summary collapse

Class Method Details

.valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


61
62
63
64
65
66
67
# File 'lib/imperituroard.rb', line 61

def self.valid?(value)
  result = JSON.parse(value)

  result.is_a?(Hash) || result.is_a?(Array)
rescue JSON::ParserError, TypeError
  false
end