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