Class: Array

Inherits:
Object show all
Defined in:
lib/ocx_client/core_ext/to_query.rb

Instance Method Summary collapse

Instance Method Details

#to_paramObject



34
35
36
# File 'lib/ocx_client/core_ext/to_query.rb', line 34

def to_param
  collect(&:to_param).join '/'
end

#to_query(key) ⇒ Object



38
39
40
41
42
43
44
45
46
# File 'lib/ocx_client/core_ext/to_query.rb', line 38

def to_query(key)
  prefix = "#{key}[]"

  if empty?
    nil.to_query(prefix)
  else
    collect { |value| value.to_query(prefix) }.join '&'
  end
end