lib/gnuplotrb/staff/datablock.rb
##
# Update existing Datablock with new data.
# Destructive version of #update.
#
# @param data [#to_gnuplot_points] anything with #to_gnuplot_points method
# @return [Datablock] self
#
# @example
#   data = [[0, 1, 2, 3], [0, 1, 4, 9]] # y = x**2
#   db = Datablock.new(data, false)
#   update = [[4, 5], [16, 25]]
#   db.update!(update)
#   # now db contains points with x from 0 up to 5
Update existing Datablock with new data.
Destructive version of #update.
Update existing Datablock with new data . Destructive version of #update .
def update!(data)
      data_str = data.to_gnuplot_points
      if @stored_in_file
        File.open(@file_name, 'a') { |f| f.puts "\n#{data_str}" }
      else
        @data = "#{@data}\n#{data_str}"
      end
      self
    end
def update! ( data ) data_str = data . to_gnuplot_points if @stored_in_file File . open ( @file_name , 'a' ) { | f | f . puts "\n#{data_str}" } else @data = "#{@data}\n#{data_str}" end self end
Update existing Datablock with new data.
Update existing Datablock with new data .
None
Datablock
data
anything with #to_gnuplot_points method
anything with #to_gnuplot_points method
example
None