1. Kaspar Schiess
  2. par

Commits

Kaspar Schiess  committed 400e07b

Conversion to string

  • Participants
  • Parent commits d6a44f3
  • Branches master

Comments (0)

Files changed (3)

File examples/repetition.rb

View file
 include Par
 
 def greedy
-  result = []
+  result = ''
   loop do
     r = yield
     break if !r || r.bottom?

File lib/par.rb

View file
       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

View file
 
       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' }