Class: PrettierPrint::Indent

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

Overview

A node in the print tree that is a variant of the Align node that indents its contents by one level.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(contents: []) ⇒ Indent

Returns a new instance of Indent.



203
204
205
# File 'lib/prettier_print.rb', line 203

def initialize(contents: [])
  @contents = contents
end

Instance Attribute Details

#contentsObject (readonly)

Returns the value of attribute contents.



201
202
203
# File 'lib/prettier_print.rb', line 201

def contents
  @contents
end

Instance Method Details

#pretty_print(q) ⇒ Object



207
208
209
210
211
# File 'lib/prettier_print.rb', line 207

def pretty_print(q)
  q.group(2, "indent([", "])") do
    q.seplist(contents) { |content| q.pp(content) }
  end
end