Class: TextInvoice::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/text-invoice/template.rb

Instance Method Summary collapse

Instance Method Details

#custom(invoice, template) ⇒ Object



11
12
13
14
# File 'lib/text-invoice/template.rb', line 11

def custom(invoice, template)
    parsed = YAML.load(invoice)
    Mustache.render(open(template).read(), parsed)
end

#html(invoice) ⇒ Object



6
7
8
9
# File 'lib/text-invoice/template.rb', line 6

def html(invoice)
    parsed = YAML.load(invoice)
    Mustache.render(open(root + "templates/invoice.html").read(), parsed)
end

#rootObject



16
17
18
# File 'lib/text-invoice/template.rb', line 16

def root 
  File.dirname(__FILE__) + "/../../"
end