Class: RbbCode::Parser
- Inherits:
-
Object
- Object
- RbbCode::Parser
- Defined in:
- lib/rbbcode/parser.rb
Instance Method Summary collapse
-
#initialize(config = {}) ⇒ Parser
constructor
A new instance of Parser.
- #parse(str) ⇒ Object
Constructor Details
#initialize(config = {}) ⇒ Parser
Returns a new instance of Parser.
3 4 5 |
# File 'lib/rbbcode/parser.rb', line 3 def initialize(config = {}) @config = config end |
Instance Method Details
#parse(str) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/rbbcode/parser.rb', line 7 def parse(str) str = (str) schema = @config[:schema] || RbbCode::Schema.new tree_maker = @config[:tree_maker] || RbbCode::TreeMaker.new(schema) tree = tree_maker.make_tree(str) html_maker = @config[:html_maker] || RbbCode::HtmlMaker.new html_maker.make_html(tree) end |