Sha256: e8ed6757e27606a3936fd85b5c833a7d4d500c522c05f9a9a29ff455cd97c4cc

Contents?: true

Size: 746 Bytes

Versions: 9

Compression:

Stored size: 746 Bytes

Contents

module Lurker
  module Json
    class Parser
      module Expertise
        module_function

        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

        def type_defined?(hash)
          return false unless hash.is_a?(Hash)

          hash.key?(Json::TYPE) && Json::PRIMITIVES.include?(hash[Json::TYPE])
        end

        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
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
lurker-1.0.0 lib/lurker/json/parser/expertise.rb
lurker-0.6.12 lib/lurker/json/parser/expertise.rb
lurker-0.6.11 lib/lurker/json/parser/expertise.rb
lurker-0.6.10 lib/lurker/json/parser/expertise.rb
lurker-0.6.9 lib/lurker/json/parser/expertise.rb
lurker-0.6.8 lib/lurker/json/parser/expertise.rb
lurker-0.6.7 lib/lurker/json/parser/expertise.rb
lurker-0.6.6 lib/lurker/json/parser/expertise.rb
lurker-0.6.5 lib/lurker/json/parser/expertise.rb