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 371

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 367

attr_reader :annotations

#comment (readonly)

[ GitHub ]

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

attr_reader :comment

#instance?Boolean (readonly)

[ GitHub ]

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

def instance?
  kind == :instance
end

#kind (readonly)

[ GitHub ]

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

attr_reader :kind

#location (readonly)

[ GitHub ]

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

attr_reader :location

#new_name (readonly)

[ GitHub ]

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

attr_reader :new_name

#old_name (readonly)

[ GitHub ]

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

attr_reader :old_name

#singleton?Boolean (readonly)

[ GitHub ]

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

def singleton?
  kind == :singleton
end

Instance Method Details

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

[ GitHub ]

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

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 387

alias eql? ==

#hash

[ GitHub ]

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

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

#to_json(state = _ = nil)

[ GitHub ]

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

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