Sha256: 5e008fda5dd03a7a94d44fe6d666789bdba6e5b9422e9d74b1af206517c11f60

Contents?: true

Size: 847 Bytes

Versions: 1

Compression:

Stored size: 847 Bytes

Contents

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

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

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

        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.render
        else
            raise "Type options must be :file or :stream."
        end

    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
juno-report-0.1.6 lib/juno-report.rb