Module: RUTorrent::Helpers::URLHelper

Defined in:
lib/rutorrent/helpers/url_helper.rb

Constant Summary collapse

BASE_PATH =
'/gui'
KEYS =
[:token, :list, :cid, :action, :hash, :s, :v, :p, :f]

Class Method Summary collapse

Class Method Details

.path_for(args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rutorrent/helpers/url_helper.rb', line 7

def self.path_for(args)
  path = BASE_PATH.dup

  case args
  when String
    path << args
  when Hash
    query = []

    KEYS.each do |key|
      query << "#{key}=#{args[key]}" if args.key?(key)
    end

    path << '/?'
    path << query.join('&')
  end
end