Class: RBS::AST::Declarations::AliasDecl

Inherits:
Base
  • Object
show all
Defined in:
lib/rbs/ast/declarations.rb

Direct Known Subclasses

ClassAlias, ModuleAlias

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(new_name:, old_name:, location:, comment:) ⇒ AliasDecl

Returns a new instance of AliasDecl.



422
423
424
425
426
427
# File 'lib/rbs/ast/declarations.rb', line 422

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

Instance Attribute Details

#commentObject (readonly)

Returns the value of attribute comment.



420
421
422
# File 'lib/rbs/ast/declarations.rb', line 420

def comment
  @comment
end

#locationObject (readonly)

Returns the value of attribute location.



420
421
422
# File 'lib/rbs/ast/declarations.rb', line 420

def location
  @location
end

#new_nameObject (readonly)

Returns the value of attribute new_name.



420
421
422
# File 'lib/rbs/ast/declarations.rb', line 420

def new_name
  @new_name
end

#old_nameObject (readonly)

Returns the value of attribute old_name.



420
421
422
# File 'lib/rbs/ast/declarations.rb', line 420

def old_name
  @old_name
end

Instance Method Details

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



429
430
431
432
433
# File 'lib/rbs/ast/declarations.rb', line 429

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

#hashObject



437
438
439
# File 'lib/rbs/ast/declarations.rb', line 437

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