requestor 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/requestor.rb +12 -8
  2. 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
- buffer = open(@url + file, 'UserAgent' => 'Ruby-Requestor v0.1').read
21
- @code << buffer
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
- filex = Filex.new(url.sub(/[^\/]$/,'\0/'))
28
- yield(filex)
29
- filex.code.join("\n")
30
+
31
+ @@filex = Filex.new(url)
32
+ yield(@@filex)
33
+ @@filex.code.join("\n")
30
34
  end
31
35
 
32
- end
36
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: requestor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors: []
7
7