Class: ESI::Tag::Try

Inherits:
Container show all
Defined in:
lib/esi/tag/try.rb

Constant Summary

Constants inherited from Base

Base::Validate

Instance Attribute Summary

Attributes inherited from Container

#cache, #children, #closed, #name

Attributes inherited from Base

#attributes, #cache, #children, #closed, #name

Instance Method Summary collapse

Methods inherited from Container

#add_child, #close_child, #initialize

Methods included from Log

#log, #log_debug, #log_error, #log_request, #msg

Methods inherited from Base

create, #initialize, #prepare_url_vars

Constructor Details

This class inherits a constructor from ESI::Tag::Container

Instance Method Details

#buffer(output, inner_html) ⇒ Object



35
36
37
# File 'lib/esi/tag/try.rb', line 35

def buffer( output, inner_html )
  @unclosed.buffer( output, inner_html ) if @unclosed
end

#close(output) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/esi/tag/try.rb', line 11

def close( output )
  super(output)
  begin
    @children.each do |tag|
      if tag.name == "attempt"
        tag.children.each do|ctag|
          ctag.close( output, :raise => true )
        end
      end
    end
  rescue => e
    log_error e.message
    @children.each do |tag|
      if tag.name == "except"
        tag.children.each_with_index do|ctag,index|
          output << tag.buffers[index]
          ctag.close( output )
        end
        output << tag.buffers[tag.children.size]
      end
    end
  end
end