Sha256: 090358dde75d956dc8a61fc3e08a6e0173e53340492b4e5609fd8552c6f59318

Contents?: true

Size: 909 Bytes

Versions: 1

Compression:

Stored size: 909 Bytes

Contents

== Prioritized Engines

The Malt Machine class can also be used to prioritize engines.
For instance, by default markdown documents are handled by
the RDiscount library. 

  malt = Malt::Machine.new

  engine = malt.pry.engine(:markdown)
  engine.assert == Malt::Engine::RDiscount

To use Kramdown instead, we can specify
it as a priority when initilizeing a new Machine.

  malt = Malt::Machine.new(:priority=>[:kramdown])

Lets check to make sure.

  engine = malt.pry.engine(:markdown)
  engine.assert == Malt::Engine::Kramdown

To change the engine priorities of the master Malt Machine, provide 
the #priority method with the type and it will put it at the top of
the priority list.

  Malt.machine.priority :kramdown

Lets check to make sure.

  engine = Malt.machine.pry.engine(:markdown)
  engine.assert == Malt::Engine::Kramdown

(If you are wondering, #pry is simply used to call a private method.)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
malt-0.3.0 qed/05_machine/02_prioritized_engines.rdoc