123456789_123456789_123456789_123456789_123456789_

Class: RBS::AST::Members::Alias

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

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(new_name:, old_name:, kind:, annotations:, location:, comment:) ⇒ Alias

[ GitHub ]

  
# File 'lib/rbs/ast/members.rb', line 405

def initialize(new_name:, old_name:, kind:, annotations:, location:, comment:)
  @new_name = new_name
  @old_name = old_name
  @kind = kind
  @annotations = annotations
  @location = location
  @comment = comment
end

Instance Attribute Details

#annotations (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/members.rb', line 401

attr_reader :annotations

#comment (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/members.rb', line 403

attr_reader :comment

#instance?Boolean (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/members.rb', line 439

def instance?
  kind == :instance
end

#kind (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/members.rb', line 400

attr_reader :kind

#location (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/members.rb', line 402

attr_reader :location

#new_name (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/members.rb', line 398

attr_reader :new_name

#old_name (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/members.rb', line 399

attr_reader :old_name

#singleton?Boolean (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/members.rb', line 443

def singleton?
  kind == :singleton
end

Instance Method Details

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

[ GitHub ]

  
# File 'lib/rbs/ast/members.rb', line 414

def ==(other)
  other.is_a?(self.class) &&
    other.new_name == new_name &&
    other.old_name == old_name &&
    other.kind == kind
end

#eql?(other)

Alias for #==.

[ GitHub ]

  
# File 'lib/rbs/ast/members.rb', line 421

alias eql? ==

#hash

[ GitHub ]

  
# File 'lib/rbs/ast/members.rb', line 423

def hash
  new_name.hash ^ old_name.hash ^ kind.hash
end

#to_json(state = _ = nil)

[ GitHub ]

  
# File 'lib/rbs/ast/members.rb', line 427

def to_json(state = _ = nil)
  {
    member: :alias,
    new_name: new_name,
    old_name: old_name,
    kind: kind,
    annotations: annotations,
    location: location,
    comment: comment
  }.to_json(state)
end