Class: FeaturesReport::Generator
- Inherits:
-
Object
- Object
- FeaturesReport::Generator
- Defined in:
- lib/features_report/generator.rb
Defined Under Namespace
Classes: Feature
Constant Summary collapse
- FEATURE_TITLE_STYLE =
{:size => 24}
- SCENARIO_TITLE_STYLE =
{:size => 16}
- STEP_STYLE =
{}
- FOOTER_STYLE =
{:size => 12}
- DOC_TITLE_STYLE =
{:size => 32, :align => :center}
Instance Attribute Summary collapse
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
-
#pdf ⇒ Object
readonly
Returns the value of attribute pdf.
-
#reader ⇒ Object
readonly
Returns the value of attribute reader.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(reader, git, opts) ⇒ Generator
constructor
A new instance of Generator.
Constructor Details
#initialize(reader, git, opts) ⇒ Generator
Returns a new instance of Generator.
4 5 6 7 8 9 10 |
# File 'lib/features_report/generator.rb', line 4 def initialize(reader, git, opts) @reader = reader @opts = opts @git = git @feature_pages ||= {} @features = reader.features.map{|f| Feature.new(f, @git)} end |
Instance Attribute Details
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
12 13 14 |
# File 'lib/features_report/generator.rb', line 12 def opts @opts end |
#pdf ⇒ Object (readonly)
Returns the value of attribute pdf.
12 13 14 |
# File 'lib/features_report/generator.rb', line 12 def pdf @pdf end |
#reader ⇒ Object (readonly)
Returns the value of attribute reader.
12 13 14 |
# File 'lib/features_report/generator.rb', line 12 def reader @reader end |
Instance Method Details
#generate ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/features_report/generator.rb', line 14 def generate @pdf = Prawn::Document.new :page_size => "A4", :top_margin => 60 pdf.header [pdf.bounds.right, pdf.bounds.bottom + 10] do pdf.text pdf.page_count-1 unless pdf.page_count == 1 end @original_bottom_left = [pdf.bounds.left, pdf.bounds.bottom - 10] generate_front_page sorted_features.each do |feature| generate_feature(feature) end generate_contents_page pdf.render_file("features.pdf") end |