molten-trunk/molten5_withgrid/vendor/activerecord-activesalesforce-adapter/lib/active_record/connection_adapters/rforce.rb
def expand(args, xmlns = nil)
      #Nest arrays: [:a, 1, :b, 2] => [[:a, 1], [:b, 2]]
      if (args.class == Array)
        args.each_index{|i| args[i, 2] = [args[i, 2]]}
      end

      args.each do |key, value|
        attributes = xmlns ? {:xmlns => xmlns} : {}

        #If the XML tag requires attributes,
        #the tag name will contain a space
        #followed by a string representation
        #of a hash of attributes.
        #
        #e.g. 'sObject {"xsi:type" => "Opportunity"}'
        #becomes <sObject xsi:type="Opportunity>...</sObject>
        if key.is_a? String
          key, modifier = key.split(' ', 2)

          attributes.merge!(eval(modifier)) if modifier
        end

        #Create an XML element and fill it with this
        #value's sub-items.
        case value
        when Hash, Array
          @builder.tag!(key, attributes) do expand value; end

        when String
          @builder.tag!(key, attributes) { @builder.text! value }
        end
      end
    end
#Expand Ruby data structures into XML.
Expand Ruby data structures into XML.
Expand Ruby data structures into XML .
def expand(args, xmlns = nil)
      if (args.class == Array)
        args.each_index{|i| args[i, 2] = [args[i, 2]]}
      end
      args.each do |key, value|
        attributes = xmlns ? {:xmlns => xmlns} : {}
        e.g. 'sObject {"xsi:type" => "Opportunity"}'
        becomes <sObject xsi:type="Opportunity>...</sObject>
        if key.is_a? String
          key, modifier = key.split(' ', 2)
          attributes.merge!(eval(modifier)) if modifier
        end
        Create an XML element and fill it with this
        value's sub-items.
        case value
        when Hash, Array
          @builder.tag!(key, attributes) do expand value; end
        when String
          @builder.tag!(key, attributes) { @builder.text! value }
        end
      end
    end
def expand ( args , xmlns = nil ) if ( args . class == Array ) args . each_index { | i | args [ i , 2 ] = [ args [ i , 2 ] ] } end args . each do | key , value | attributes = xmlns ? { :xmlns => xmlns } : { } if key . is_a? String key , modifier = key . split ( ' ' , 2 ) attributes . merge! ( eval ( modifier ) ) if modifier end case value when Hash , Array @builder . tag! ( key , attributes ) do expand value ; end when String @builder . tag! ( key , attributes ) { @builder . text! value } end end end
Expand Ruby data structures into XML.
Expand Ruby data structures into XML .
#Nest arrays: [:a, 1, :b, 2] => [[:a, 1], [:b, 2]] #If the XML tag requires attributes, #the tag name will contain a space #followed by a string representation #of a hash of attributes. # #e.g. 'sObject {"xsi:type" => "Opportunity"}' #becomes <sObject xsi:type="Opportunity>...</sObject> #Create an XML element and fill it with this #value's sub-items.
args
xmlns