Convert options for xml attributes

 @param [Hash<Symbol, Object>] hash the hash of symbols and objects for xml attributes
 @return [Hash<String, Object>] the options for xml attributes
352556
def convert_to_xml_attributes(hash)
      result = {}
      hash.each do |k, v|
        key = k.to_s.gsub('_', '-').to_sym
        result[key] = v
      end
      result
    end
21908
def to_xml
      xml = %(<method name="#{@name}">\n)
      @params.each do |param|
        name = param.name ? %(name="#{param.name}" ) : ""
        xml += %(<arg #{name}direction="in" type="#{param.type}"/>\n)
      end
      @rets.each do |param|
        name = param.name ? %(name="#{param.name}" ) : ""
        xml += %(<arg #{name}direction="out" type="#{param.type}"/>\n)
      end
      xml += %(</method>\n)
      xml
    end
221373
def stringify( hash )

            keys = @sorted ? hash.keys.sort : hash.keys
            vals = keys.map{ |key|
                val = ''
                if hash[key].kind_of?( Array ) 
                    val = rotate( hash[key] )
                elsif hash[key].kind_of?( Hash )
                    val = @sorted ? hash[key].keys.sort[0] : hash[key].keys[0]
                else
                    val = hash[key]
                end
                "#{key}: #{val}"
            }
            return vals.join( '; ' ) + (vals.length ? ';' : '')

        end
174329
def build_from_hash(attributes)
      return nil unless attributes.is_a?(Hash)
      self.class.swagger_types.each_pair do |key, type|
        if type =~ /^Array<(.*)>/i
          if attributes[self.class.attribute_map[key]].is_a?(Array)
            self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
          else
            #TODO show warning in debug mode
          end
        elsif !attributes[self.class.attribute_map[key]].nil?
          self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
        else
          # data not found in attributes(hash), not an issue as the data can be optional
        end
      end

      self
    end
338253
def xml_to_attributes(xml)
			xml.elements["/rsp/attributes"].inject({}) { |h,e| 
				h[e.attributes["name"].to_sym] = e.attributes["value"]
				h 
			}
		end
1154219
def options
      map = Config.class_variables.map do |key|
        [key.to_s.tr('@', '').to_sym, class_variable_get(:"#{key}")]
      end
      Hash[map]
    end
935655
def hbs_attributes
      s = self.class.class_variable_get(:@@serialize)
      if s[:merge]
        attrs = s[:attrs] + self.attributes.keys
      else
        attrs = s[:attrs]
      end
      attrs.collect{|attr| attr.to_sym}.uniq
    end
290258
def parse_xml(contents, name)
      hash = Hash.from_xml(contents)
      hash = hash[name] if hash.size == 1 && hash.key?(name)  # xml document could have root tag matching the file name.
      RConfig::PropertiesFile.parse_references(hash)
    end
1157744
def to_hash
      serialized_attributes = attributes.dup

      self.class.expandable_attributes.each_pair.select do |attribute_name, expanded_class|
        if expanded_class === attributes[attribute_name]
          serialized_attributes[attribute_name] = serialized_attributes[attribute_name].id
        end
      end

      serialized_attributes
    end
876110
def to_xml! xml=nil
      convert_to_string = true if xml.nil?
      xml = Builder::XmlMarkup.new if xml.nil?
      if @name == :ess
        xml.instruct! :xml, :encoding => "UTF-8"
        xml.declare! :DOCTYPE, :ess, :PUBLIC, "-//ESS//DTD", "http://essfeed.org/history/0.9/index.dtd"
      end
      xml.tag! @name, attributes do |p|
        if !@text.nil?
          if @dtd[:cdata]
            p.cdata! @text
          else
            p.text! @text
          end
        end
        child_tags.values.each { |tag_list| tag_list.each { |tag| tag.to_xml!(p) } }
      end
      xml.target! if convert_to_string
    end
725201
def to_hash
      {}.merge(@properties).tap do |h|
        h['_links'] = {}.merge @links    unless @links.empty?

        combined_embedded = {}
        combined_embedded.merge! @embedded unless @embedded.empty?
        combined_embedded.merge! @embedded_arrays unless @embedded_arrays.empty?
        h['_embedded'] = combined_embedded unless combined_embedded.empty?
      end
    end
245676
def to_hash
      OPTIONS.inject({}) do |hash, option|
        key = option.first
        hash[key] = self.send(key)
        hash
      end
    end
878617
def html_safe_options(hash)
      hash.inject({}) do |result, (key, value)|
        result[key] = case value
          when String
            ERB::Util.h(value)
          else
            value
          end

        result
      end
    end
464045
def attribute(*args)
      node = Nodes::Attribute.new

      if args.first.is_a?(Hash)
        args.first.each_pair { |k, v| node[v] = k }
      else
        options = args.extract_options!
        args.each { |name|
          key = options[:as] || name
          node[key] = name
        }
        node.condition = options[:if]
      end

      @template.add_node node
    end
551658
def attributes
      (@original_attributes||{}).merge(@attributes).keys.inject({}) do |hash, key|
        hash[key] = read_attribute(key)
        hash
      end
    end
1339511
def to_hash
      VALID_ATTRIBUTES.reduce({}) { |acc, k| acc[k] = send(k); acc }
    end
526514
def to_hash(options = {})
      out = {}
      each_key do |k|
        assignment_key =
          if options[:stringify_keys]
            k.to_s
          elsif options[:symbolize_keys]
            k.to_s.to_sym
          else
            k
          end
        if self[k].is_a?(Array)
          out[assignment_key] ||= []
          self[k].each do |array_object|
            out[assignment_key] << maybe_convert_to_hash(array_object, options)
          end
        else
          out[assignment_key] = maybe_convert_to_hash(self[k], options)
        end
      end
      out
    end