-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f914b83
commit 2192897
Showing
2 changed files
with
59 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,65 @@ | ||
require 'tempfile' | ||
|
||
module Report | ||
class Report | ||
def initialize | ||
@report_data = Array.new | ||
@image = nil | ||
@header = nil | ||
class Report | ||
def initialize | ||
@report_data = Array.new | ||
@image = nil | ||
@header = nil | ||
|
||
yield self | ||
end | ||
yield self | ||
end | ||
|
||
def header | ||
header = Header.new | ||
yield header | ||
@header = header | ||
end | ||
def header | ||
header = Header.new | ||
yield header | ||
@header = header | ||
end | ||
|
||
def add_title | ||
title = Title.new | ||
yield title | ||
add_to_report(title) | ||
end | ||
def add_title | ||
title = Title.new | ||
yield title | ||
add_to_report(title) | ||
end | ||
|
||
def add_subtitle | ||
subtitle = Subtitle.new | ||
yield subtitle | ||
add_to_report(subtitle) | ||
end | ||
def add_subtitle | ||
subtitle = Subtitle.new | ||
yield subtitle | ||
add_to_report(subtitle) | ||
end | ||
|
||
def add_paragraph | ||
paragraph = Paragraph.new | ||
yield paragraph | ||
add_to_report(paragraph) | ||
end | ||
def add_paragraph | ||
paragraph = Paragraph.new | ||
yield paragraph | ||
add_to_report(paragraph) | ||
end | ||
|
||
def line_break | ||
nl = TextBlock.new | ||
add_to_report(nl) | ||
end | ||
def line_break | ||
nl = TextBlock.new | ||
add_to_report(nl) | ||
end | ||
|
||
def add_table(dimension_x, dimension_y) | ||
table = Table.new(dimension_x, dimension_y) | ||
yield table | ||
add_to_report(table) | ||
end | ||
def add_table(dimension_x, dimension_y) | ||
table = Table.new(dimension_x, dimension_y) | ||
yield table | ||
add_to_report(table) | ||
end | ||
|
||
def add_image | ||
if block_given? | ||
image = Image.new | ||
yield image | ||
add_to_report(image) | ||
end | ||
end | ||
def add_image | ||
if block_given? | ||
image = Image.new | ||
yield image | ||
add_to_report(image) | ||
end | ||
end | ||
|
||
def generate_report | ||
raise 'Error: Function not implemented' | ||
end | ||
def generate_report | ||
raise 'Error: Function not implemented' | ||
end | ||
|
||
private | ||
def add_to_report (data) | ||
@report_data.push(data) | ||
end | ||
end | ||
private | ||
def add_to_report (data) | ||
@report_data.push(data) | ||
end | ||
end | ||
end |