Method: Bbcode::Base#to

Defined in:
lib/bbcode/base.rb

#to(handler_name, locals = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/bbcode/base.rb', line 12

def to(handler_name, locals = {})
  handler = Bbcode.handler handler_name
  raise "Handler #{handler} isn't registered." if handler.nil?
  handler.locals = locals.with_indifferent_access
  @parser.parse @string, handler
  result = handler.get_document.content.to_s
  handler.clear
  result
end