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(*a) ⇒ Object
Constructor Details
#initialize(string:, location:) ⇒ Annotation
Returns a new instance of Annotation.
7 8 9 10 |
# File 'lib/rbs/ast/annotation.rb', line 7 def initialize(string:, location:) @string = string @location = location end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
5 6 7 |
# File 'lib/rbs/ast/annotation.rb', line 5 def location @location end |
#string ⇒ Object (readonly)
Returns the value of attribute string.
4 5 6 |
# File 'lib/rbs/ast/annotation.rb', line 4 def string @string end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
12 13 14 |
# File 'lib/rbs/ast/annotation.rb', line 12 def ==(other) other.is_a?(Annotation) && other.string == string end |
#hash ⇒ Object
18 19 20 |
# File 'lib/rbs/ast/annotation.rb', line 18 def hash self.class.hash ^ string.hash end |
#to_json(*a) ⇒ Object
22 23 24 |
# File 'lib/rbs/ast/annotation.rb', line 22 def to_json(*a) { string: string, location: location }.to_json(*a) end |