Class: Steep::AST::Annotation::Named

Inherits:
Object
  • Object
show all
Includes:
Located
Defined in:
lib/steep/ast/annotation.rb

Direct Known Subclasses

ConstType, IvarType, MethodType, VarType

Instance Attribute Summary collapse

Attributes included from Located

#location

Instance Method Summary collapse

Methods included from Located

#line

Constructor Details

#initialize(name:, type:, location: nil) ⇒ Named

Returns a new instance of Named.



18
19
20
21
22
# File 'lib/steep/ast/annotation.rb', line 18

def initialize(name:, type:, location: nil)
  @name = name
  @type = type
  @location = location
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



15
16
17
# File 'lib/steep/ast/annotation.rb', line 15

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



16
17
18
# File 'lib/steep/ast/annotation.rb', line 16

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object



24
25
26
27
28
# File 'lib/steep/ast/annotation.rb', line 24

def ==(other)
  other.is_a?(self.class) &&
    other.name == name &&
    other.type == type
end