Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/pandoku/lookup_table.rb
Instance Method Summary collapse
-
#pandoku(from, to = nil, options = {}) ⇒ Object
Translate the markup.
Instance Method Details
#pandoku(from, to = nil, options = {}) ⇒ Object
Translate the markup.
string.pandoku(:markdown => :html)
string.pandoku(:markdown, :html)
string.pandoku(:markdown, :html, :smart => true)
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/pandoku/lookup_table.rb', line 37 def pandoku(from, to = nil, = {}) if to.nil? && from.is_a?(Hash) && from.size == 1 to = from.values.first from = from.keys.first end raise ArgumentError, 'expected two arguments' if to.nil? decoder = Formats.lookup(from).new() encoder = Formats.lookup(to).new decoder.parse(self).compile(encoder) end |