class Skr::Print::Template::Definition
Public Class Methods
new(path)
click to toggle source
# File lib/skr/print/template.rb, line 6 def initialize(path) @path = path end
Public Instance Methods
choices()
click to toggle source
# File lib/skr/print/template.rb, line 12 def choices Pathname.glob(@path.join('*.tex.erb')).map{|pn| pn.basename('.tex.erb').to_s } end
model()
click to toggle source
# File lib/skr/print/template.rb, line 17 def model "skr/#{name}".underscore.classify.constantize end
name()
click to toggle source
# File lib/skr/print/template.rb, line 9 def name @path.basename.to_s end
path_for_record(record)
click to toggle source
# File lib/skr/print/template.rb, line 20 def path_for_record(record) form = record.respond_to?(:form) ? record.form : 'default' path = @path.join( form + '.tex.erb' ) path.exist? ? path : @path.join( 'default.tex.erb' ) end