requestor 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/requestor.rb +12 -8
- metadata +1 -1
data/lib/requestor.rb
CHANGED
@@ -11,22 +11,26 @@ class Requestor
|
|
11
11
|
attr_reader :code
|
12
12
|
|
13
13
|
def initialize(url)
|
14
|
-
@url = url
|
14
|
+
@url = url.sub(/[^\/]$/,'\0/')
|
15
|
+
@names = []
|
15
16
|
@code = []
|
16
17
|
end
|
17
18
|
|
18
19
|
def require(file)
|
19
20
|
file += '.rb' unless file[/\.rb$/]
|
20
|
-
|
21
|
-
|
21
|
+
unless @names.include? file then
|
22
|
+
@names << file
|
23
|
+
@code << open(@url + file, 'UserAgent' => 'Ruby-Requestor v0.1').read
|
24
|
+
end
|
22
25
|
end
|
23
26
|
|
24
27
|
end
|
25
|
-
|
28
|
+
|
26
29
|
def self.read(url)
|
27
|
-
|
28
|
-
|
29
|
-
filex
|
30
|
+
|
31
|
+
@@filex = Filex.new(url)
|
32
|
+
yield(@@filex)
|
33
|
+
@@filex.code.join("\n")
|
30
34
|
end
|
31
35
|
|
32
|
-
end
|
36
|
+
end
|