Class: RBS::AST::Annotation
- Inherits:
-
Object
- Object
- RBS::AST::Annotation
- Defined in:
- lib/rbs/ast/annotation.rb
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#string ⇒ Object
readonly
Returns the value of attribute string.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(string:, location:) ⇒ Annotation
constructor
A new instance of Annotation.
- #to_json(state = _ = nil) ⇒ Object
Constructor Details
#initialize(string:, location:) ⇒ Annotation
Returns a new instance of Annotation.
9 10 11 12 |
# File 'lib/rbs/ast/annotation.rb', line 9 def initialize(string:, location:) @string = string @location = location end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
7 8 9 |
# File 'lib/rbs/ast/annotation.rb', line 7 def location @location end |
#string ⇒ Object (readonly)
Returns the value of attribute string.
6 7 8 |
# File 'lib/rbs/ast/annotation.rb', line 6 def string @string end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
14 15 16 |
# File 'lib/rbs/ast/annotation.rb', line 14 def ==(other) other.is_a?(Annotation) && other.string == string end |
#hash ⇒ Object
20 21 22 |
# File 'lib/rbs/ast/annotation.rb', line 20 def hash self.class.hash ^ string.hash end |
#to_json(state = _ = nil) ⇒ Object
24 25 26 |
# File 'lib/rbs/ast/annotation.rb', line 24 def to_json(state = _ = nil) { string: string, location: location }.to_json(state) end |