Sha256: 9d0e5d990aa0d6d379eda0457fc634603a2450df8f58bf73565968b04f35d532

Contents?: true

Size: 500 Bytes

Versions: 23

Compression:

Stored size: 500 Bytes

Contents

class Object
  # Converts an object into a string suitable for use as a URL query string, using the given <tt>key</tt> as the
  # param name.
  #
  # Note: This method is defined as a default implementation for all Objects for Hash#to_query to work.
  def to_query(key)
    require 'cgi' unless defined?(CGI) && defined?(CGI::escape)
    "#{CGI.escape(key.to_s).gsub(/%(5B|5D)/n) { [$1].pack('H*') }}=#{CGI.escape(to_param.to_s)}"
  end

  # Alias of <tt>to_s</tt>.
  def to_param
    to_s
  end

end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
360_services-1.1.3 lib/sorenson/services/core_ext/object.rb
360_services-1.1.2 lib/sorenson/services/core_ext/object.rb
360_services-1.1.1 lib/sorenson/services/core_ext/object.rb
360_services-1.0.10 lib/sorenson/services/core_ext/object.rb
360_services-1.1.0 lib/sorenson/services/core_ext/object.rb
360_services-1.0.9 lib/sorenson/services/core_ext/object.rb
360_services-1.0.8 lib/sorenson/services/core_ext/object.rb
360_services-1.0.7 lib/sorenson/services/core_ext/object.rb
360_services-1.0.6 lib/sorenson/services/core_ext/object.rb
360_services-1.0.5 lib/sorenson/services/core_ext/object.rb
360_services-1.0.4 lib/sorenson/services/core_ext/object.rb
360_services-1.0.3 lib/sorenson/services/core_ext/object.rb
360_services-1.0.2 lib/sorenson/services/core_ext/object.rb
360_services-0.0.8 lib/sorenson/services/core_ext/object.rb
360_services-0.0.7 lib/sorenson/services/core_ext/object.rb
360_services-0.0.6 lib/sorenson/services/core_ext/object.rb
360_services-0.0.5 lib/sorenson/services/core_ext/object.rb
360_services-1.0.1 lib/sorenson/services/core_ext/object.rb
360_services-1.0.0 lib/sorenson/services/core_ext/object.rb
360_services-0.0.4 lib/sorenson/services/core_ext/object.rb