Split String#<< and String#concat docs to reflect single and multiple
arguments
patched by MSP-Greg [fix GH-1614]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Array(arg) does more than just call to_ary or to_a on the argument.
It also falls back to returning [arg] if neither method is available.
This patch extends the description and adds a few examples of how it
handles common types of arguments, including an integer
(which does not implement to_ary or to_a).
Extend Kernel#Array doc to mention TypeError
patched by ragesoss (Sage Ross) [fix GH-1663]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
In the "Metacharacters and Escapes" section of regexp.rdoc, it said that
to match a backslash literally, it must be backslash-escaped, but the
rendered HTML showed three backslashes (\\\). There should only be two
backslashes (\\).
patched by jlmuir (J. Lewis Muir) [fix GH-1677]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_peephole_optimize): eliminate repeated
assignments and copy from/to a same local variable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This patch will add pre-allocation in string interpolation.
By this, unecessary capacity resizing is avoided.
For small strings, optimized `rb_str_resurrect` operation is
faster, so pre-allocation is done only when concatenated strings
are large. `MIN_PRE_ALLOC_SIZE` was decided by experimenting with
local machine (x86_64-apple-darwin 16.5.0, Apple LLVM version
8.1.0 (clang - 802.0.42)).
String interpolation will be faster around 72% when large string is created.
* Before
```
Calculating -------------------------------------
Large string interpolation
1.276M (± 5.9%) i/s - 6.358M in 5.002022s
Small string interpolation
5.156M (± 5.5%) i/s - 25.728M in 5.005731s
```
* After
```
Calculating -------------------------------------
Large string interpolation
2.201M (± 5.8%) i/s - 11.063M in 5.043724s
Small string interpolation
5.192M (± 5.7%) i/s - 25.971M in 5.020516s
```
* Test code
```ruby
require 'benchmark/ips'
Benchmark.ips do |x|
x.report "Large string interpolation" do |t|
a = "Hellooooooooooooooooooooooooooooooooooooooooooooooooooo"
b = "Wooooooooooooooooooooooooooooooooooooooooooooooooooorld"
t.times do
"#{a}, #{b}!"
end
end
x.report "Small string interpolation" do |t|
a = "Hello"
b = "World"
t.times do
"#{a}, #{b}!"
end
end
end
```
[Fix GH-1626]
From: Nao Minami <south37777@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
TCPSocket.gethostbyname has problems similar to
Socket.gethostbyname.
An example of the problem which only the address family of
the first address is returned:
```
pp TCPSocket.gethostbyname("www.wide.ad.jp")
#=> ["www.wide.ad.jp",
[],
10,
"2001:200:dff:fff1:216:3eff:fe4b:651c",
"203.178.137.58"]
```
The address family of the first address, AF_INET6 (10), is
returned but
the address family of the second address, AF_INET, is not
returned.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Merge a commit from upstream:
d1cbf6d75280 test/test_ssl_session: skip tests for session_remove_cb
Tests using SSL::SSLContext#session_remove_cb= are now skipped.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
That prevents infinite recursion when a subclass of Set uses
`collect!` in its constructor.
This should fix [Bug #12437].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This should fix comparison of rbtree backed SortedSet instances.
[Bug #12072]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (defined_expr0): This node_type has
not been used since r11614.
* ext/objspace/objspace.c (count_nodes): ditto
* node.c (dump_node): ditto
* node.h (node_type, NEW_CVDECL): ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (process_options): convert the real path of the script to locale
encoding if its encoding is not locale (maybe UTF-8) on Windows/OS X.
this change makes the encoding of __dir__ to the same encoding of __FILE__
when the script name is passed from commandline.
* test/ruby/test_options.rb (test___dir__encoding): test for this change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
[ruby-core:68098] [Feature #10849] proposed by Andrew Butterfield.
SecureRandom.choose and SecureRandom.graph is not included.
(The implementation has SecureRandom.choose but it is private.)
I feel the method name, SecureRandom.choose, doesn't represent
the behavior well.
The actual use cases of SecureRandom.graph is not obvious.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
for compilation performance.
$ ruby ./benchmark/driver.rb -e "trunk::/Users/k0kubun/.rbenv/versions/trunk/bin/ruby;modified::/Users/k0kubun/.rbenv/versions/modified/bin/ruby" -d ./benchmark -p app_erb
-----------------------------------------------------------
benchmark results:
Execution time (sec)
name trunk modified
app_erb 1.911 1.885
Speedup ratio: compare with the result of `trunk' (greater is better)
name modified
app_erb 1.014
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Remove space on double spaces.
* Capitalization of "Ruby".
* Use macOS instead of OS X.
https://github.com/ruby/ruby/pull/1610
Patch by @bunkrich [fix GH-1610]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (new_op_assign_gen): new_op_assign_gen for
ripper does not need column information.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (new_op_assign): Define the macro separately
for ruby parser and for ripper.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Addrinfo.getaddrinfo is recommended instead of
Socket.gethostbyname.
Addrinfo#getnameinfo is recommended instead of
Socket.gethostbyaddr.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/etc/etc.c (etc_sysconfdir): mentioned special case on
Windows. [ruby-core:43110] [Bug #6121]
* win32/Makefile.sub (config.status): sysconfdir is not used on
Windows.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e