Class: Wizport::Report
- Inherits:
-
Object
- Object
- Wizport::Report
- Defined in:
- lib/wizport/engine/report.rb
Instance Attribute Summary collapse
-
#columns ⇒ Object
Returns the value of attribute columns.
-
#sections ⇒ Object
Returns the value of attribute sections.
-
#source ⇒ Object
Returns the value of attribute source.
-
#subtitle ⇒ Object
Returns the value of attribute subtitle.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #add_column(column) ⇒ Object
- #build(format = :pdf) ⇒ Object
- #column(options) ⇒ Object
-
#initialize(options = {}) ⇒ Report
constructor
A new instance of Report.
- #save(file) ⇒ Object
- #section(options) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Report
Returns a new instance of Report.
10 11 12 13 14 15 16 17 |
# File 'lib/wizport/engine/report.rb', line 10 def initialize( = {}) @title = .delete(:title) || "" @subtitle = .delete(:subtitle) || "" @columns = .delete(:columns) || [] @sections = .delete(:sections) || [] @source = Wizport::MongoidSource.new(.delete(:source)) end |
Instance Attribute Details
#columns ⇒ Object
Returns the value of attribute columns.
8 9 10 |
# File 'lib/wizport/engine/report.rb', line 8 def columns @columns end |
#sections ⇒ Object
Returns the value of attribute sections.
8 9 10 |
# File 'lib/wizport/engine/report.rb', line 8 def sections @sections end |
#source ⇒ Object
Returns the value of attribute source.
8 9 10 |
# File 'lib/wizport/engine/report.rb', line 8 def source @source end |
#subtitle ⇒ Object
Returns the value of attribute subtitle.
8 9 10 |
# File 'lib/wizport/engine/report.rb', line 8 def subtitle @subtitle end |
#title ⇒ Object
Returns the value of attribute title.
8 9 10 |
# File 'lib/wizport/engine/report.rb', line 8 def title @title end |
Instance Method Details
#add_column(column) ⇒ Object
28 29 30 |
# File 'lib/wizport/engine/report.rb', line 28 def add_column(column) @columns << column end |
#build(format = :pdf) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/wizport/engine/report.rb', line 32 def build(format = :pdf) builder = Wizport::Builder::Pdf.new(self) builder.header if sections.size > 0 sections.each do |section| builder.section(section) end else builder.grid end builder. builder end |
#column(options) ⇒ Object
19 20 21 |
# File 'lib/wizport/engine/report.rb', line 19 def column() @columns << Wizport::Column.new() end |
#save(file) ⇒ Object
46 47 48 |
# File 'lib/wizport/engine/report.rb', line 46 def save(file) build(:pdf).save(file) end |