Malt  Malt

[Validate]
Generated with RDazzle Newfish 1.4.0

Malt

Public Class Methods

cli(*args) click to toggle source
    # File lib/malt.rb, line 48
48:   def self.cli(*args)
49:     require 'optparse'
50:     itype, otype = nil, nil
51:     OptionParser.new{|o|
52:       o.on('-t TYPE', 'input type'){  |t| itype  = t }
53:       o.on('-o TYPE', 'output type'){ |t| otype = t }
54:       o.on('--help', '-h'       , 'display this help message'){ puts o; exit }
55:     }.parse!
56:     db, files = *args.partition{ |x| x.index('=') }
57:     db = db.inject({}){ |h,kv| k,v = kv.split('='); h[k] = v; h}
58:     files.each do |file|
59:       puts Malt.render(:file=>file, :type=>itype, :format=>otype)
60:       #file = itype ? Malt.file(file, :type=>itype) : Malt.file(file)
61:       #if otype
62:       #  puts file.render(otype, db)
63:       #else
64:       #  puts file.render(db)
65:       #end
66:     end
67:   end
engine?(ext) click to toggle source

Returns true if the extension given is renderable.

    # File lib/malt.rb, line 43
43:   def self.engine?(ext)
44:     machine.engine?(ext)
45:   end
file(file, options={}) click to toggle source
    # File lib/malt.rb, line 18
18:   def self.file(file, options={})
19:     machine.file(file, options)
20:   end
format?(ext) click to toggle source
    # File lib/malt.rb, line 38
38:   def self.format?(ext)
39:     machine.format?(ext)
40:   end
machine() click to toggle source
    # File lib/malt.rb, line 13
13:   def self.machine
14:     @machine ||= Machine.new
15:   end
open(url, options={}) click to toggle source
    # File lib/malt.rb, line 28
28:   def self.open(url, options={})
29:     machine.open(url, options)
30:   end
render(params, &body) click to toggle source
    # File lib/malt.rb, line 33
33:   def self.render(params, &body)
34:     machine.render(params, &body)
35:   end
text(text, options={}) click to toggle source
    # File lib/malt.rb, line 23
23:   def self.text(text, options={})
24:     machine.text(text, options)
25:   end

Disabled; run with --debug to generate this.