module Lurker::Json::Parser::Expertise

Public Instance Methods

type_defined?(hash) click to toggle source
# File lib/lurker/json/parser/expertise.rb, line 13
def type_defined?(hash)
  return false unless hash.is_a?(Hash)

  hash.key?(Json::TYPE) && Json::PRIMITIVES.include?(hash[Json::TYPE])
end
type_polymorph?(array_or_hash) click to toggle source
# File lib/lurker/json/parser/expertise.rb, line 7
def type_polymorph?(array_or_hash)
  return false unless array_or_hash.is_a?(Hash) || array_or_hash.is_a?(Array)

  array_or_hash.empty?
end
type_supposed?(hash) click to toggle source
# File lib/lurker/json/parser/expertise.rb, line 19
def type_supposed?(hash)
  return false unless hash.is_a?(Hash)

  hash.key?(Json::ANYOF) || hash.key?(Json::ALLOF) || hash.key?(Json::ONEOF) ||
  hash.key?(Json::ITEMS) || hash.key?(Json::PROPERTIES) ||
  hash.key?(Json::REF)
end