Sha256: 2406eb6f1b32fd0c39f53fa93230c83cd22041be7daf52a8e02d2cf5d296ab97

Contents?: true

Size: 1.36 KB

Versions: 3

Compression:

Stored size: 1.36 KB

Contents

require 'rexml/element'
require 'rexml/formatters/default'

# fixes exception when element is too big to fit on a line
module REXML
  module Formatters
    # Pretty-prints an XML document.  This destroys whitespace in text nodes
    # and will insert carriage returns and indentations.
    #
    # TODO: Add an option to print attributes on new lines
    class Pretty < Default
      def wrap(string, width)
#         p("wrap(" + string.to_s + "," + width.to_s + ")")
        # Recursively wrap string at width.
        return string if string.length <= width
        place = string.rindex(' ', width) # Position in string with last ' ' before cutoff
        return string unless place        # too wide, but no spaces to break
        return string[0,place] + "\n" + wrap(string[place+1..-1], width)
      end
    end
  end

  class Document < Element
    def pretty_print(q)
      write($stdout, 2)
    end
  end
end


module OAuth::RequestProxy::Net
  module HTTP
    class HTTPRequest < OAuth::RequestProxy::Base
      def query_string
        params = [ query_params, auth_header_params ]
        is_form_urlencoded = request['Content-Type'] != nil && request['Content-Type'].downcase == 'application/x-www-form-urlencoded'
        params << post_params if ['POST', 'PUT'].include?(method.to_s.upcase) && is_form_urlencoded
        params.compact.join('&')
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
myspaceid-sdk-0.1.11 lib/patches.rb
myspaceid-sdk-0.1.8 lib/patches.rb
myspaceid-sdk-0.1.9 lib/patches.rb