test/gruff_test_case.rb
# Generate graphs at several sizes.
#
# Also writes the graph to disk.
#
#   graph_sized 'bar_basic' do |g|
#     g.data('students', [1, 2, 3, 4])
#   end
#
Generate graphs at several sizes.
Also writes the graph to disk.


Generate graphs at several sizes . Also writes the graph to disk .
def graph_sized(filename, sizes = ['', 400])
    class_name = self.class.name.gsub(/^TestGruff/, '')
    Array(sizes).each do |size|
      g = instance_eval("Gruff::#{class_name}.new #{size}", __FILE__, __LINE__)
      g.title = "#{class_name} Graph"
      yield g
      write_test_file g, "#{filename}_#{size}.png"
    end
  end
def graph_sized ( filename , sizes = [ '' , 400 ] ) class_name = self . class . name . gsub ( / ^TestGruff / , '' ) Array ( sizes ) . each do | size | g = instance_eval ( "Gruff::#{class_name}.new #{size}" , __FILE__ , __LINE__ ) g . title = "#{class_name} Graph" yield g write_test_file g , "#{filename}_#{size}.png" end end
Generate graphs at several sizes.
Generate graphs at several sizes .
filename
<not_specific>
sizes
<not_specific>