Module: OshparkHashExtensions

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

Instance Method Summary collapse

Instance Method Details

#to_multipart(key = nil) ⇒ Object



19
20
21
# File 'lib/oshpark/ext.rb', line 19

def to_multipart key = nil
  collect {|k, v| v.to_multipart(key ? "#{key}[#{k}]" : k)}.flatten.compact
end

#to_paramsObject



27
28
29
# File 'lib/oshpark/ext.rb', line 27

def to_params
  self
end

#to_query(key = nil) ⇒ Object



23
24
25
# File 'lib/oshpark/ext.rb', line 23

def to_query key = nil
  collect {|k, v| v.to_query(key ? "#{key}[#{k}]" : k)}.flatten.join '&'
end