lib/parlour/rbi_generator/constant.rb in parlour-3.0.0 vs lib/parlour/rbi_generator/constant.rb in parlour-4.0.0

- old
+ new

@@ -6,34 +6,43 @@ sig do params( generator: RbiGenerator, name: String, value: String, + eigen_constant: T::Boolean, block: T.nilable(T.proc.params(x: Constant).void) ).void end # Creates a new constant definition. # # @param name [String] The name of the constant. # @param value [String] The value of the constant, as a Ruby code string. - def initialize(generator, name: '', value: '', &block) + # @param eigen_constant [Boolean] Whether this constant is defined on the + # eigenclass of the current namespace. + def initialize(generator, name: '', value: '', eigen_constant: false, &block) super(generator, name) @value = value + @eigen_constant = eigen_constant yield_self(&block) if block end # @return [String] The value of the constant, as a Ruby code string. sig { returns(String) } attr_reader :value + # @return [Boolean] Whether this constant is defined on the eigenclass + # of the current namespace. + attr_reader :eigen_constant + sig { params(other: Object).returns(T::Boolean) } # Returns true if this instance is equal to another extend. # # @param other [Object] The other instance. If this is not a {Extend} (or a # subclass of it), this will always return false. # @return [Boolean] def ==(other) - Constant === other && name == other.name && value == other.value + Constant === other && name == other.name && value == other.value \ + && eigen_constant == other.eigen_constant end sig do override.params( indent_level: Integer,