Module: ActiveSupport::ClassAttribute
- Defined in:
- lib/active_support/class_attribute.rb
Overview
:nodoc:
Class Method Summary collapse
Class Method Details
.redefine(owner, name, value) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/active_support/class_attribute.rb', line 6 def redefine(owner, name, value) if owner.singleton_class? owner.redefine_method(name) { value } owner.send(:public, name) end owner.redefine_singleton_method(name) { value } owner.singleton_class.send(:public, name) owner.redefine_singleton_method("#{name}=") do |new_value| if owner.equal?(self) value = new_value else ::ActiveSupport::ClassAttribute.redefine(self, name, new_value) end end owner.singleton_class.send(:public, "#{name}=") end |