/
prawnto.rb
29 lines (24 loc) · 1022 Bytes
/
prawnto.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
$:.unshift(File.dirname(__FILE__)) unless
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
module Prawnto
VERSION='0.0.5'
autoload :ActionControllerMixin, 'prawnto/action_controller_mixin'
autoload :ActionViewMixin, 'prawnto/action_view_mixin'
module TemplateHandlers
autoload :Base, 'prawnto/template_handlers/base'
autoload :Dsl, 'prawnto/template_handlers/dsl'
end
module TemplateHandler
autoload :CompileSupport, 'prawnto/template_handler/compile_support'
end
class << self
def enable
ActionController::Base.send :include, Prawnto::ActionControllerMixin
ActionView::Base.send :include, Prawnto::ActionViewMixin
Mime::Type.register "application/pdf", :pdf unless defined?(Mime::PDF)
ActionView::Template.register_template_handler 'prawn', Prawnto::TemplateHandlers::Base
ActionView::Template.register_template_handler 'prawn_dsl', Prawnto::TemplateHandlers::Dsl
end
end
require "prawnto/railtie"
end