Method: JSON::LD::Utils#graph?

Defined in:
lib/json/ld/utils.rb

#graph?(value) ⇒ Boolean

Is value an expaned @graph?

Note: A value is a graph if all of these hold true:

  1. It is an object.

  2. It has an ‘@graph` key.

  3. It may have ‘@context’, ‘@id’ or ‘@index’

Parameters:

  • value (Object)

Returns:

  • (Boolean)


60
61
62
# File 'lib/json/ld/utils.rb', line 60

def graph?(value)
  value.is_a?(Hash) && (value.keys - UTIL_GRAPH_KEYS) == ['@graph']
end