123456789_123456789_123456789_123456789_123456789_

Class: RBS::AST::Declarations::TypeAlias

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Base
Instance Chain:
self, Base
Inherits: RBS::AST::Declarations::Base
Defined in: lib/rbs/ast/declarations.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(name:, type_params:, type:, annotations:, location:, comment:) ⇒ TypeAlias

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 312

def initialize(name:, type_params:, type:, annotations:, location:, comment:)
  @name = name
  @type_params = type_params
  @type = type
  @annotations = annotations
  @location = location
  @comment = comment
end

Instance Attribute Details

#annotations (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 308

attr_reader :annotations

#comment (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 310

attr_reader :comment

#location (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 309

attr_reader :location

#name (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 305

attr_reader :name

#type (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 307

attr_reader :type

#type_params (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 306

attr_reader :type_params

Instance Method Details

#==(other) Also known as: #eql?

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 321

def ==(other)
  other.is_a?(TypeAlias) &&
    other.name == name &&
    other.type_params == type_params &&
    other.type == type
end

#eql?(other)

Alias for #==.

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 328

alias eql? ==

#hash

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 330

def hash
  self.class.hash ^ name.hash ^ type_params.hash ^ type.hash
end

#to_json(state = _ = nil)

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 334

def to_json(state = _ = nil)
  {
    declaration: :alias,
    name: name,
    type_params: type_params,
    type: type,
    annotations: annotations,
    location: location,
    comment: comment
  }.to_json(state)
end