Sha256: 58799ded46bcc4b9205a10c33d081bb130f1c7151703e3b3175b6dd2881415db

Contents?: true

Size: 979 Bytes

Versions: 3

Compression:

Stored size: 979 Bytes

Contents

# coding: utf-8

example :report_callbacks, 'Callbacks of Report' do |t|
  report = Thinreports::Report.new layout: t.layout_filename

  # A handler called after creating each page in 0.7.7 or lower
  report.events.on :page_create do |e|
    e.page.item(:text1).value('A handler called after creating each page in 0.7.7 or lower')
  end

  # A handler called after creating each page in 0.8 or higher
  report.on_page_create do |page|
    page.item(:text2).value('A handler called after creating each page in 0.8 or higher')
  end

  report.start_new_page
  report.start_new_page

  # A handler called before finalizing report in 0.7.7 or lower
  report.events.on :generate do |e|
    e.pages.each do |page|
      page.item(:text3).value('A handler called before finalizing report in 0.7.7 or lower')
    end
  end

  report.pages.each do |page|
    page.item(:text4).value('emulation of generate event in 0.8 or higher')
  end

  report.generate filename: t.output_filename
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
thinreports-0.8.2 examples/report_callbacks/report_callbacks.rb
thinreports-0.8.1 examples/report_callbacks/report_callbacks.rb
thinreports-0.8.0 examples/report_callbacks/report_callbacks.rb