Class: Darkmouun::Darkmouun
- Inherits:
-
Object
- Object
- Darkmouun::Darkmouun
- Defined in:
- lib/darkmouun/main.rb
Instance Attribute Summary collapse
-
#post_process ⇒ Object
Returns the value of attribute post_process.
-
#pre_process ⇒ Object
Returns the value of attribute pre_process.
Instance Method Summary collapse
- #add_template(tmpl) ⇒ Object
- #convert(source, options = {}, converter = :to_html) ⇒ Object
-
#initialize ⇒ Darkmouun
constructor
A new instance of Darkmouun.
Constructor Details
#initialize ⇒ Darkmouun
Returns a new instance of Darkmouun.
19 20 21 |
# File 'lib/darkmouun/main.rb', line 19 def initialize @templates = {} end |
Instance Attribute Details
#post_process ⇒ Object
Returns the value of attribute post_process.
17 18 19 |
# File 'lib/darkmouun/main.rb', line 17 def post_process @post_process end |
#pre_process ⇒ Object
Returns the value of attribute pre_process.
17 18 19 |
# File 'lib/darkmouun/main.rb', line 17 def pre_process @pre_process end |
Instance Method Details
#add_template(tmpl) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/darkmouun/main.rb', line 23 def add_template(tmpl) # for Mustache tmpl_module = Module.new tmpl_module.module_eval(File.read(tmpl), tmpl) tmpl_module.constants.each do |i| c = tmpl_module.const_get(i) if c.is_a?(Class) && c.ancestors.include?(Mustache) @templates[i] = c end end end |
#convert(source, options = {}, converter = :to_html) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/darkmouun/main.rb', line 35 def convert(source, = {}, converter = :to_html) @source = source do_pre_process apply_mustache apply_kramdown(, converter) do_post_process beautify end |