Module: Graphable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/graphable.rb,
lib/graphable/version.rb,
lib/graphable/edge_creator.rb,
lib/graphable/node_creator.rb,
lib/graphable/index_creator.rb
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Classes: EdgeCreator, IndexCreator, NodeCreator, ThroughEdgeCreator, ViaEdgeCreator
Constant Summary
collapse
- VERSION =
"0.1.0"
Class Method Summary
collapse
Class Method Details
.build! ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/graphable.rb', line 28
def self.build!
puts "Building Graph..."
registry.select { |f| f.is_a? NodeCreator }.map(&:call)
registry.select { |f| f.is_a? IndexCreator }.map(&:call)
registry.select { |f| f.is_a? EdgeCreator }.map(&:call)
nil
end
|
.completed_edge(source, target, name) ⇒ Object
68
69
70
|
# File 'lib/graphable.rb', line 68
def self.completed_edge(source, target, name)
completed_edges[[source,target,name]] = true
end
|
.completed_edges ⇒ Object
64
65
66
|
# File 'lib/graphable.rb', line 64
def self.completed_edges
@completed_edges ||= {}
end
|
.completed_index(klass, method) ⇒ Object
56
57
58
|
# File 'lib/graphable.rb', line 56
def self.completed_index(klass, method)
completed_indicies[[klass, method]] = true
end
|
.completed_indicies ⇒ Object
40
41
42
|
# File 'lib/graphable.rb', line 40
def self.completed_indicies
@completed_indicies ||= {}
end
|
.has_completed_edge?(source, target, name) ⇒ Boolean
72
73
74
|
# File 'lib/graphable.rb', line 72
def self.has_completed_edge?(source, target, name)
completed_edges[[source,target,name]]
end
|
.has_indexed?(klass, method) ⇒ Boolean
60
61
62
|
# File 'lib/graphable.rb', line 60
def self.has_indexed?(klass, method)
completed_indicies[[klass,method]]
end
|
.index_cache ⇒ Object
36
37
38
|
# File 'lib/graphable.rb', line 36
def self.index_cache
@index_cache ||= {}
end
|
.neo ⇒ Object
20
21
22
|
# File 'lib/graphable.rb', line 20
def self.neo
Neography::Rest.new(ENV["NEO4J_URL"] || "http://localhost:7474")
end
|
.object_access_methods ⇒ Object
44
45
46
|
# File 'lib/graphable.rb', line 44
def self.object_access_methods
@object_access_methods ||= {}
end
|
.objects_of(klass) ⇒ Object
48
49
50
|
# File 'lib/graphable.rb', line 48
def self.objects_of(klass)
klass.send(object_access_methods[klass] || 'all')
end
|
.register(registrant) ⇒ Object
16
17
18
|
# File 'lib/graphable.rb', line 16
def self.register(registrant)
registry << registrant
end
|
.register_object_access_method(klass, method) ⇒ Object
52
53
54
|
# File 'lib/graphable.rb', line 52
def self.register_object_access_method(klass, method)
object_access_methods[klass] = method
end
|
.registry ⇒ Object
24
25
26
|
# File 'lib/graphable.rb', line 24
def self.registry
@registry ||= []
end
|