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, #print_blank_line_before, #replace, #string
Constructor Details
#initialize(text, loc: nil) ⇒ Comment
Returns a new instance of Comment.
60 61 62 63 |
# File 'lib/rbi/model.rb', line 60 def initialize(text, loc: nil) super(loc: loc) @text = text end |
Instance Attribute Details
#text ⇒ Object
Returns the value of attribute text.
57 58 59 |
# File 'lib/rbi/model.rb', line 57 def text @text end |
Instance Method Details
#==(other) ⇒ Object
66 67 68 69 70 |
# File 'lib/rbi/model.rb', line 66 def ==(other) return false unless other.is_a?(Comment) text == other.text end |
#accept_printer(v) ⇒ Object
197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
# File 'lib/rbi/printer.rb', line 197 def accept_printer(v) lines = text.lines if lines.empty? v.printl("#") end lines.each do |line| text = line.rstrip v.printt("#") v.print(" #{text}") unless text.empty? v.printn end end |