| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
https://github.com/ruby/forwardable/commit/301687dbfa
|
|
|
|
|
|
| |
Ractor-compliance
https://github.com/ruby/forwardable/commit/c91f41f4fa
|
| |
|
|
|
|
|
| |
They are followed up with
https://github.com/ruby/ruby/commit/8fb02b7a97317090e3946e6f2d4a7d034f9699f1
|
|
|
|
|
|
|
|
|
| |
conflict"
This reverts commit 4dba0c1a8e3cc08664872e637099c4e7d58d24d3.
Matz's comment is "send is not deprecated. __send__ is safer".
But "Prefer #send over #__send__" is not reasonable.
|
|
|
|
|
|
|
| |
* Reverts part of 3198e7abd70bd2af977f2bb6c967e9df8f91adb0.
* If the rule is #send should be deprecated, that should be ruled by matz,
there is no such rule currently and gems seem to prefer #send
overwhelmingly.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
"requiring version.rb" strategy has some issues.
- cannot work when cross-compiling
- often introduces wrong namespace
- must know the superclasses
- costs at each runtime than at build-time
etc.
|
|
|
|
|
|
|
|
|
|
| |
#10)
This restores compatibility with previous versions. This behavior
was previously undefined, but it makes sense for the name of the
defined method to be returned.
https://github.com/ruby/forwardable/commit/a52ef3451e
|
|
|
|
|
|
| |
Do so in a way that is also compatible with previous versions.
https://github.com/ruby/forwardable/commit/b2dd340988
|
|
|
|
| |
https://github.com/ruby/forwardable/commit/1a994c90e1
|
|
|
|
|
|
|
|
|
|
|
| |
:__id__
Previously, __send__ and __id__ were skipped if provided as strings,
but not skipped if provided as symbols.
Fixes Ruby Bug 8855.
https://github.com/ruby/forwardable/commit/2e61c8c66c
|
|
|
|
| |
https://github.com/ruby/forwardable/commit/387758d45a
|
|
|
|
| |
Fixes [Bug #13142]
|
|
|
|
|
|
|
|
| |
[ruby-core:71281] [Misc #11639]
From: Sam Morgan <s_morgan@me.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
| |
* lib/forwardable.rb: Added Forwardable::VERSION and re-use it.
* lib/forwardable/forwardable.gemspec: Added initial gemspec.
* tool/sync_default_gems.rb: Support forwaradable repository.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If uplevel keyword is given, the warning message is prepended
with caller file and line information and the string "warning: ".
The use of the uplevel keyword makes Kernel#warn format output
similar to how rb_warn formats output.
This patch modifies net/ftp and net/imap to use Kernel#warn
instead of $stderr.puts or $stderr.printf, since they are used
for printing warnings.
This makes lib/cgi/core and tempfile use $stderr.puts instead of
warn for debug logging, since they are used for debug printing
and not for warning.
This does not modify bundler, rubygems, or rdoc, as those are
maintained outside of ruby and probably wish to remain backwards
compatible with older ruby versions.
rb_warn_m code is originally from nobu, but I've changed it
so that it only includes the path and lineno from uplevel
(not the method), and also prepends the string "warning: ",
to make it more similar to rb_warn.
From: Jeremy Evans code@jeremyevans.net
Signed-off-by: Urabe Shyouhei shyouhei@ruby-lang.org
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
* lib/forwardable.rb (instance_delegate, single_delegate): fix
inverted branches.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
| |
* lib/forwardable.rb (_delegator_method): use defined? operator
instead of binding and calling unbound Kernel#respond_to?. a
remedy for an performance bottleneck.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
| |
* lib/forwardable.rb (_delegator_method): use defined? operator
instead of binding and calling unbound Kernel#respond_to?. a
remedy for an performance bottleneck.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
| |
* lib/forwardable/impl.rb (_valid_method?, _compile_method):
extract to separate implementation specific part.
[ruby-core:78138] [Bug #12938]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
* lib/forwardable.rb (_delegator_method): allow private methods to
be delegated, with warnings. [ruby-core:77341] [Bug #12782]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
causes test failures introduced at r55376.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
* lib/forwardable.rb (_delegator_method): remove __send__ call if
possible, so that more optimizations will be enabled.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
| |
* lib/forwardable.rb (_delegator_method): leave the backtrace
untouched during accessor. forwardable.rb does not appear in
the backtrace during delegated method because of tail-call
optimization.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
| |
* lib/forwardable.rb (Forwardable._delegator_method): extract
method generator and deal with non-module objects.
[ruby-dev:49656] [Bug #12478]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
* lib/forwardable.rb (def_instance_delegator, def_single_delegator):
match backtraces against ::Forwardable in case the target class
is a subclass of BasicObject and does not include Kernel.
[ruby-core:71176] [Bug #11616]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
| |
rescue ::Exception instead of Exception in case Exception is
defined under the target class.
[ruby-core:71175] [Ruby trunk - Bug #11615]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
Based on patch by @joem [Fixes GH-303] [Bug #8392]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
| |
* lib/forwardable.rb (Forwardable::FILE_REGEXP): create regexp object
outside sources for eval, to reduce allocations in def_delegators
wrappers. //o option does not make each regexps shared. patch by
tmm1 (Aman Gupta) in [ruby-core:53620] [Bug #8143].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
Patch by Vladimir Andrijevik [Github Fixes #230]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
Patch by Vladimir Andrijevik [Github Fixes #231]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
* lib/forwardable.rb: Merge documentation from doc/forwardable.rd
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
[Ruby 1.9 - Bug #4752]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
| |
http://redmine.ruby-lang.org/projects/ruby/wiki/DeveloperHowto#coding-style
Patch by Steve Klabnik [Ruby 1.9 - Bug #4730]
Patch by Jason Dew [Ruby 1.9 - Feature #4718]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
| |
by specification of RDOC.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|