class WCC::Contentful::IndexedRepresentation
The result of running the indexer on raw content types to produce a type definition which can be used to build models or graphql types.
Public Class Methods
from_json(hash)
click to toggle source
# File lib/wcc/contentful/indexed_representation.rb, line 22 def self.from_json(hash) hash = JSON.parse(hash) if hash.is_a?(String) ret = IndexedRepresentation.new hash.each do |id, content_type_hash| ret[id] = ContentType.new(content_type_hash) end ret end
new(types = {})
click to toggle source
# File lib/wcc/contentful/indexed_representation.rb, line 7 def initialize(types = {}) @types = types end
Public Instance Methods
==(other)
click to toggle source
# File lib/wcc/contentful/indexed_representation.rb, line 40 def ==(other) my_keys = keys return false unless my_keys == other.keys my_keys.all? { |k| self[k] == other[k] } end
[]=(id, value)
click to toggle source
# File lib/wcc/contentful/indexed_representation.rb, line 16 def []=(id, value) raise ArgumentError unless value.is_a?(ContentType) @types[id] = value end
deep_dup()
click to toggle source
# File lib/wcc/contentful/indexed_representation.rb, line 36 def deep_dup self.class.new(@types.deep_dup) end
to_json(*args)
click to toggle source
# File lib/wcc/contentful/indexed_representation.rb, line 32 def to_json(*args) @types.to_json(*args) end