Class: SyntaxTree::Comment::List

Inherits:
Object
  • Object
show all
Defined in:
lib/syntax_tree.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(comments) ⇒ List

Returns a new instance of List.



4036
4037
4038
# File 'lib/syntax_tree.rb', line 4036

def initialize(comments)
  @comments = comments
end

Instance Attribute Details

#commentsObject (readonly)

Array[ Comment ]

the list of comments this list represents



4034
4035
4036
# File 'lib/syntax_tree.rb', line 4034

def comments
  @comments
end

Instance Method Details

#pretty_print(q) ⇒ Object



4040
4041
4042
4043
4044
4045
# File 'lib/syntax_tree.rb', line 4040

def pretty_print(q)
  return if comments.empty?

  q.breakable
  q.group(2, "(", ")") { q.seplist(comments) { |comment| q.pp(comment) } }
end