diff options
Diffstat (limited to 'activesupport/lib')
4 files changed, 6 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb b/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb index 79247e00cb..eee61d48c4 100644 --- a/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb +++ b/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb @@ -21,7 +21,7 @@ class Class # :nodoc: end def cattr_writer(*syms) - options = syms.last.is_a?(Hash) ? syms.pop : {} + options = syms.extract_options! syms.flatten.each do |sym| class_eval(<<-EOS, __FILE__, __LINE__) unless defined? @@#{sym} diff --git a/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb b/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb index 2dd0c577d1..371d074d34 100644 --- a/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb +++ b/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb @@ -23,7 +23,7 @@ class Class # :nodoc: end def class_inheritable_writer(*syms) - options = syms.last.is_a?(Hash) ? syms.pop : {} + options = syms.extract_options! syms.each do |sym| class_eval <<-EOS def self.#{sym}=(obj) @@ -40,7 +40,7 @@ class Class # :nodoc: end def class_inheritable_array_writer(*syms) - options = syms.last.is_a?(Hash) ? syms.pop : {} + options = syms.extract_options! syms.each do |sym| class_eval <<-EOS def self.#{sym}=(obj) @@ -57,7 +57,7 @@ class Class # :nodoc: end def class_inheritable_hash_writer(*syms) - options = syms.last.is_a?(Hash) ? syms.pop : {} + options = syms.extract_options! syms.each do |sym| class_eval <<-EOS def self.#{sym}=(obj) diff --git a/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb b/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb index 8127150a96..58ff363244 100644 --- a/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb +++ b/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb @@ -21,7 +21,7 @@ class Module # :nodoc: end def mattr_writer(*syms) - options = syms.last.is_a?(Hash) ? syms.pop : {} + options = syms.extract_options! syms.each do |sym| class_eval(<<-EOS, __FILE__, __LINE__) unless defined? @@#{sym} diff --git a/activesupport/lib/active_support/deprecation.rb b/activesupport/lib/active_support/deprecation.rb index 8499ad6e2d..2baa667c03 100644 --- a/activesupport/lib/active_support/deprecation.rb +++ b/activesupport/lib/active_support/deprecation.rb @@ -85,7 +85,7 @@ module ActiveSupport module ClassMethods #:nodoc: # Declare that a method has been deprecated. def deprecate(*method_names) - options = method_names.last.is_a?(Hash) ? method_names.pop : {} + options = method_names.extract_options! method_names = method_names + options.keys method_names.each do |method_name| alias_method_chain(method_name, :deprecation) do |target, punctuation| |