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.0.4"

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_index(klass, method) ⇒ Object



44
45
46
# File 'lib/graphable.rb', line 44

def self.completed_index(klass, method)
  completed_indicies[[klass, method]] = true
end

.completed_indiciesObject



40
41
42
# File 'lib/graphable.rb', line 40

def self.completed_indicies
  @completed_indicies ||= {}
end

.has_indexed?(klass, method) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/graphable.rb', line 48

def self.has_indexed?(klass, method)
  completed_indicies[[klass,method]]
end

.index_cacheObject



36
37
38
# File 'lib/graphable.rb', line 36

def self.index_cache
  @index_cache ||= {}
end

.neoObject



20
21
22
# File 'lib/graphable.rb', line 20

def self.neo
  Neography::Rest.new(ENV["NEO4J_URL"] || "http://localhost:7474")  
end

.register(registrant) ⇒ Object



16
17
18
# File 'lib/graphable.rb', line 16

def self.register(registrant)
  registry << registrant
end

.registryObject



24
25
26
# File 'lib/graphable.rb', line 24

def self.registry
  @registry ||= []
end