Class: Graphable::NodeCreator
- Inherits:
-
Object
- Object
- Graphable::NodeCreator
- Extended by:
- Forwardable
- Defined in:
- lib/graphable/node_creator.rb
Instance Attribute Summary collapse
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(klass) ⇒ NodeCreator
constructor
A new instance of NodeCreator.
Constructor Details
#initialize(klass) ⇒ NodeCreator
Returns a new instance of NodeCreator.
10 11 12 |
# File 'lib/graphable/node_creator.rb', line 10 def initialize(klass) @klass = klass end |
Instance Attribute Details
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
7 8 9 |
# File 'lib/graphable/node_creator.rb', line 7 def klass @klass end |
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/graphable/node_creator.rb', line 14 def call puts "Building nodes for #{name}" Graphable.objects_of(@klass).each_slice(250) do |slice| nodes = Graphable.neo.batch(*slice.map do |obj| [:create_node, obj.to_node] end) slice.zip(nodes).each do |object, node| Graphable.index_cache[object] = node["body"] end end end |