Skip to content
Browse files

Allow elements to change their payload or add one to an element that …

…was yielded without one
  • Loading branch information...
1 parent 417765c commit d7addcad1d805090bea1aae4a4263c0d2600fcef @pangloss committed Oct 1, 2012
Showing with 16 additions and 0 deletions.
  1. +8 −0 lib/pacer/wrappers/edge_wrapper.rb
  2. +8 −0 lib/pacer/wrappers/vertex_wrapper.rb
View
8 lib/pacer/wrappers/edge_wrapper.rb
@@ -200,5 +200,13 @@ def ==(other)
def hash
-element.hash
end
+
+ def element_payload=(data)
+ if element.is_a? Pacer::Payload::Edge
+ element.payload = data
+ else
+ @element = Pacer::Payload::Edge.new element, data
+ end
+ end
end
end
View
8 lib/pacer/wrappers/vertex_wrapper.rb
@@ -193,6 +193,14 @@ def hash
element.hash
end
+ def element_payload=(data)
+ if element.is_a? Pacer::Payload::Vertex
+ element.payload = data
+ else
+ @element = Pacer::Payload::Vertex.new element, data
+ end
+ end
+
protected
def get_edges_helper(direction, *labels_and_extensions)

0 comments on commit d7addca

Please sign in to comment.
Something went wrong with that request. Please try again.