Class: RBI::Comment
- Extended by:
- T::Sig
- Defined in:
- lib/rbi/model.rb,
lib/rbi/printer.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#text ⇒ Object
Returns the value of attribute text.
Attributes inherited from Node
Instance Method Summary collapse
- #==(other) ⇒ Object
- #accept_printer(v) ⇒ Object
-
#initialize(text, loc: nil) ⇒ Comment
constructor
A new instance of Comment.
Methods inherited from Node
#compatible_with?, #detach, #group_kind, #merge_with, #oneline?, #parent_conflict_tree, #parent_scope, #print, #replace, #string
Constructor Details
#initialize(text, loc: nil) ⇒ Comment
Returns a new instance of Comment.
57 58 59 60 |
# File 'lib/rbi/model.rb', line 57 def initialize(text, loc: nil) super(loc: loc) @text = text end |
Instance Attribute Details
#text ⇒ Object
Returns the value of attribute text.
54 55 56 |
# File 'lib/rbi/model.rb', line 54 def text @text end |
Instance Method Details
#==(other) ⇒ Object
63 64 65 66 |
# File 'lib/rbi/model.rb', line 63 def ==(other) return false unless other.is_a?(Comment) text == other.text end |
#accept_printer(v) ⇒ Object
158 159 160 161 162 163 |
# File 'lib/rbi/printer.rb', line 158 def accept_printer(v) text = self.text.strip v.printt("#") v.print(" #{text}") unless text.empty? v.printn end |