Class: AutoHtml::Builder
- Inherits:
-
Object
- Object
- AutoHtml::Builder
- Defined in:
- lib/auto_html/builder.rb
Constant Summary collapse
- @@filters =
{}
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(text) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(text) ⇒ Builder
Returns a new instance of Builder.
5 6 7 |
# File 'lib/auto_html/builder.rb', line 5 def initialize(text) @text = text.dup end |
Class Method Details
.add_filter(name, &block) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/auto_html/builder.rb', line 9 def self.add_filter(name, &block) filter = Filter.new(block) @@filters.merge!(name => filter) src = %| def #{name}(options = {}) @text = @@filters["#{name}".to_sym].apply(@text, options) end | class_eval src, __FILE__, __LINE__ filter end |