Skip to content
Permalink
Browse files

NodeMixin#initialize yield self to block [#82 state:resolved]

  • Loading branch information...
jho406 authored and andreas committed Oct 6, 2009
1 parent 85f78b7 commit c4a2fea6987205bc30951910bc61bb676db61b1f
Showing with 11 additions and 0 deletions.
  1. +1 −0 lib/neo4j/mixins/node_mixin.rb
  2. +10 −0 test/neo4j/node_mixin_spec.rb
@@ -35,6 +35,7 @@ def initialize(*args)
init_without_node
init_node(*args) if self.respond_to?(:init_node)
end
yield self if block_given?
# must call super with no arguments so that chaining of the initialize method works
super()
end
@@ -77,6 +77,16 @@ class TestNode4
node2 = TestNode4.new(node1.internal_node)
node1.internal_node.should == node2.internal_node
end

it "should accept a block and pass self as parameter" do
class TestNode5
include Neo4j::NodeMixin
property :foo
end

node1 = TestNode5.new {|n| n.foo = 'hi'}
node1.foo.should == 'hi'
end
end


0 comments on commit c4a2fea

Please sign in to comment.
You can’t perform that action at this time.