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/html.rb,
lib/ruport/formatter/text.rb,
lib/ruport/controller/table.rb,
lib/ruport/formatter/markdown.rb,
lib/ruport/controller/grouping.rb,
lib/ruport/formatter/prawn_pdf.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 collapse
- VERSION =
"1.8.0"
Class Method Summary collapse
-
.quiet ⇒ Object
quiets warnings for block.
-
.Table(*args, &block) ⇒ Object
Shortcut interface for creating Data::Tables.
Class Method Details
.quiet ⇒ Object
quiets warnings for block
86 87 88 89 90 91 92 |
# File 'lib/ruport.rb', line 86 def quiet #:nodoc: warns = $VERBOSE $VERBOSE = nil result = yield $VERBOSE = warns return result end |
.Table(*args, &block) ⇒ Object
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)
1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 |
# File 'lib/ruport/data/table.rb', line 1043 def self.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 |