class RBS::AST::Declarations::Constant
Attributes
annotations
[R]
Array[Annotation]
comment
[R]
Comment?
location
[R]
loc?
type
[R]
Types::t
Public Class Methods
(name: TypeName, type: Types::t, location: loc?, comment: Comment?, annotations: Array[Annotation]) → void
(name: TypeName, type: Types::t, location: loc?, comment: Comment?) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/ast/declarations.rb, line 354 def initialize(name:, type:, location:, comment:, annotations: []) @name = name @type = type @location = location @comment = comment @annotations = annotations || [] end
Public Instance Methods
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/ast/declarations.rb, line 362 def ==(other) other.is_a?(Constant) && other.name == name && other.type == type end
Also aliased as: eql?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/ast/declarations.rb, line 370 def hash self.class.hash ^ name.hash ^ type.hash end
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/ast/declarations.rb, line 374 def to_json(state = nil) { declaration: :constant, name: name, type: type, location: location, comment: comment }.to_json(state) end