Class: ESI::Tag::Container
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#cache ⇒ Object
readonly
Returns the value of attribute cache.
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#closed ⇒ Object
readonly
Returns the value of attribute closed.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from Base
Instance Method Summary collapse
- #add_child(tag) ⇒ Object
- #close_child(output, name) ⇒ Object
-
#initialize(router, headers, http_params, name, attrs, cache) ⇒ Container
constructor
A new instance of Container.
Methods included from Log
log, log_debug, log_error, log_request, msg
Methods inherited from Base
#buffer, #close, create, #prepare_url_vars
Constructor Details
#initialize(router, headers, http_params, name, attrs, cache) ⇒ Container
Returns a new instance of Container.
13 14 15 16 17 |
# File 'lib/esi/tag/container.rb', line 13 def initialize(router,headers,http_params,name,attrs,cache) super @children = [] @unclosed = nil end |
Instance Attribute Details
#cache ⇒ Object (readonly)
Returns the value of attribute cache.
11 12 13 |
# File 'lib/esi/tag/container.rb', line 11 def cache @cache end |
#children ⇒ Object (readonly)
Returns the value of attribute children.
11 12 13 |
# File 'lib/esi/tag/container.rb', line 11 def children @children end |
#closed ⇒ Object (readonly)
Returns the value of attribute closed.
11 12 13 |
# File 'lib/esi/tag/container.rb', line 11 def closed @closed end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
11 12 13 |
# File 'lib/esi/tag/container.rb', line 11 def name @name end |
Instance Method Details
#add_child(tag) ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/esi/tag/container.rb', line 27 def add_child(tag) if @unclosed #puts "add as child of(#{self.name}): #{tag.name} #{tag.attributes.inspect} to #{@unclosed.name}" @unclosed.add_child(tag) else #puts "add: #{tag.name} #{tag.attributes.inspect} to #{self.name}" @unclosed = tag if tag.respond_to?(:add_child) @children << tag end end |
#close_child(output, name) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/esi/tag/container.rb', line 19 def close_child( output, name ) name = name.sub(/esi:/,'') if @unclosed and @unclosed.name == name @unclosed.close( output ) @unclosed = nil end end |