aboutsummaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* csv.rb: optimize CSV::Table#to_a and #to_csvglass2017-08-251-13/+9
| | | | | | | | | | * lib/csv.rb (CSV::Table#to_a, #to_csv): use Array#push instead of Array#concat for performance improvement. This performance improvement is proposed by zdennis <zach.dennis@gmail.com>. The patch is from Mau Magnaguagno <maumagnaguagno@gmail.com>. close #946 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fixed regression to convert blank value at r45497.hsbt2017-08-221-1/+1
| | | | | | [Bug #11126][ruby-core:69088] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Gracefully handle CSV IO when file descriptor closed.hsbt2017-08-221-1/+1
| | | | | | [Bug #10504][ruby-core:66240] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fixed equality method fails when given the object that doesn't support table ↵hsbt2017-08-221-1/+2
| | | | | | | | method. [Bug #12422][ruby-core:75707] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fixed to write_headers option behavior when given no rows.hsbt2017-08-221-2/+7
| | | | | | [Bug #9988][ruby-core:63375] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Escape skip_lines string before convert to Regexp.hsbt2017-08-221-1/+1
| | | | | | | | It ignored all of lines when given Regexp special characters. [Feature #9147][ruby-core:58549] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Extract files variables of ipaddr.gemspec for non git environment.hsbt2017-08-161-3/+1
| | | | | | [Bug #13808][ruby-core:82358] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ftp.rb: fix example format [ci skip]nobu2017-08-151-2/+2
| | | | | | | * lib/uri/ftp.rb: [DOC] fix format of example URLs. patched by aycabta (Code Ahss) at [ruby-core:82379]. [Bug #13814] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix documentation of REXML::Formatters::Default (id_hack -> ie_hack) [ci skip]duerst2017-08-141-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* REXML: Fix a bug that unexpected methods can be called as a XPath functionkou2017-08-131-3/+26
| | | | | | | | | [HackerOne:249295] Reported by Andrea Jegher. Thanks!!! git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use stable sort.ko12017-08-041-1/+2
| | | | | | | | | | | | | | | | * lib/rubygems/resolver.rb (sort_dependencies): use stable sort. TestGemRequestSetLockfile#test_to_s_gem_dependency_non_default fails because this method return unstable results. Note that Enumerable#sort_by is unstable. I'm not sure the "stable" nature is required for RubyGems. The fact is that using stable sort, the test passed on mswin64+VS2017 where the sort results was reverse (unstable) order. Also using `-i` instead of `i` (it means forcing unstable sort) this test fails on other platform where the test successed before. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix `NameError: uninitialized constant Net`kazu2017-08-041-0/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use `register_scanner` instead of `regist_scanner`kazu2017-08-041-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add deprecated warning to ERB::Compiler::SimpleScanner2kazu2017-08-041-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix variable name in example of net/popkazu2017-08-021-1/+1
| | | | | | [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix net/pop code example syntax errorkazu2017-08-021-4/+4
| | | | | | | ref https://github.com/rurema/doctree/pull/455 [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix cgi/core code example missing commakazu2017-08-021-1/+1
| | | | | | | ref https://github.com/rurema/doctree/pull/448 [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ipaddr is now a default gem with an upstream at: https://github.com/ruby/ipaddrknu2017-08-021-0/+28
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rexml: Remove needless documentkou2017-07-281-2/+0
| | | | | | | | | [Fix GH-1671] Patch by madblobfish. Thanks!!! git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* csv.rb: fix incompatibility introduced in r59428glass2017-07-281-60/+46
| | | | | | | | | | | | | * lib/csv.rb: fix incompatibility introduced in r59428. CSV.new takes options as keyword arguments. * test/csv/test_features.rb: add a test to ensure it raises error againt unknown options * test/csv/test_features.rb: add a test to ensure row_sep option is properly applied git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* csv.rb: use keyword parametersglass2017-07-271-90/+71
| | | | | | | | * lib/csv.rb: usb keyword parameters to receive options * test/csv/test_features.rb: remove a test for checking options git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* csv.rb: use Array#to_hglass2017-07-271-2/+1
| | | | | | * lib/csv.rb (CSV::Row#to_hash): use Array#to_h git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/net/imap.rb: support CHANGEDSINCE and MODSEQshugo2017-07-261-8/+45
| | | | | | Patch by plehoux (Philippe-Antoine Lehoux). [ruby-core:64272] [Feature #10119] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* optparse.rb: case-sensitive candidatenobu2017-07-241-4/+4
| | | | | | | | * lib/optparse.rb (candidate): short options are case-sensitive by the default, should not match case-different options.. https://github.com/mernen/completion-ruby/pull/9#issuecomment-317287946 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* optparse.rb: [DOC] fix keysnobu2017-07-211-5/+5
| | | | | | | * lib/optparse.rb (getopts): [DOC] parameter keys are strings, not symbols. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use `unpack1` instead of `unpack` and `[0]`kazu2017-07-201-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* logger.rb: Fix handling prognamesonots2017-07-201-1/+3
| | | | | | | | | | | | | | Because progname was memoized with ||= a logger call that involved outputting false would be nil. Example code: logger = Logger.new(STDOUT) logger.info(false) # => nil Perform an explicit nil check instead of ||= so that false will be output. patched by Gavin Miller <gavingmiller@gmail.com> [Fix GH-1667] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/net/pop.rb: support timeout for TLS handshakeshugo2017-07-191-1/+1
| | | | | | Patch by ahorek (Pavel Rosický). [ruby-core:80490] [Feature #13389] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/net/imap.rb: Ignore trailing space for Microsoft Exchange Servershugo2017-07-191-0/+4
| | | | | | | Based on the patch by keysen (Jérémy Carlier). [ruby-core:81641] [Bug #13649] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* webrick: fix SNI supportnormal2017-07-182-5/+24
| | | | | | | | | | | * lib/webrick/https.rb: check ssl context of virtual host. * lib/webrick/ssl.rb: ensure to return ssl context. * test/webrick/test_https.rb: test returned cert is correct. [Feature #13729][ruby-dev:50173] Author: Tietew <tietew@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Alias Set#to_s to #inspect [ruby-core:81753] [Feature #13676]knu2017-07-141-0/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* optparse.rb: get rid of evalnobu2017-07-121-7/+13
| | | | | | | * lib/optparse.rb: try Float() and Integer() instead of eval, which does too much things. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* webrick: add Server Name Indication (SNI)normal2017-07-072-0/+59
| | | | | | | | | | * lib/webrick/https.rb: servername_cb implementation. * lib/webrick/ssl.rb: abstract servername_cb. * test/webrick/test_https.rb: test. [ruby-dev:50165] [Feature #13729] Author: Tietew <tietew@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix DecimalInteger converting to octal bugnobu2017-07-061-1/+1
| | | | | | | | | | | Previously if the input started with a '0' then it will be converted as octal even though it has been specified as a decimal. This commit forces the number to be interpreted as a decimal. [ruby-core:81927] [Bug #13722] [Fix GH-1665] Author: william <william.mccumstie@outlook.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* un.rb: use OpenSSL::PKey.read instead of OpenSSL::PKey::RSA.newrhe2017-07-051-3/+4
| | | | | | | Also, error out if --ssl-private-key option is not given, since specifying only the certificate makes no sense. [Feature #13714] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* un.rb: support httpsnobu2017-07-051-1/+12
| | | | | | | | * lib/un.rb: add https support. based on the patch by Flavio Castelli <flavio@castelli.name> in [ruby-core:81901]. [Feature #13714] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Delegate to `eql?` [Fix GH-1564]nobu2017-06-241-1/+9
| | | | | | | | * lib/delegate.rb (eql?): Delegate to `eql?` of the inner object. based on the patch by giginet <giginet.net@gmail.com>. [ruby-core:76950] [Bug #12684] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix exception type in option type checkerglass2017-06-221-1/+1
| | | | | | | | | | | | * lib/shell/system-command.rb (SystemCommand#initialize): `def_e2message` wraps error message, but does not define new exception * test/shell/test_command_processor.rb: add a test This patch is authored by Kenichi Kamiya <kachick1@gmail.com> close #1657 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Make string literal to frozen object on gemspec of defulte gems.hsbt2017-06-195-0/+5
| | | | | | | | | | | | Added following gemspecs. * extensions: date, dbm, etc, fiddle, gdbm, sdbm, stringio, strscan, zlib * pure ruby libraries: cmath, csv, fileutils, scanf, webrick psych and rdoc is out of scope of this commit. I will merge after upstream was change to `frozen_string_literal: true`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Don't pollute toplevel by an IRB internal methoda_matsuda2017-06-152-3/+5
| | | | | | | | | | | | | There actually are some libraries that requires 'irb' such as byebug, and when 'irb' is required, it requires irb/src_encoding.rb, then it defines the toplevel default_src_encoding method that is visible from anywhere in the end users' apps. Here's a quick oneliner that shows what's happening. % ruby -rpry-byebug -e 'p private_methods(false)' [:include, :using, :define_method, :public, :private, :DelegateClass, :default_src_encoding] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix typo.a_matsuda2017-06-091-1/+1
| | | | | | | | | | Patch by: Sarah Duve Signed-off-by: Akira Matsuda <ronnie@dio.jp> [Fix GH-1643] [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rexml: add close tag check on end of document to StreamParserkou2017-06-071-0/+8
| | | | | | | | | [ruby-core:81593] [Bug #13636] Reported by Anton Sivakov. Thanks!!! git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* suppress warning: ambiguous first argument; put parentheses or a space even ↵naruse2017-05-281-1/+1
| | | | | | | | | after `-' operator Introduced at r58905 http://rubyci.s3.amazonaws.com/ubuntu/ruby-trunk/log/20170526T153003Z.diff.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* erb.rb: Use str_uplus instead of rb_str_dupk0kubun2017-05-271-3/+3
| | | | | | | | | | | | | | | to skip unnecessary string allocation on frozen_string_literal: false. str_uplus can bypass calling rb_str_dup when OBJ_FROZEN is true. * Before erb_render 1.064 * Afete erb_render 0.909 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* erb.rb: Tiny improvement of compiling costk0kubun2017-05-261-1/+1
| | | | | | | | | | | | | | by reducing string allocation. * Before app_erb 0.687 * After app_erb 0.679 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* erb.rb: [DOC] Follow compiled code's changek0kubun2017-05-261-1/+1
| | | | | | introduced in r58905. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* erb.rb: Generate static string with opt_str_uminusk0kubun2017-05-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to skip object allocation for static string. We can't always enable frozen_string_literal pragma because we can't freeze string literals embedded by user for backward compatibility. So we need to use fstring for each static string. Since adding ".freeze" to string literals in #content_dump is slow on compiling, I used unary "-" operator instead. benchmark/bm_app_erb_render.rb: Added rendering-only benchmark to test rendering performance on production environment. This benchmark is created to reproduce the behavior on Sinatra (Tilt). Thus it doesn't use ERB#result to skip parsing compiled code. It doesn't use ERB#def_method too to regard `title` and `content` as local variables. If we use #def_method, `title` and `content` needs to be method call. I wanted to avoid it. This patch's benchmark results is: * Before app_erb_render 1.250 app_erb 0.704 * After app_erb_render 1.066 app_erb 0.686 This patch optimizes rendering performance (app_erb_render) without spoiling (total of rendering +) compiling performance (app_erb). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* erb.rb: Use script encoding instead of force_encodingk0kubun2017-05-261-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original intention of introducing `_erbout.force_encoding` in r21170 was: - "returns a string in the same character encoding as the input string." - "When the input string has a magic comment, however, it returns a string in the encoding specified by the magic comment." And they are tested by test/erb/test_erb_m17n.rb well and this patch passes the test. Since magic comment is always added in ERB compiled code, using ''.dup instead of String.new will set correct encoding without calling force_encoding method. The benchmark results are: * Before $ ./ruby benchmark/run.rb --matzruby=./ruby -m bm_app_erb MatzRuby: ruby 2.5.0dev (2017-05-26 skip-force-enc.. 58903) [x86_64-linux] last_commit=Skip force_encoding in compiled code of erb Ruby: app_erb: matz 0.715 * After $ ./ruby benchmark/run.rb --matzruby=./ruby -m bm_app_erb MatzRuby: ruby 2.5.0dev (2017-05-26 skip-force-enc.. 58903) [x86_64-linux] last_commit=Skip force_encoding in compiled code of erb Ruby: app_erb: matz 0.672 And perf(1) results are: * Before $ sudo perf stat ./ruby benchmark/bm_app_erb.rb Performance counter stats for './ruby benchmark/bm_app_erb.rb': 709.571746 task-clock (msec) # 1.000 CPUs utilized 5 context-switches # 0.007 K/sec 1 cpu-migrations # 0.001 K/sec 1,337 page-faults # 0.002 M/sec 3,088,936,521 cycles # 4.353 GHz <not supported> stalled-cycles-frontend <not supported> stalled-cycles-backend 4,849,564,282 instructions # 1.57 insns per cycle 1,027,042,087 branches # 1447.411 M/sec 19,983,456 branch-misses # 1.95% of all branches 0.709747823 seconds time elapsed * After $ sudo perf stat ./ruby benchmark/bm_app_erb.rb Performance counter stats for './ruby benchmark/bm_app_erb.rb': 693.494673 task-clock (msec) # 1.000 CPUs utilized 7 context-switches # 0.010 K/sec 1 cpu-migrations # 0.001 K/sec 1,316 page-faults # 0.002 M/sec 3,025,639,349 cycles # 4.363 GHz <not supported> stalled-cycles-frontend <not supported> stalled-cycles-backend 4,694,848,271 instructions # 1.55 insns per cycle 994,496,704 branches # 1434.037 M/sec 19,693,239 branch-misses # 1.98% of all branches 0.693724345 seconds time elapsed [fix GH-1147] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/uri/common.rb: [DOC] add rdoc to describesonots2017-05-261-0/+6
| | | | | | URI.unescape is obsolete [ci-skip] [fix GH-1630] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* erb.rb: Add ERB#result_with_hashk0kubun2017-05-251-0/+10
| | | | | | [ruby-core:55985] [Feature #8631] [fix GH-1623] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e