4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/hippo/outputters/html.rb', line 4
def to_html
output = ''
initial_call = caller.select{|m| m =~ /#{__FILE__}/}.length == 0
if initial_call
output = %{<fieldset class="hippo-transaction-set"><legend>#{self.class.to_s.sub('Hippo::TransactionSets::','')}</legend>}
end
values.sort.each do |sequence, component|
component_definition = self.class.components[sequence]
if component_definition.klass.ancestors.include?(Hippo::TransactionSets::Base)
output += %Q{<fieldset class="hippo-component"><legend>#{component_definition.klass.to_s.sub('Hippo::TransactionSets::','')} - #{component_definition.options[:name]}</legend>}
output += component.to_html
output += '</fieldset>'
else
output += %Q{<span class="hippo-segment-name">#{component_definition.options[:name]}</span><span class="hippo-segment-data">#{component.to_s}</span><br/>}
end
end
output + (initial_call ? '</fieldset>' : '')
end
|