Class: Array

Inherits:
Object show all
Defined in:
lib/mini_apivore/to_param.rb

Direct Known Subclasses

MiniApivore::Fragment

Instance Method Summary collapse

Instance Method Details

#to_paramObject



40
41
42
# File 'lib/mini_apivore/to_param.rb', line 40

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

#to_query(key) ⇒ Object



48
49
50
51
52
53
54
55
56
# File 'lib/mini_apivore/to_param.rb', line 48

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

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