summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2016-01-12* lib/forwardable.rb: Convert given accessors to String.sorah
r53381 changed to accept only Symbol or String for accessors, but there are several rubygems that pass classes (e.g. Array, Hash, ...) as accessors. Prior r53381, it was accepted because Class#to_s returns its class name. After r53381 given accessors are checked with define_method, but it accepts only Symbol or String, otherwise raises TypeError. def_delegator Foo, :some_method This change is to revert unwanted incompatibility. But this behavior may change in the future. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-10stdlib: avoid extra calls to eliminate "\n" from Base64normal
We may use the '0' (zero) to avoid adding the line feed. Furthermore, the '*' (asterisk) modifier is not needed for a single-element arrays. * ext/psych/lib/psych/visitors/yaml_tree.rb (visit_String): eliminate chomp * lib/net/http.rb (connect): eliminate delete * lib/net/http/header.rb (basic_encode): ditto * lib/net/imap.rb (authenticate): eliminate gsub (self.encode_utf7): shorten delete arg * lib/net/smtp.rb (base64_encode): eliminate gsub * lib/open-uri.rb (OpenURI.open_http): eliminate delete * lib/rss/rss.rb: ditto * lib/securerandom.rb (base64): ditto (urlsafe_base64): eliminate delete! * lib/webrick/httpauth/digestauth.rb (split_param_value): eliminate chop * lib/webrick/httpproxy.rb (do_CONNECT): eliminate delete (setup_upstream_proxy_authentication): ditto [ruby-core:72666] [Feature #11938] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-07Additional fix of r53450naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-07mkmf.rb: fix for ODE makenobu
* lib/mkmf.rb (create_makefile): get rid of placing @ at the beginning of replacement, which is the loop expansion mechanism from the OSF Development Environment (ODE) make. fix failures with bmake by r53448. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-07mkmf.rb: library installation messagesnobu
* lib/mkmf.rb (configuration, dummy_makefile, create_makefile): show library installation messages only when any files need to be updated. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-06optparse.rb: into kwdargnobu
* lib/optparse.rb (OptionParser#order!): add `into` optional keyword argument to store the results. [Feature #11191] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-05leakchecker.rb: remove temporary measurenobu
* lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler#watcher): make watcher thread restartable. * lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler#terminate): new method to terminate watcher thread. * test/lib/leakchecker.rb (LeakChecker#find_threads): revert r46941. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-03Fix defined? expressionsnobu
* lib/rubygems/security.rb (DIGEST_ALGORITHM, KEY_ALGORITHM): should check same name as the used constants. [ruby-core:72674] [Bug #11940] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-02Allow ERB subclass to add token easily. [Feature #11936]seki
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-01* lib/ostruct.rb: Fix case of frozen object with initializer.marcandre
Bug revealed by RubySpec [ruby-core:72639] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-01Adding a liberal_parsing option to CSV. Patch by Braden Anderson.jeg2
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-31ostruct.rb: deferred accessorsnobu
* lib/ostruct.rb (freeze): define deferred accessors before freezing to get rid of an error when just reading frozen OpenStruct. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-31* lib/ostruct.rb: Fix new_ostruct_member to correctly avoid redefinitionmarcandre
[#11901] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-30* lib/net/http/responses.rb: Added new response class for 451 status code.hsbt
* lib/net/http.rb: documentation for HTTPUnavailableForLegalReasons git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-30* lib/webrick/httpstatus.rb: Added HTTP 451 Status Code.hsbt
[fix GH-1167] Patch by @MuhammetDilmac https://tools.ietf.org/html/draft-tbray-http-legally-restricted-status-00 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53386 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-30forwardable.rb: adjust backtrace by tail callnobu
* lib/forwardable.rb (def_instance_delegator): adjust backtrace of method body by tail call optimization. adjusting the delegated target is still done by deleting backtrace. * lib/forwardable.rb (def_single_delegator): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-30Forwardable: Fix delegating to 'args' and 'block'nobu
* lib/forwardable.rb (def_instance_delegator) fix delegating to 'args' and 'block', clashing with local variables in generated methods. [ruby-core:72579] [Bug #11916] * lib/forwardable.rb (def_single_delegator): ditto. If you have a class that uses Forwardable to delegate a method to another object, and the method that returns the delegate object is called `args` or `block`, then Forwardable will fail to work. Here's a simple example: class ModelCreator extend Forwardable attr_reader :args def_delegator :args, :model_name def initialize(args) @args = args end end ModelCreator.new.model_name If you run the last line above, then you'll get: NoMethodError: undefined method `model_name' for []:Array This error occurs because `def_delegator` -- as it is written in Ruby -- uses metaprogramming to add methods to the class that will then delegate to the delegate object. So it's as if we had written: class ModelCreator extend Forwardable attr_reader :args def model_name(*args, &block) args.model_name(*args, &block) end def initialize(args) @args = args end end As you can see, `def_delegator` will not only forward the method call onto the delegate object, it will also forward any arguments provided as well. It is here that the bug arises: it splats all of the arguments into a variable which is called `args`, and because of how variable scope works in Ruby, it then attempts to call `model_name` on *this* variable and *not* our delegate object method. The fix is to call the delegate object method manually using `__send__`. (This assumes, of course, that the given receiver is, in fact, the name of a method and not the name of an instance variable, which is also a possibility.) We use `__send__` because the delegate object method could be private. So, that looks like this: def model_name(*args, &block) __send__(:args).model_name(*args, &block) end Because `def_delegators` and `delegate` use `def_delegator` internally, they also get this fix as well. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-29ostruct.rb: respond_to?nobu
* lib/ostruct.rb (OpenStruct): make respond_to? working on just-allocated objects for workaround of Psych. [ruby-core:72501] [Bug #11884] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-28Resolv::IPv6.create: avoid modifying frozen string literalnormal
* lib/resolv.rb (Resolv::IPv6.create): avoid modifying frozen * test/resolv/test_dns.rb (test_ipv6_create): test for above [Bug #11910] [ruby-core:72559] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-26* lib/xmlrpc/client.rb: Support SSL options in async methods ofkou
XMLRPC::Client. [Bug #11489] Reported by Aleksandar Kostadinov. Thanks!!! git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-23[DOC] Fix typosa_matsuda
* benchmark.rb * getoptlong.rb * irb.rb * net/http.rb * net/http/header.rb * net/imap.rb * optparse.rb * pstore.rb * webrick.rb * xmlrpc.rb [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-22* lib/rdoc.rb: bump version to 4.2.1. It contains following fixes.hsbt
https://github.com/rdoc/rdoc/pull/340 https://github.com/rdoc/rdoc/pull/341 https://github.com/rdoc/rdoc/pull/367 https://github.com/rdoc/rdoc/pull/368 * lib/rdoc/*: ditto. * test/rdoc/*: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-21lib/net/http.rb (open_timeout): update default value in RDoc [ci skip]normal
[ruby-core:72413] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-20cgi/escape: Optimize CGI.escapeHTMLnobu
* cgi/escape/escape.c: Optimize CGI.escapeHTML for ASCII-compatible encodings. [Fix GH-1164] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-20* lib/erb.rb: revert r53123. It break compatibility like thor and rspec-rails.hsbt
We should try with Ruby 2.4 or 3.0. [Bug #11842][ruby-core:72374] * lib/rdoc/erb_partial.rb: ditto. * template/verconf.h.tmpl: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-19webrick/utils.rb: get rid of thread leak checkernobu
* lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler#initialize): use WEBrick::Utils::TimeoutHandler::Thread, which is ignored by LeakChecker#find_threads, instead of ::Thread to get rid of thread leak checker. since this TimeoutHandler is resident during tests because of Singleton, it waits for the next timeout if it has any schedules. in the case of nested timeouts, inner timeout does not cancel outer timeouts and then those schedules still remain. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-19csv.rb: Fix typo [ci skipnobu
* lib/csv.rb (CSV#initialize): [DOC] Fix double-word typo. [Fix GH-1161] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-18timeout.rb: watcher thread namenobu
* lib/timeout.rb (Timeout#timeout): set watcher thread name to caller location for debugging. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-18* lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler): To preventngoto
potential deadlocks, Queue is used to tell update of @timeout_info instead of sleep and wakeup. [Bug #11742] [ruby-dev:49387] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-18csv.rb: tail commasnobu
* lib/csv.rb (CSV::Converters, CSV::DEFAULT_OPTIONS): supply tail commas for further elements. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-18csv.rb: fix typonobu
* lib/csv.rb (CSV#shift): fix typo. [See GH-1160] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-18* lib/irb/ruby-lex.rb: fixed parse error for striped heredocument syntax.hsbt
[fix GH-1127] Patch by @koic git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16remove duplicated frozen_string_literal magic commentnaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16Add frozen_string_literal: false for all filesnaruse
When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-15* lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler): Acquirengoto
TimeoutMutex only when accessing @timeout_info for avoiding potential deadlock. [Bug #11742] [ruby-dev:49387] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-15* lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler#initialize):ngoto
TimeoutMutex should be acquired when accessing @timeout_info. To avoid deadlock, interrupt() calls are delayed. Due to the mutex, it is safe to treat ary without ary.dup. [Bug #11742] [ruby-dev:49387] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-15* lib/erb.rb: Render erb with array buffer for function call optimization.hsbt
[fix GH-1143] * lib/rdoc/erb_partial.rb: ditto. * template/verconf.h.tmpl: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-15* lib/erb.rb: Simplify regexp to optimize erb scanner.hsbt
[fix GH-1144] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-15* lib/uri/common.rb: make code block for rdoc.hsbt
[ci skip][fix GH-1152] Patch by @Tonkpils git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-14* ext/socket/lib/socket.rb: use safe navigation operator.hsbt
[fix GH-1142] Patch by @mlarraz * lib/drb/extservm.rb: ditto. * lib/net/http.rb: ditto. * lib/net/http/response.rb: ditto. * lib/scanf.rb: ditto. * lib/uri/generic.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-14* lib/xmlrpc.rb: added documentation for parser details.hsbt
[ci skip][fix GH-1124] Patch by @jrafanie git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-14* lib/cgi.rb: fix a typo in documentation.hsbt
[ci skip][fix GH-1140] Patch by @jutaz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13* lib/shellwords.rb (Shellwords#shellsplit): Document that thisknu
method does not treat shell metacharacters as such. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53070 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13lib/shellwords.rb: do not change API with frozen-string-literalnormal
This fixes a bug introduced in r53066 when attempting to shellescape an empty string. * lib/shellwords.rb (shellescape): duplicate frozen literal * test/test_shellwords.rb (test_stringification): new test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13* lib/shellwords.rb: Turn on frozen-string-literal after fixingknu
shellsplit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-12* lib/ostruct.rb: Have OpenStruct#dig raise if argument is not a symbolmarcandre
nor a string. See [#11762] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-11* lib/rubygems: Update to RubyGems 2.5.1hsbt
* test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-10disable frozen-string-literalnobu
* lib/mkmf.rb, lib/shellwords.rb: disable frozen-string-literal. [ruby-core:72011] [Bug #11800] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08lib/uri/generic.rb: enable frozen_string_literalnormal
* lib/uri/generic.rb: enable frozen_string_literal (split_userinfo): remove explicit .freeze for string literals (check_path): ditto (query): ditto (fragment): ditto (to_s): ditto [ruby-core:71910] [Bug #11759] Patch-by: Colin Kelley <colindkelley@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08optparse.rb: Fix typo [ci skip]nobu
* lib/optparse.rb: fix double word typo in the document. [Misc #10608] [Fix GH-1126] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e