Top Level Namespace
Defined Under Namespace
Modules: HTree Classes: Regexp
Class Method Summary collapse
-
.empty_binding ⇒ Object
:stopdoc:.
Instance Method Summary collapse
-
#HTree(html_string = nil, &block) ⇒ Object
call-seq: HTree(html_string) -> doc HTreetemplate_string -> doc.
Class Method Details
.empty_binding ⇒ Object
:stopdoc:
282 283 284 |
# File 'lib/htree/template.rb', line 282 def (HTree::EmptyBindingObject).empty_binding binding end |
Instance Method Details
#HTree(html_string = nil, &block) ⇒ Object
call-seq:
HTree(html_string) -> doc
HTree{template_string} -> doc
HTree(html_string)
parses html_string. HTree{template_string}
parses template_string and expand it as a template. Ruby expressions in template_string is evaluated in the scope of the caller.
HTree()
and HTree{}
returns a tree as an instance of HTree::Doc.
385 386 387 388 389 390 391 392 393 |
# File 'lib/htree/template.rb', line 385 def HTree(html_string=nil, &block) if block_given? raise ArgumentError, "both argument and block given." if html_string template = block.call HTree.parse(HTree::TemplateCompiler.new.(template, '', HTree::Encoder.internal_charset, block.binding)) else HTree.parse(html_string) end end |