Class: CarrierWave::Cloudflare::URL::QueryString

Inherits:
Hash
  • Object
show all
Defined in:
lib/carrierwave/cloudflare/url/query_string.rb

Constant Summary collapse

Parser =
Object.new.tap do |obj|
  obj.extend(Rack::Utils)

  # these methods are private in Rack::Utils
  obj.singleton_class.instance_eval { public :build_query, :parse_query }
end

Instance Method Summary collapse

Constructor Details

#initialize(query = "") ⇒ QueryString

Returns a new instance of QueryString.



16
17
18
19
# File 'lib/carrierwave/cloudflare/url/query_string.rb', line 16

def initialize(query = "")
  super()
  merge!(Parser.parse_query(query))
end

Instance Method Details

#to_queryObject Also known as: to_s



21
22
23
24
# File 'lib/carrierwave/cloudflare/url/query_string.rb', line 21

def to_query
  result = Parser.build_query(self)
  result unless result.empty?
end