diff options
author | Jake Bell <jake@theunraveler.com> | 2015-08-19 14:55:47 -0500 |
---|---|---|
committer | Jake Bell <jake@theunraveler.com> | 2015-08-19 16:04:53 -0500 |
commit | 47ab9a04d3317d7d42c7b2e5709b8e861422ebc3 (patch) | |
tree | 1e315306f7d88f529a7d9d32691f19027631320b /activesupport/lib | |
parent | f454ad37ed46e14eb535eb3305d2c3183a5d52f7 (diff) | |
download | rails-47ab9a04d3317d7d42c7b2e5709b8e861422ebc3.tar.gz rails-47ab9a04d3317d7d42c7b2e5709b8e861422ebc3.tar.bz2 rails-47ab9a04d3317d7d42c7b2e5709b8e861422ebc3.zip |
Fixing issue when delegating to methods named "block", "args", or "arg"
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/module/delegation.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/activesupport/lib/active_support/core_ext/module/delegation.rb b/activesupport/lib/active_support/core_ext/module/delegation.rb index 9dc0dee1bd..0d46248582 100644 --- a/activesupport/lib/active_support/core_ext/module/delegation.rb +++ b/activesupport/lib/active_support/core_ext/module/delegation.rb @@ -5,10 +5,11 @@ class Module # option is not used. class DelegationError < NoMethodError; end - RUBY_RESERVED_WORDS = Set.new( - %w(alias and BEGIN begin break case class def defined? do else elsif END - end ensure false for if in module next nil not or redo rescue retry - return self super then true undef unless until when while yield) + DELEGATION_RESERVED_METHOD_NAMES = Set.new( + %w(_ arg args alias and BEGIN begin block break case class def defined? do + else elsif END end ensure false for if in module next nil not or redo + rescue retry return self super then true undef unless until when while + yield) ).freeze # Provides a +delegate+ class method to easily expose contained objects' @@ -171,7 +172,7 @@ class Module line = line.to_i to = to.to_s - to = "self.#{to}" if RUBY_RESERVED_WORDS.include?(to) + to = "self.#{to}" if DELEGATION_RESERVED_METHOD_NAMES.include?(to) methods.each do |method| # Attribute writer methods only accept one argument. Makes sure []= |