Module: Ruport
- Defined in:
- lib/ruport.rb,
lib/ruport/version.rb,
lib/ruport/formatter.rb,
lib/ruport/data/table.rb,
lib/ruport/formatter/csv.rb,
lib/ruport/formatter/pdf.rb,
lib/ruport/formatter/html.rb,
lib/ruport/formatter/text.rb,
lib/ruport/controller/table.rb,
lib/ruport/formatter/prawn_pdf.rb,
lib/ruport/controller/grouping.rb
Overview
Ruport : Extensible Reporting System
controller/grouping.rb : Group data controller for Ruby Reports
Written by Michael Milner, 2007. Copyright (C) 2007, All Rights Reserved
This is free software distributed under the same terms as Ruby 1.8 See LICENSE and COPYING for details.
Defined Under Namespace
Modules: Data, SystemExtensions Classes: Controller, Formatter, FormatterError
Constant Summary
- VERSION =
"1.7.0"
Instance Method Summary (collapse)
-
- (Object) quiet
quiets warnings for block.
-
- (Object) Table(*args, &block)
Shortcut interface for creating Data::Tables.
Instance Method Details
- (Object) quiet
quiets warnings for block
101 102 103 104 105 106 107 |
# File 'lib/ruport.rb', line 101 def quiet #:nodoc: warns = $VERBOSE $VERBOSE = nil result = yield $VERBOSE = warns return result end |
- (Object) Table(*args, &block)
Shortcut interface for creating Data::Tables
Examples:
t = Table(%w[a b c]) #=> creates a new empty table w. cols a,b,c
t = Table("a","b","c") #=> creates a new empty table w. cols a,b,c
# allows building table inside of block, returns table object
t = Table(%w[a b c]) { |t| t << [1,2,3] }
# allows loading table from CSV
# accepts all Data::Table.load options, including block (yields table,row)
t = Table("foo.csv")
t = Table("bar.csv", :has_names => false)
1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 |
# File 'lib/ruport/data/table.rb', line 1038 def Table(*args,&block) case(args[0]) when Array opts = args[1] || {} Ruport::Data::Table.new(f={:column_names => args[0]}.merge(opts),&block) when /\.csv/ 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 Ruport::Data::Table.new(:data => [], :column_names => args,&block) end end |