class JsDuck::Util::Stdout
Central place for buffering JSON data that's meant to be written to STDOUT
Public Class Methods
new()
click to toggle source
# File lib/jsduck/util/stdout.rb, line 11 def initialize @data = nil end
Public Instance Methods
add(data)
click to toggle source
Adds array of new data
# File lib/jsduck/util/stdout.rb, line 16 def add(data) if @data @data += data else @data = data end end
flush()
click to toggle source
Writes data to STDOUT in JSON format, but only if some data was added.
# File lib/jsduck/util/stdout.rb, line 26 def flush puts Util::Json.generate(@data) if @data end