class RBS::AST::Declarations::Global
Attributes
annotations
[R]
Array[Annotation]
comment
[R]
Comment?
location
[R]
loc?
type
[R]
Types::t
Public Class Methods
(name: Symbol, type: Types::t, location: loc?, comment: Comment?, annotations: Array[Annotation]) → void
(name: Symbol, 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 392 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 400 def ==(other) other.is_a?(Global) && 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 408 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 412 def to_json(state = nil) { declaration: :global, name: name, type: type, location: location, comment: comment }.to_json(state) end