method

redefine

rails latest stable - Class: ActiveSupport::ClassAttribute

Method not available on this version

This method is only available on newer versions. The first available version (v8.0.0) is shown here.

redefine(owner, name, value)
public

No documentation available.

# File activesupport/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