Return to Snippet

Revision: 31407
at September 4, 2010 05:26 by rkumar


Updated Code
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

Revision: 31406
at September 4, 2010 05:26 by rkumar


Initial Code
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

Initial URL

                                

Initial Description

                                

Initial Title
friendly class design

Initial Tags
ruby

Initial Language
Ruby