class PolicyManager::Exporter

Attributes

after_zip[RW]
attachment_path[RW]
attachment_storage[RW]
index_template[RW]
layout[RW]
mail_helpers[RW]
mailer[RW]
mailer_templates[RW]
path[RW]
resource[RW]

Public Class Methods

new(opts={}) click to toggle source
# File lib/policy_manager/exporter.rb, line 18
def initialize(opts={})
  self.path = opts[:path]
  self.resource = opts[:resource] #.call if opts[:resource].is_a?(Proc)
  self.index_template = opts[:index_template]
  self.layout = opts[:layout]
  self.after_zip = opts[:after_zip]
  self.mail_helpers = opts[:mail_helpers]
  self.attachment_path = opts[:attachment_path]
  self.attachment_storage = opts[:attachment_storage]
  self.expiration_link = opts[:expiration_link]
  self.customize_link = opts[:customize_link]
  self.mailer_templates = opts[:mailer_templates]
end

Public Instance Methods

clear!(resource) click to toggle source
# File lib/policy_manager/exporter.rb, line 37
def clear!(resource)
  e = ExporterHandler.new(resource: resource, path: path)
  e.clear!
end
default_index_template() click to toggle source
# File lib/policy_manager/exporter.rb, line 71
def default_index_template
  '<h1>links</h1>
  <ul>
    <% @collection.each do |rule| %>
      <li><%= link_to rule.name, "./#{rule.name}" %></li>
    <% end %>
  </ul>'
end
handled_template(template) click to toggle source
# File lib/policy_manager/exporter.rb, line 62
def handled_template(template)
  return if template.blank?
  if template.is_a?(String)
    template
  elsif template.is_a?(Pathname)
    File.open(template).read
  end
end
perform(resource) click to toggle source
# File lib/policy_manager/exporter.rb, line 32
def perform(resource)
  e = ExporterHandler.new(resource: resource, path: path, after_zip: after_zip)
  e.perform
end