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 356

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 352

attr_reader :annotations

#comment (readonly)

[ GitHub ]

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

attr_reader :comment

#instance?Boolean (readonly)

[ GitHub ]

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

def instance?
  kind == :instance
end

#kind (readonly)

[ GitHub ]

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

attr_reader :kind

#location (readonly)

[ GitHub ]

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

attr_reader :location

#new_name (readonly)

[ GitHub ]

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

attr_reader :new_name

#old_name (readonly)

[ GitHub ]

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

attr_reader :old_name

#singleton?Boolean (readonly)

[ GitHub ]

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

def singleton?
  kind == :singleton
end

Instance Method Details

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

[ GitHub ]

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

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 372

alias eql? ==

#hash

[ GitHub ]

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

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

#to_json(state = _ = nil)

[ GitHub ]

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

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