class Ashikawa::Core::VertexCollection

A vertex collection as it is returned from a graph

@note This is basically just a regular collection with some additional attributes and methods to ease

working with collections in the graph module.

Attributes

graph[R]

The Graph instance this VertexCollection was originally fetched from

@return [Graph] The Graph instance the collection was fetched from @api public

Public Class Methods

new(database, raw_collection, graph) click to toggle source

Create a new VertexCollection object

@param [Database] database The database the connection belongs to @param [Hash] raw_collection The raw collection returned from the server @param [Graph] graph The graph from which this collection was fetched @raise [CollectionNotInGraphException] If the collection has not beed added to the graph yet @note You should not create instance manually but rather use Graph#add_vertex_collection @api public

Calls superclass method Ashikawa::Core::Collection::new
# File lib/ashikawa-core/vertex_collection.rb, line 26
def initialize(database, raw_collection, graph)
  super(database, raw_collection)
  @graph = graph

  raise CollectionNotInGraphException unless @graph.has_vertex_collection?(name)
end

Public Instance Methods

build_content_class(data, additional_atttributes = {}) click to toggle source

Builds a new document object and passes the current graph to it

@param [Hash] data The raw data to be used to instatiate the class @param [Hash] additional_atttributes Initial attributes to be passed to the document @return [Edge] The instatiated edge @api private

# File lib/ashikawa-core/vertex_collection.rb, line 39
def build_content_class(data, additional_atttributes = {})
  Document.new(@database, data, additional_atttributes.merge(graph: graph))
end