Module: OshparkArrayExtensions

Included in:
Array
Defined in:
lib/oshpark/ext.rb

Overview

:nodoc: all

Instance Method Summary collapse

Instance Method Details

#to_multipart(key) ⇒ Object



3
4
5
6
# File 'lib/oshpark/ext.rb', line 3

def to_multipart key
  prefix = "#{key}[]"
  collect {|a| a.to_multipart(prefix)}.flatten.compact
end

#to_paramsObject



13
14
15
# File 'lib/oshpark/ext.rb', line 13

def to_params
  collect {|a| a.to_params }.flatten
end

#to_query(key) ⇒ Object



8
9
10
11
# File 'lib/oshpark/ext.rb', line 8

def to_query key
  prefix = "#{key}[]"
  collect { |value| value.to_query(prefix) }.flatten.join '&'
end