Module: QueryString
- Defined in:
- lib/query_string.rb,
lib/query_string/version.rb
Overview
Module with class methods for convertation
Constant Summary collapse
- VERSION =
'1.0.1'.freeze
Class Method Summary collapse
Class Method Details
.build(value, prefix = nil) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/query_string.rb', line 6 def build(value, prefix = nil) case value when Hash build_hash(value, prefix) when Array value.map { |v| build(v, "#{prefix}[]") }.join('&') when nil then prefix.to_s else raise ArgumentError, 'value must be a Hash' if prefix.nil? "#{prefix}=#{escape(value)}" end end |