[macruby-changes] [MacRuby/MacRuby] ffb2a1: File.open will call the close method which was ove...

noreply at github.com noreply at github.com
Mon May 16 02:33:46 PDT 2011


Branch: refs/heads/master
Home:   https://github.com/MacRuby/MacRuby

Commit: ffb2a1b2438534053f0016f4b9325f6e9a4ac27d
    https://github.com/MacRuby/MacRuby/commit/ffb2a1b2438534053f0016f4b9325f6e9a4ac27d
Author: Watson <watson1978 at gmail.com>
Date:   2011-05-16 (Mon, 16 May 2011)

Changed paths:
  M io.c

Log Message:
-----------
File.open will call the close method which was overridden when given a block.

Test Script:
{{{
require 'test/unit/assertions.rb'
include Test::Unit::Assertions

class File
  alias :close_orig :close
  def close
    warn "*** custom close"
    $close = :closed
  end
end

File.open("/tmp/foo", 'w') { }

assert_equal($close, :closed)

puts :ok
}}}


Commit: 5acb4fc3f49560404097b835eeec42ce82a9f233
    https://github.com/MacRuby/MacRuby/commit/5acb4fc3f49560404097b835eeec42ce82a9f233
Author: Watson <watson1978 at gmail.com>
Date:   2011-05-16 (Mon, 16 May 2011)

Changed paths:
  M io.c

Log Message:
-----------
IO.popen will call the close method which was overridden when given a block.

Test Script:
{{{
require 'test/unit/assertions.rb'
include Test::Unit::Assertions

class IO
  alias :close_orig :close
  def close
    warn "*** custom close"
    $close = :closed
    close_orig
  end
end

IO.popen("ruby -v", "r") {}

assert_equal($close, :closed)

puts :ok
}}}


Commit: d7cf2a9b2d109402e380418d365b1bbd254167b2
    https://github.com/MacRuby/MacRuby/commit/d7cf2a9b2d109402e380418d365b1bbd254167b2
Author: Watson <watson1978 at gmail.com>
Date:   2011-05-16 (Mon, 16 May 2011)

Changed paths:
  M io.c

Log Message:
-----------
IO.pipe will call the close method which was overridden when given a block.

Test Script:
{{{
require 'test/unit/assertions.rb'
include Test::Unit::Assertions

class IO
  alias :close_orig :close
  def close
    warn "*** custom close"
    $close = :closed
    close_orig
  end
end

IO.pipe {}

assert_equal($close, :closed)

puts :ok
}}}


Compare: https://github.com/MacRuby/MacRuby/compare/6af03f5...d7cf2a9


More information about the macruby-changes mailing list