Class: RWB::UrlSession

Inherits:
Url
  • Object
show all
Defined in:
lib/rwb/url.rb

Instance Attribute Summary

Attributes inherited from Url

#method, #weight

Instance Method Summary collapse

Methods inherited from Url

#read_method

Constructor Details

#initialize(weight, session, name, method = 'GET') ⇒ UrlSession

Returns a new instance of UrlSession.



100
101
102
103
104
105
106
# File 'lib/rwb/url.rb', line 100

def initialize(weight, session, name, method='GET')
  @weight = weight
  @session = session
  @urls = []
  @name = name
  @method = read_method(method)
end

Instance Method Details

#to_baseObject



116
117
118
# File 'lib/rwb/url.rb', line 116

def to_base
  @name
end

#to_sObject



120
121
122
# File 'lib/rwb/url.rb', line 120

def to_s
  @weight.to_s + " " + @name
end

#to_urlObject



108
109
110
111
112
113
114
# File 'lib/rwb/url.rb', line 108

def to_url
  if @urls == []
    @urls << @session
    @urls.flatten!
  end
  @urls.shift
end