Sha256: f0b3533d16ef15c87ee2b1896d053c127303f2358c49fcc15c27d75bfb811a66
Contents?: true
Size: 913 Bytes
Versions: 1
Compression:
Stored size: 913 Bytes
Contents
require 'action_view' module ActionView module Template::Handlers class AxlsxBuilder def default_format (Rails.version.to_f >= 5) ? Mime[:xlsx] : Mime::XLSX end def self.call(template) "xlsx_author = defined?(xlsx_author).nil? ? nil : xlsx_author;\n" + "xlsx_created_at = defined?(xlsx_created_at).nil? ? nil : xlsx_created_at;\n" + "xlsx_use_shared_strings = defined?(xlsx_use_shared_strings).nil? ? nil : xlsx_use_shared_strings;\n" + "xlsx_package = Axlsx::Package.new(\n" + ":author => xlsx_author,\n" + ":created_at => xlsx_created_at,\n" + ":use_shared_strings => xlsx_use_shared_strings\n" + ");\n" + template.source + ";\nxlsx_package.to_stream.string;" end end end end ActionView::Template.register_template_handler :axlsx, ActionView::Template::Handlers::AxlsxBuilder
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
axlsx_rails-0.5.0 | lib/axlsx_rails/template_handler.rb |