Class: Fragmentary::RequestQueue
- Inherits:
-
Object
- Object
- Fragmentary::RequestQueue
show all
- Defined in:
- lib/fragmentary/request_queue.rb
Defined Under Namespace
Classes: Sender
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(user_type, host_root_url) ⇒ RequestQueue
Returns a new instance of RequestQueue.
11
12
13
14
15
16
17
18
19
|
# File 'lib/fragmentary/request_queue.rb', line 11
def initialize(user_type, host_root_url)
@user_type = user_type
@host_root_url = host_root_url
@requests = []
self.class.all << self
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
52
53
54
|
# File 'lib/fragmentary/request_queue.rb', line 52
def method_missing(method, *args)
sender.send(method, *args)
end
|
Instance Attribute Details
#host_root_url ⇒ Object
Returns the value of attribute host_root_url.
9
10
11
|
# File 'lib/fragmentary/request_queue.rb', line 9
def host_root_url
@host_root_url
end
|
#requests ⇒ Object
Returns the value of attribute requests.
9
10
11
|
# File 'lib/fragmentary/request_queue.rb', line 9
def requests
@requests
end
|
#user_type ⇒ Object
Returns the value of attribute user_type.
9
10
11
|
# File 'lib/fragmentary/request_queue.rb', line 9
def user_type
@user_type
end
|
Class Method Details
.all ⇒ Object
5
6
7
|
# File 'lib/fragmentary/request_queue.rb', line 5
def self.all
@@all ||= []
end
|
Instance Method Details
#<<(request) ⇒ Object
21
22
23
24
25
26
|
# File 'lib/fragmentary/request_queue.rb', line 21
def <<(request)
unless @requests.find{|r| r == request}
@requests << request
end
self
end
|
#clear ⇒ Object
36
37
38
|
# File 'lib/fragmentary/request_queue.rb', line 36
def clear
@requests = []
end
|
#next_request ⇒ Object
32
33
34
|
# File 'lib/fragmentary/request_queue.rb', line 32
def next_request
@requests.shift
end
|
#remove_path(path) ⇒ Object
40
41
42
|
# File 'lib/fragmentary/request_queue.rb', line 40
def remove_path(path)
requests.delete_if{|r| r.path == path}
end
|
#send(**args) ⇒ Object
48
49
50
|
# File 'lib/fragmentary/request_queue.rb', line 48
def send(**args)
sender.start(args)
end
|
#sender ⇒ Object
44
45
46
|
# File 'lib/fragmentary/request_queue.rb', line 44
def sender
@sender ||= Sender.new(self)
end
|
#size ⇒ Object
28
29
30
|
# File 'lib/fragmentary/request_queue.rb', line 28
def size
@requests.size
end
|