Class: Dang
- Inherits:
-
Object
- Object
- Dang
- Defined in:
- lib/dang.rb,
lib/dang/dang.rb,
lib/dang/rails.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
"2.1.0"
- CODENAME =
"Kira"
Class Method Summary collapse
- .it(str, env = nil) ⇒ Object
- .register_filter(name, filter) ⇒ Object
- .run_filter(name, text) ⇒ Object
Class Method Details
.it(str, env = nil) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/dang/dang.rb', line 12 def it(str, env=nil) parser = Dang::Parser.new(str, true) unless parser.parse io = StringIO.new parser.show_error(io) raise io.string end parser.output(env) end |
.register_filter(name, filter) ⇒ Object
23 24 25 |
# File 'lib/dang/dang.rb', line 23 def register_filter(name, filter) @filters[name] = filter end |
.run_filter(name, text) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/dang/dang.rb', line 27 def run_filter(name, text) if filter = @filters[name] return filter[text] else raise "Unknown filter: '#{name}'" end end |