drb_fileclient-reader 0.1.0 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b797dddda2374d573b8b603c02dfe803c7ee53dfcfb19cc08d42f3b9eed37e3a
4
- data.tar.gz: 37509d00836c959bd30e03f43b7d79b9576c8d8c061063d1faf44d4fa6f0afe3
3
+ metadata.gz: 9ba32fab7b6cbe1adeb3e5f8e81a200baa6c4252b5e9baf94ecd21b64137cc8a
4
+ data.tar.gz: 584af5bfc10500b5c5f84335bf563e2f2bc9b6f78bcad58388f2591068673efb
5
5
  SHA512:
6
- metadata.gz: 5537d2d6d397592be2e472e1140ace64e70ad4ef6a1f08c226dad60803301ad684a5fe0373a5cab89649a3df6a64b3c7014be2c556d10eb4f24440866c9a86a5
7
- data.tar.gz: 63a0dd507a3d19b8988312475d621ea28a66a027ec1503a74ecb3e44ebdd09a63c62c04ca341c1c1916c0884490ebd3e632d237cdc71d2bf9a7662059afa0bbe
6
+ metadata.gz: 3d6335a539b05b53bf5523d260bd9418e48e7836d9de702179f1bece7921e93389072a809ccaf0ce5996cd2cb4d9066d7836e7872731c3fc98ff60b4a50c2086
7
+ data.tar.gz: 4f075865e34157b5a1214fbac8e863aa968d602206b07d5e93c4aaa838039c958ed03eab42fb23852acc41e8d2017a3118d25e87a9ecf8d10c045856345ad39c
checksums.yaml.gz.sig CHANGED
Binary file
@@ -10,58 +10,59 @@ class DRbFileClientReader
10
10
  using ColouredText
11
11
 
12
12
  def initialize(location=nil, host: nil, port: '61010', debug: false)
13
-
13
+
14
14
  @debug = debug
15
-
15
+
16
16
  if location then
17
-
17
+
18
18
  host = location[/(?<=^dfs:\/\/)[^\/:]+/]
19
19
  port = location[/(?<=^dfs:\/\/)[^:]+:(\d+)/,1] || '61010'
20
- @directory = location[/(?<=^dfs:\/\/)[^\/]+\/(.*)/,1]
21
-
20
+ @@directory ||= location[/(?<=^dfs:\/\/)[^\/]+\/(.*)/,1]
21
+ else
22
+ @@directory ||= nil
22
23
  end
23
-
24
+
24
25
  DRb.start_service
25
-
26
+
26
27
  end
27
-
28
- def exists?(filename=@filename)
29
-
30
- return File.exists? filename unless @directory or filename =~ /^dfs:\/\//
31
-
28
+
29
+ def exists?(filename=@@filename)
30
+
31
+ return File.exists? filename unless @@directory or filename =~ /^dfs:\/\//
32
+
32
33
  if filename =~ /^dfs:\/\// then
33
- @file, filename2 = parse_path(filename)
34
+ @@file, filename2 = parse_path(filename)
34
35
  else
35
36
 
36
- filename2 = File.join(@directory, filename)
37
+ filename2 = File.join(@@directory, filename)
37
38
  end
38
39
 
39
- @file.exists?(filename2)
40
-
40
+ @@file.exists?(filename2)
41
+
41
42
  end
42
-
43
+
43
44
  alias exist? exists?
44
45
 
45
- def read(filename=@filename)
46
-
47
- return File.read filename, s unless @directory or filename =~ /^dfs:\/\//
48
-
46
+ def read(filename=@@filename)
47
+
48
+ return File.read(filename) unless @@directory or filename =~ /^dfs:\/\//
49
+
49
50
  if filename =~ /^dfs:\/\// then
50
- @file, path = parse_path(filename)
51
+ @@file, path = parse_path(filename)
51
52
  else
52
- path = File.join(@directory, filename)
53
+ path = File.join(@@directory, filename)
53
54
  end
54
-
55
- @file.read path
55
+
56
+ @@file.read path
56
57
  end
57
-
58
+
58
59
  protected
59
-
60
+
60
61
  def parse_path(filename)
61
62
 
62
63
  host = filename[/(?<=^dfs:\/\/)[^\/:]+/]
63
64
  @host = host if host
64
-
65
+
65
66
  port = filename[/(?<=^dfs:\/\/)[^:]+:(\d+)/,1] || '61010'
66
67
 
67
68
  file_server = DRbObject.new nil, "druby://#{host || @host}:#{port}"
@@ -69,14 +70,13 @@ class DRbFileClientReader
69
70
 
70
71
  end
71
72
 
72
- end
73
+ end
73
74
 
74
75
  class DfsFile
75
-
76
+
76
77
  @client = DRbFileClientReader.new
77
-
78
- def self.exists?(filename) @client.exists?(filename) end
78
+
79
+ def self.exists?(filename) @client.exists?(filename) end
79
80
  def self.read(filename) @client.read(filename) end
80
-
81
- end
82
81
 
82
+ end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drb_fileclient-reader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  im+YlEcJfPax42Av6oEBmm6oUqxICcrKX8DdDuNFC44LAC66kmOdMTNiVdeS82BG
36
36
  CGf+32hX61V/Gw6Jiazh7a6L
37
37
  -----END CERTIFICATE-----
38
- date: 2022-02-21 00:00:00.000000000 Z
38
+ date: 2022-02-24 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: c32
metadata.gz.sig CHANGED
Binary file