Class: Array

Inherits:
Object show all
Defined in:
lib/extensions.rb

Overview

typed: true

Direct Known Subclasses

Mangadex::Api::Response::Collection

Instance Method Summary collapse

Instance Method Details

#to_paramObject



14
15
16
# File 'lib/extensions.rb', line 14

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

#to_query(key) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/extensions.rb', line 4

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

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