Method: REXML::Attribute#to_string

Defined in:
lib/rexml/attribute.rb

#to_stringObject

Returns this attribute out as XML source, expanding the name

a = Attribute.new( "x", "y" )
a.to_string     # -> "x='y'"
b = Attribute.new( "ns:x", "y" )
b.to_string     # -> "ns:x='y'"


124
125
126
127
128
129
130
# File 'lib/rexml/attribute.rb', line 124

def to_string
  if @element and @element.context and @element.context[:attribute_quote] == :quote
    %Q^#@expanded_name="#{to_s().gsub(/"/, '"')}"^
  else
    "#@expanded_name='#{to_s().gsub(/'/, ''')}'"
  end
end