Class: Protobug::Compiler::Builder::File
- Defined in:
- lib/protobug/compiler/builder.rb
Instance Attribute Summary
Attributes inherited from Group
#close, #indent, #items, #multi, #name, #open, #separator
Instance Method Summary collapse
- #header_comment(text) ⇒ Object
-
#initialize ⇒ File
constructor
A new instance of File.
- #render ⇒ Object
Methods inherited from Group
#_class, #_def, #_module, #append, #block, #comment, #compact?, #empty, #empty?, #identifier, #literal, #op
Methods included from Protobug::Compiler::Builder
Constructor Details
Instance Method Details
#header_comment(text) ⇒ Object
178 179 180 |
# File 'lib/protobug/compiler/builder.rb', line 178 def header_comment(text) @headers << text end |
#render ⇒ Object
182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/protobug/compiler/builder.rb', line 182 def render q = PrettierPrint.new(+"") @headers.each_with_index do |header, idx| q.breakable_force if idx.positive? Comment.new(header).render(q) q.breakable_force end super(q) q.trim q.breakable_force q.flush q.output end |