Browse files

Added support for using Dataflow class/module methods

  • Loading branch information...
1 parent 2eede19 commit 6d38ed803354a61cbe593de07833700edf330ef1 Larry Diehl committed Aug 29, 2009
Showing with 22 additions and 10 deletions.
  1. +2 −0 dataflow.rb
  2. +20 −10 spec/dataflow_spec.rb
View
2 dataflow.rb
@@ -42,6 +42,8 @@ def need_later(&block)
end
end
+ extend self
+
# Note that this class uses instance variables directly rather than nicely
# initialized instance variables in get/set methods for memory and
# performance reasons
View
30 spec/dataflow_spec.rb
@@ -125,17 +125,27 @@ class Store
end.should raise_error(Dataflow::UnificationError)
end
end
+end
- describe 'Binding a variable that proxies through another' do
- it 'binds through successfully' do
- local do |x, y|
- lambda do
- unify x, y
- unify x, 1337
- x.should == 1337
- y.should == 1337
- end.should_not raise_error
- end
+describe 'Binding a variable that proxies through another' do
+ it 'binds through successfully' do
+ local do |x, y|
+ lambda do
+ unify x, y
+ unify x, 1337
+ x.should == 1337
+ y.should == 1337
+ end.should_not raise_error
+ end
+ end
+end
+
+describe 'Using static/module method' do
+ it 'works like the mixin versions' do
+ Dataflow.local do |big_cat, small_cat|
+ Thread.new { Dataflow.unify big_cat, small_cat.upcase }
+ Dataflow.unify small_cat, 'cat'
+ big_cat.should == 'CAT'
end
end
end

0 comments on commit 6d38ed8

Please sign in to comment.