# File lib/amrita/format.rb, line 465def initialize(formatter, expand_attr=false)
@formatter = formatter
@expand_attr = expand_attr
@result_str = ""
@result_array = []
end
Public Instance methods
pre_format(node)
# File lib/amrita/format.rb, line 472def pre_format(node)
@formatter.with_stream(self) do
node.pre_format1(self)
endend
<<(x)
# File lib/amrita/format.rb, line 478def <<(x)
case x
when Element
@result_array << SanitizedString[@result_str] unless @result_str == ""
@result_array << x
@result_str = ""when String
@result_str << x
when NodeArray
x.array.each do |n|
n.pre_format1(self)
endwhen Node
@formatter.format(x)
else
@result_str << x.to_s
endselfend
result()
# File lib/amrita/format.rb, line 498def result
@result_array << SanitizedString[@result_str] unless @result_str == ""case @result_array.size
when 0
Null
when 1
@result_array[0]
else
@result_array
endend
result_as_top()
# File lib/amrita/format.rb, line 510def result_as_top
Node::to_node(result)
end