Class: ElementsFactoryDefault

Inherits:
ElementsFactory show all
Defined in:
lib/social_framework/graphs/elements_factory_default.rb

Overview

Implements the methods to create vertices and edges

Instance Method Summary collapse

Instance Method Details

#create_edge(origin, destiny) ⇒ Object

Create a default edge

Params:
origin

Vertex relationship origin

destiny

Vertex relationship destiny

Returns GraphElements::EdgeDefault object



19
20
21
# File 'lib/social_framework/graphs/elements_factory_default.rb', line 19

def create_edge origin, destiny
  return GraphElements::EdgeDefault.new origin, destiny
end

#create_vertex(id, type, attributes = {}) ⇒ Object

Create a default vertex

Params:
id

Integer vertex id

type

Class of vertex

attributes

Hash aditional attributes of vertex

Returns GraphElements::VertexDefault object



10
11
12
# File 'lib/social_framework/graphs/elements_factory_default.rb', line 10

def create_vertex id, type, attributes = {}
  return GraphElements::VertexDefault.new id, type, attributes
end