diff options
author | Daniel Schierbeck <daniel.schierbeck@gmail.com> | 2008-09-21 14:56:02 +0200 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-10-19 13:42:52 +0200 |
commit | ab2b1570fdfcb6fa148f30ccd6edcff6428b4d7a (patch) | |
tree | 8e013c9a080e2e87c20137acc1becf285f02fe3e /activesupport/lib/active_support | |
parent | 731c63f8ebc93e703b1a114d86f4f9f694ae48bf (diff) | |
download | rails-ab2b1570fdfcb6fa148f30ccd6edcff6428b4d7a.tar.gz rails-ab2b1570fdfcb6fa148f30ccd6edcff6428b4d7a.tar.bz2 rails-ab2b1570fdfcb6fa148f30ccd6edcff6428b4d7a.zip |
Made the :prefix option on Module#delegate accept a custom prefix.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/core_ext/module/delegation.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/module/delegation.rb b/activesupport/lib/active_support/core_ext/module/delegation.rb index fee4454cb2..bd3afa1961 100644 --- a/activesupport/lib/active_support/core_ext/module/delegation.rb +++ b/activesupport/lib/active_support/core_ext/module/delegation.rb @@ -53,7 +53,7 @@ class Module raise ArgumentError, "Delegation needs a target. Supply an options hash with a :to key as the last argument (e.g. delegate :hello, :to => :greeter)." end - prefix = options[:prefix] ? "#{to}_" : "" + prefix = options[:prefix] && (options[:prefix] == true ? "#{to}_" : "#{options[:prefix]}_") methods.each do |method| module_eval(<<-EOS, "(__DELEGATION__)", 1) |