Module: Cardiac::RackUtils

Includes:
Rack::Utils
Included in:
Cardiac::Representation::Codecs::UrlEncoded::Extensions
Defined in:
lib/cardiac/util.rb

Overview

Specialized version(s) of Rack utility functions.

Instance Method Summary collapse

Instance Method Details

#build_nested_query(value, prefix = nil) ⇒ Object

Overridden to work with false, true and nil, and otherwise call :to_param on single values that are not strings.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/cardiac/util.rb', line 12

def build_nested_query(value,prefix=nil)
  case value
  when Hash, Array, String
    super
  when TrueClass
    "#{prefix}=true"
  when FalseClass
    "#{prefix}=false"
  when NilClass
    "#{prefix}="
  else
    super value.to_param, prefix
  end
end