Sha256: 0c583706693cfd2b7195e8b5da961b83b8c41b44f7ede845f1c4ab7bfef38944

Contents?: true

Size: 711 Bytes

Versions: 12

Compression:

Stored size: 711 Bytes

Contents

# frozen_string_literal: true

module ActiveSupport
  module ClassAttribute # :nodoc:
    class << self
      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
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
activesupport-8.0.0.1 lib/active_support/class_attribute.rb
activesupport-8.0.0 lib/active_support/class_attribute.rb
activesupport-8.0.0.rc2 lib/active_support/class_attribute.rb
activesupport-8.0.0.rc1 lib/active_support/class_attribute.rb
activesupport-8.0.0.beta1 lib/active_support/class_attribute.rb
omg-activesupport-8.0.0.alpha9 lib/active_support/class_attribute.rb
omg-activesupport-8.0.0.alpha8 lib/active_support/class_attribute.rb
omg-activesupport-8.0.0.alpha7 lib/active_support/class_attribute.rb
omg-activesupport-8.0.0.alpha4 lib/active_support/class_attribute.rb
omg-activesupport-8.0.0.alpha3 lib/active_support/class_attribute.rb
omg-activesupport-8.0.0.alpha2 lib/active_support/class_attribute.rb
omg-activesupport-8.0.0.alpha1 lib/active_support/class_attribute.rb