Sha256: 0b066fa499c806df32293dc6028549ee111914a81d6c4b08087887e51b23d2ae

Contents?: true

Size: 786 Bytes

Versions: 2

Compression:

Stored size: 786 Bytes

Contents

require "juno-report/version"
require "juno-report/pdf"
require "juno-report/pdf/behaviors"
require "prawml"

module JunoReport
    autoload :ReportObject, 'juno-report/report_object'

    def self.generate(collection, options)
        rules = "#{options[:report]}.yml"

        defaults = {
            :page_layout => :portrait
        }

        pdf = Prawml::PDF.new rules, defaults.merge(options)

        pdf.extend JunoReport::Pdf
        report  = pdf.generate(collection)

        options[:type] ||= :file

        if options[:type].eql? :file
            report.render_file (options[:filename] || "report.pdf")
        elsif options[:type].eql? :stream
            return report
        else
            raise "Type options must be :file or :stream."
        end

    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
juno-report-0.0.6 lib/juno-report.rb
juno-report-0.0.5 lib/juno-report.rb