<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,10 +1,15 @@
 require 'stringio'
 
+# a module for suppressing or capturing STDOUT or STDERR.
+# useful when shelling out to &quot;noisy&quot; applications or to suppress
+# output during tests.
 module NoStdout
   module InstanceMethods
 
+    # Suppresses or redirects STDOUT inside the given block.
+    # supply an IO of your own to capture STDOUT, otherwise it's put
+    # in a new StringIO object.
     def no_stdout ( to = StringIO.new('','r+'), &amp;block )
-      # supply an IO of your own to capture STDOUT, otherwise it's put in a StringIO
       orig_stdout  = $stdout
       $stdout      = @alt_stdout = to
       result       = yield
@@ -12,21 +17,39 @@ module NoStdout
       result
     end
 
+    # returns the contents of STDOUT from the previous usage of
+    # no_stdout, or nil
     def last_stdout
       return nil unless @alt_stdout
       @alt_stdout.rewind
       @alt_stdout.read
     end
 
+    ## COPIED FROM ABOVE ####
+
+    # Suppresses or redirects STDERR inside the given block.
+    # supply an IO of your own to capture STDERR, otherwise it's put
+    # in a new StringIO object.
+    def no_stderr ( to = StringIO.new('','r+'), &amp;block )
+      orig_stderr  = $stderr
+      $stderr      = @alt_stderr = to
+      result       = yield
+      $stderr      = orig_stderr
+      result
+    end
+
+    # returns the contents of STDERR from the previous usage of
+    # no_stderr, or nil
+    def last_stderr
+      return nil unless @alt_stderr
+      @alt_stderr.rewind
+      @alt_stderr.read
+    end
   end
 
-  # TODO - explain / remember why this has two class_eval blocks -
-  # should one be an extend?
   def self.included klass
     klass.class_eval do
       include InstanceMethods
     end
-    klass.extend InstanceMethods
   end
-
 end</diff>
      <filename>lib/no_stdout.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f0abe614bec6405f0dda064e4e470a168806f048</id>
    </parent>
  </parents>
  <author>
    <name>davidlee</name>
    <email>david@davelee.com.au</email>
  </author>
  <url>http://github.com/davidlee/state-fu/commit/f06a46a6508396fbe7fd238cc2c5e9093186ab89</url>
  <id>f06a46a6508396fbe7fd238cc2c5e9093186ab89</id>
  <committed-date>2009-06-25T05:39:00-07:00</committed-date>
  <authored-date>2009-06-25T05:39:00-07:00</authored-date>
  <message>commented no_stdout.rb (and added capture/redirect for</message>
  <tree>65d77ec7ebee9b8cc84c2b7f86f8ca903c3dcdd0</tree>
  <committer>
    <name>davidlee</name>
    <email>david@davelee.com.au</email>
  </committer>
</commit>
