Class: Steep::AST::Annotation::Typed

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, location: nil) ⇒ Typed

Returns a new instance of Typed.



28
29
30
31
# File 'lib/steep/ast/annotation.rb', line 28

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

Instance Attribute Details

#annotationObject (readonly)

Returns the value of attribute annotation.



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

def annotation
  @annotation
end

#locationObject (readonly)

Returns the value of attribute location.



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

def location
  @location
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object



33
34
35
36
37
# File 'lib/steep/ast/annotation.rb', line 33

def ==(other)
  other.is_a?(self.class) &&
    other.type == type &&
    (!other.location || !location || other.location == location)
end