Sha256: fcd1883c3fea45ddb86357d928522c792aa8e3069dfecafcfad640c5799aca97
Contents?: true
Size: 837 Bytes
Versions: 1
Compression:
Stored size: 837 Bytes
Contents
# frozen_string_literal: true require 'action_dispatch/http/mime_type' require 'spreadsheet' require 'columnify/worksheet' class ColumnifyTemplate class << self attr_accessor :template_lookup_options end self.template_lookup_options = {handlers: [:columnify]} def initialize(context, *args) @context = context super(*args) end def worksheet(resources, *args) worksheet = Columnify::Worksheet.new(resources, *args) worksheet.create end end class ColumnifyHandler cattr_accessor :default_format self.default_format = Columnify::Mime::XLS def self.call(template, source = nil) source ||= template.source # this juggling is required to keep line numbers right in the error %{__already_defined = defined?(spreadsheet); spreadsheet||=ColumnifyTemplate.new(self); #{source}} end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
columnify-0.1.1 | lib/columnify/columnify_template.rb |