mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
multiple arguments to write
Make write methods of IO-like objects accept multiple arguments, as well as IO#write. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8bbdbf9e75
commit
30d23ec903
7 changed files with 10 additions and 9 deletions
|
@ -339,7 +339,8 @@ module OpenSSL::Buffering
|
|||
# Writes _s_ to the stream. If the argument is not a String it will be
|
||||
# converted using +.to_s+ method. Returns the number of bytes written.
|
||||
|
||||
def write(s)
|
||||
def write(*s)
|
||||
s = s.size == 1 ? s[0] : s.join("")
|
||||
do_write(s)
|
||||
s.bytesize
|
||||
end
|
||||
|
|
|
@ -160,7 +160,7 @@ module EnvUtil
|
|||
|
||||
def verbose_warning
|
||||
class << (stderr = "".dup)
|
||||
alias write <<
|
||||
alias write concat
|
||||
end
|
||||
stderr, $stderr, verbose, $VERBOSE = $stderr, stderr, $VERBOSE, true
|
||||
yield stderr
|
||||
|
|
|
@ -75,7 +75,7 @@ class TestLogDevice < Test::Unit::TestCase
|
|||
#
|
||||
logdev = d(LogExcnRaiser.new)
|
||||
class << (stderr = '')
|
||||
alias write <<
|
||||
alias write concat
|
||||
end
|
||||
$stderr, stderr = stderr, $stderr
|
||||
begin
|
||||
|
|
|
@ -49,11 +49,11 @@ module TestMkmf::Base
|
|||
def filter(&block)
|
||||
@filter = block
|
||||
end
|
||||
def write(s)
|
||||
def write(*s)
|
||||
if @out
|
||||
@buffer << s
|
||||
@buffer.concat(*s)
|
||||
elsif @origin
|
||||
@origin << s
|
||||
@origin.write(*s)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@ class TestOptionParser::AutoConf < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
class DummyOutput < String
|
||||
alias write <<
|
||||
alias write concat
|
||||
end
|
||||
def no_error(*args)
|
||||
$stderr, stderr = DummyOutput.new, $stderr
|
||||
|
|
|
@ -14,7 +14,7 @@ class TestOptionParser::KwArg < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
class DummyOutput < String
|
||||
alias write <<
|
||||
alias write concat
|
||||
end
|
||||
def assert_no_error(*args)
|
||||
$stderr, stderr = DummyOutput.new, $stderr
|
||||
|
|
|
@ -9,7 +9,7 @@ class TestOptionParser < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
class DummyOutput < String
|
||||
alias write <<
|
||||
alias write concat
|
||||
end
|
||||
def assert_no_error(*args)
|
||||
$stderr, stderr = DummyOutput.new, $stderr
|
||||
|
|
Loading…
Add table
Reference in a new issue