Module: AutoHtml
Defined Under Namespace
Modules: Task
Classes: Builder, Filter, Railtie
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.add_filter(name, &block) ⇒ Object
4
5
6
|
# File 'lib/auto_html/base.rb', line 4
def self.add_filter(name, &block)
AutoHtml::Builder.add_filter(name, &block)
end
|
Instance Method Details
#auto_html(raw, &proc) ⇒ Object
8
9
10
11
12
13
14
15
16
|
# File 'lib/auto_html/base.rb', line 8
def auto_html(raw, &proc)
return "" if raw.blank?
builder = Builder.new(raw)
result = builder.instance_eval(&proc)
return raw if result.nil?
result.respond_to?(:html_safe) ?
result.html_safe :
result
end
|