Class: PrettyPrint::Buffer::DefaultBuffer

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

Overview

This is the default output buffer that provides a base implementation of trim! that does nothing. It’s effectively a wrapper around whatever output object was given to the format command.

Direct Known Subclasses

ArrayBuffer, StringBuffer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output = []) ⇒ DefaultBuffer

Returns a new instance of DefaultBuffer.



277
278
279
# File 'lib/syntax_tree/prettyprint.rb', line 277

def initialize(output = [])
  @output = output
end

Instance Attribute Details

#outputObject (readonly)

Returns the value of attribute output.



275
276
277
# File 'lib/syntax_tree/prettyprint.rb', line 275

def output
  @output
end

Instance Method Details

#<<(object) ⇒ Object



281
282
283
# File 'lib/syntax_tree/prettyprint.rb', line 281

def <<(object)
  @output << object
end

#trim!Object



285
286
287
# File 'lib/syntax_tree/prettyprint.rb', line 285

def trim!
  0
end