Class: Ashikawa::Core::VertexCollection
- Inherits:
-
Collection
- Object
- Collection
- Ashikawa::Core::VertexCollection
- Defined in:
- lib/ashikawa-core/vertex_collection.rb
Overview
This is basically just a regular collection with some additional attributes and methods to ease working with collections in the graph module.
A vertex collection as it is returned from a graph
Constant Summary
Constants inherited from Collection
Collection::CONTENT_CLASS, Collection::CONTENT_TYPES
Instance Attribute Summary collapse
-
#graph ⇒ Graph
readonly
The Graph instance this VertexCollection was originally fetched from.
Attributes inherited from Collection
#content_type, #database, #id, #name, #status
Instance Method Summary collapse
-
#build_content_class(data, additional_atttributes = {}) ⇒ Edge
private
Builds a new document object and passes the current graph to it.
-
#initialize(database, raw_collection, graph) ⇒ VertexCollection
constructor
Create a new VertexCollection object.
Methods inherited from Collection
#[], #add_index, #create_document, #create_edge, #delete, #fetch, #figure, #index, #indices, #key_options, #length, #load, #query, #replace, #truncate, #unload, #volatile?, #wait_for_sync=, #wait_for_sync?
Constructor Details
#initialize(database, raw_collection, graph) ⇒ VertexCollection
You should not create instance manually but rather use Graph#add_vertex_collection
Create a new VertexCollection object
27 28 29 30 31 32 |
# File 'lib/ashikawa-core/vertex_collection.rb', line 27 def initialize(database, raw_collection, graph) super(database, raw_collection) @graph = graph raise CollectionNotInGraphException unless @graph.has_vertex_collection?(name) end |
Instance Attribute Details
#graph ⇒ Graph (readonly)
The Graph instance this VertexCollection was originally fetched from
17 18 19 |
# File 'lib/ashikawa-core/vertex_collection.rb', line 17 def graph @graph end |
Instance Method Details
#build_content_class(data, additional_atttributes = {}) ⇒ Edge
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Builds a new document object and passes the current graph to it
40 41 42 |
# File 'lib/ashikawa-core/vertex_collection.rb', line 40 def build_content_class(data, additional_atttributes = {}) Document.new(@database, data, additional_atttributes.merge(graph: graph)) end |