public Method

Tag.to_s

Returns a textual representation of the node

Source Code

# File action_controller/vendor/html-scanner/html/node.rb, line 311
def to_s
  if @closing == :close
    "</#{@name}>"
  else
    s = "<#{@name}"
    @attributes.each do |k,v|
      s << " #{k}"
      s << "=\"#{v}\"" if String === v
    end
    s << " /" if @closing == :self
    s << ">"
    @children.each { |child| s << child.to_s }
    s << "</#{@name}>" if @closing != :self && !@children.empty?
    s
  end
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.