Class: Hpricot::Elem
- Inherits:
-
Object
- Object
- Hpricot::Elem
- Defined in:
- lib/lilu.rb
Instance Attribute Summary collapse
-
#cache_search ⇒ Object
Returns the value of attribute cache_search.
Instance Method Summary collapse
- #_inner_html=(html) ⇒ Object
- #_output ⇒ Object
- #_search ⇒ Object
- #output(out, opts = {}) ⇒ Object
- #search(expr, &block) ⇒ Object
Instance Attribute Details
#cache_search ⇒ Object
Returns the value of attribute cache_search.
6 7 8 |
# File 'lib/lilu.rb', line 6 def cache_search @cache_search end |
Instance Method Details
#_inner_html=(html) ⇒ Object
21 22 23 |
# File 'lib/lilu.rb', line 21 def _inner_html=(html) @_inner_html = html end |
#_output ⇒ Object
25 |
# File 'lib/lilu.rb', line 25 alias :_output :output |
#_search ⇒ Object
7 |
# File 'lib/lilu.rb', line 7 alias :_search :search |
#output(out, opts = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/lilu.rb', line 26 def output(out, opts={}) if @_inner_html if empty? and ElementContent[@stag.name] == :EMPTY @stag.output(out, opts.merge(:style => :empty)) else @stag.output(out, opts) out << @_inner_html if @etag @etag.output(out, opts) elsif !opts[:preserve] ETag.new(@stag.name).output(out,opts) end end else _output(out,opts) end end |
#search(expr, &block) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/lilu.rb', line 8 def search(expr,&block) if @_inner_html self.inner_html= @_inner_html @_inner_html = nil end if cache_search @_search ||= {} @_search[expr] || @_search[expr] = _search(expr,&block) else _search(expr,&block) end end |