drb_fileclient-reader 0.1.0 → 0.1.1

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: 796d5ead48abdc86df36327ef871c60888edacf8410b018cc33da018534ceec3
4
+ data.tar.gz: 63d268060def89e5e1636e715dc4c70448d53454773bbc0441c28bae00542306
5
5
  SHA512:
6
- metadata.gz: 5537d2d6d397592be2e472e1140ace64e70ad4ef6a1f08c226dad60803301ad684a5fe0373a5cab89649a3df6a64b3c7014be2c556d10eb4f24440866c9a86a5
7
- data.tar.gz: 63a0dd507a3d19b8988312475d621ea28a66a027ec1503a74ecb3e44ebdd09a63c62c04ca341c1c1916c0884490ebd3e632d237cdc71d2bf9a7662059afa0bbe
6
+ metadata.gz: 624ff5f12bfb4e68643f789ba209aac93e97d53b6125b9c52dba377f7cc190310cd1992156a2ec5cabca5ff4da60daa9276c64a5230bde12213985c9320a57db
7
+ data.tar.gz: d48b60175b550cbb0f23212d14705b226a9d369ad35cf58f7359a1222414a375b9df124f0909a780eaecd165065aa05f5e2d7d9ce0bbea0ceecca48527af1a53
checksums.yaml.gz.sig CHANGED
Binary file
@@ -10,58 +10,58 @@ 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
+
22
22
  end
23
-
23
+
24
24
  DRb.start_service
25
-
25
+
26
26
  end
27
-
28
- def exists?(filename=@filename)
29
-
30
- return File.exists? filename unless @directory or filename =~ /^dfs:\/\//
31
-
27
+
28
+ def exists?(filename=@@filename)
29
+
30
+ return File.exists? filename unless @@directory or filename =~ /^dfs:\/\//
31
+
32
32
  if filename =~ /^dfs:\/\// then
33
- @file, filename2 = parse_path(filename)
33
+ @@file, filename2 = parse_path(filename)
34
34
  else
35
35
 
36
- filename2 = File.join(@directory, filename)
36
+ filename2 = File.join(@@directory, filename)
37
37
  end
38
38
 
39
- @file.exists?(filename2)
40
-
39
+ @@file.exists?(filename2)
40
+
41
41
  end
42
-
42
+
43
43
  alias exist? exists?
44
44
 
45
- def read(filename=@filename)
46
-
47
- return File.read filename, s unless @directory or filename =~ /^dfs:\/\//
48
-
45
+ def read(filename=@@filename)
46
+
47
+ return File.read filename, s unless @@directory or filename =~ /^dfs:\/\//
48
+
49
49
  if filename =~ /^dfs:\/\// then
50
- @file, path = parse_path(filename)
50
+ @@file, path = parse_path(filename)
51
51
  else
52
- path = File.join(@directory, filename)
52
+ path = File.join(@@directory, filename)
53
53
  end
54
-
55
- @file.read path
54
+
55
+ @@file.read path
56
56
  end
57
-
57
+
58
58
  protected
59
-
59
+
60
60
  def parse_path(filename)
61
61
 
62
62
  host = filename[/(?<=^dfs:\/\/)[^\/:]+/]
63
63
  @host = host if host
64
-
64
+
65
65
  port = filename[/(?<=^dfs:\/\/)[^:]+:(\d+)/,1] || '61010'
66
66
 
67
67
  file_server = DRbObject.new nil, "druby://#{host || @host}:#{port}"
@@ -69,14 +69,13 @@ class DRbFileClientReader
69
69
 
70
70
  end
71
71
 
72
- end
72
+ end
73
73
 
74
74
  class DfsFile
75
-
75
+
76
76
  @client = DRbFileClientReader.new
77
-
78
- def self.exists?(filename) @client.exists?(filename) end
77
+
78
+ def self.exists?(filename) @client.exists?(filename) end
79
79
  def self.read(filename) @client.read(filename) end
80
-
81
- end
82
80
 
81
+ 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.1
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-23 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: c32
metadata.gz.sig CHANGED
Binary file