class SiegeSiege::URL

Attributes

http_method[R]
parameter[R]
url[R]

Public Class Methods

new(url, http_method = nil, parameter = nil) click to toggle source
# File lib/siege_siege/url.rb, line 5
def initialize(url, http_method = nil, parameter = nil)

  splat = url.split(' ')

  if splat.size > 1
    @url = splat[0]
    @http_method = splat[1].downcase.to_sym
    @parameter = splat[2]
  else
    @url = url
  end

  @http_method ||= http_method || :get
  @parameter ||= parameter || {}
end

Public Instance Methods

parameter_string() click to toggle source
# File lib/siege_siege/url.rb, line 21
def parameter_string
  case parameter
    when Hash
      parameter.to_param
    else
      parameter
  end
end
post?() click to toggle source
# File lib/siege_siege/url.rb, line 30
def post?
  http_method.to_s.downcase == 'post'
end
to_siege_url() click to toggle source
# File lib/siege_siege/url.rb, line 34
def to_siege_url
  if post?
    [url, 'POST', parameter_string]
  else
    url
  end
end