Method: GChart::Base#write

Defined in:
lib/gchart/base.rb

#write(io_or_file = "chart.png") ⇒ Object

Writes the chart’s generated PNG to a file. If io_or_file quacks like an IO, calls write on it instead.



88
89
90
91
# File 'lib/gchart/base.rb', line 88

def write(io_or_file="chart.png")
  return io_or_file.write(fetch) if io_or_file.respond_to?(:write)
  open(io_or_file, "w+") { |io| io.write(fetch) }
end