Commits

Kaspar Schiess committed 400e07b

Conversion to string

  • Participants
  • Parent commits d6a44f3

Comments (0)

Files changed (3)

File examples/repetition.rb

 include Par
 
 def greedy
-  result = []
+  result = ''
   loop do
     r = yield
     break if !r || r.bottom?
       new(obj1 + obj2)
     end
 
+    def to_str
+      obj.to_str
+    end
     def to_s
       obj.to_s
     end
+
     def <=> other
       return obj <=> other.to_str if other.respond_to? :to_str
     end

File spec/lib/par/result_spec.rb

 
       c.obj.should == 'rs'
     end
+    it 'converts to a string (by delegating to obj)' do 
+      ('a' + r).should == 'ar'
+    end
   end
   context 'given 2 results' do
     let(:a) { result 'foo' }