Sha256: 707903d740543d9b96a34bbaa1e96e3522f9b1dfcfeafef492166731d28dbfd4
Contents?: true
Size: 870 Bytes
Versions: 2
Compression:
Stored size: 870 Bytes
Contents
require "active_support/core_ext/class/attribute" require "active_support/inflector" require_relative "renderer" module PrawnCocktail class Document class_attribute :initializers self.initializers = [] def self.initialize_template(&block) self.initializers += [block] end def self.helper(mod) initialize_template { extend mod } end def render renderer.render_data end def render_file(file) renderer.render_file(file) end def filename # Override in your subclass. nil end private def renderer @renderer ||= Renderer.new(template_name, data, initializers) end def template_name self.class.name.underscore end def data # Override in your subclass. {} end def initializers self.class.initializers end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
prawn_cocktail-0.7.1 | lib/prawn_cocktail/document.rb |
prawn_cocktail-0.7.0 | lib/prawn_cocktail/document.rb |