/ Published in: Ruby
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
def Table(*args,&block) table = case args[0] when Array opts = args[1] || {} Ruport::Data::Table.new({:column_names => args[0]}.merge(opts),&block) when /\.csv$/i Ruport::Data::Table.load(*args,&block) when Hash if file = args[0].delete(:file) Ruport::Data::Table.load(file,args[0],&block) elsif string = args[0].delete(:string) Ruport::Data::Table.parse(string,args[0],&block) else Ruport::Data::Table.new(args[0],&block) end else end Ruport::Data::Table.new(:data => [], :column_names => args,&block) return table end