drb_fileclient 0.1.2 → 0.2.0

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
  SHA1:
3
- metadata.gz: dd42ee37f23b6f28962588e4dfa95dc0ef8e4005
4
- data.tar.gz: 6b1cdd9efeef6bdbe3dec07560b8f0166131c4f6
3
+ metadata.gz: 2acd6009e3a7703f659abb25bfa4ec482669bede
4
+ data.tar.gz: 58e4aa65be961f907f19c8ba5bcf9476b0351bce
5
5
  SHA512:
6
- metadata.gz: 8320a5af00cba74b7b80c81bcb923f5fca71f52edff4d1ca39dfb26c99b3a2fee455b2715a0843e0908a1e9640bed6d424196c60fd8d6a11862ddb0bd83e4a80
7
- data.tar.gz: db432841ae94d179afbc39b595f6140a829311f709a24ef2f542b8980a586eff805cae24f965b81fa47dfa742011a03c64bec28bd7bcbf1736887b27999f5cf2
6
+ metadata.gz: 01dd234914af6e493790eeb66787fbcca94278cd27bf0a4942bf8f5619c99ae7d345122adbf1b909fccb1b8082d93288e4cbe3215c71340f807b207102b70ebd
7
+ data.tar.gz: 03aaf68ad10862a095409a1080f44e3c35d85897cd25c816c58d90de7a8c2d9ccbe3598ed6302bdbb3265c8a22d441fa4186b269bb74d502d5d6cffde2dfc72e
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -24,9 +24,32 @@ class DRbFileClient
24
24
 
25
25
  end
26
26
 
27
- def exists?(filename=@filename)
27
+ def exists?(filename=@filename)
28
+
29
+ filename2 = parse_path(filename)
30
+ @file.exists? filename2
31
+
32
+ end
33
+
34
+ def read(filename=@filename)
35
+
36
+ filename2 = parse_path(filename)
37
+ @file.read filename2
38
+
39
+ end
28
40
 
29
- filename2 = if @file then
41
+ def write(filename=@filename, s)
42
+
43
+ filename2 = parse_path(filename)
44
+ @file.write filename2, s
45
+
46
+ end
47
+
48
+ private
49
+
50
+ def parse_path(filename)
51
+
52
+ if @file then
30
53
 
31
54
  filename
32
55
 
@@ -38,22 +61,24 @@ class DRbFileClient
38
61
  @file = DRbObject.new nil, "druby://#{host}:#{port}"
39
62
  filename[/(?<=^dfs:\/\/)[^\/]+\/(.*)/,1]
40
63
 
41
- end
42
-
43
- @file.exists? filename2
64
+ end
44
65
 
45
66
  end
46
67
 
47
- def read(filename=@filename)
48
-
49
- @file.read filename
50
-
68
+ end
69
+
70
+ class DfsFile
71
+
72
+ def self.exists?(filename)
73
+ DRbFileClient.new(filename).exists?
51
74
  end
52
75
 
53
- def write(filename=@filename, s)
54
-
55
- @file.write filename, s
56
-
57
- end
58
-
59
- end
76
+ def self.read(filename)
77
+ DRbFileClient.new.read(filename)
78
+ end
79
+
80
+ def self.write(filename, s)
81
+ DRbFileClient.new.write(filename, s)
82
+ end
83
+
84
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drb_fileclient
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -30,7 +30,7 @@ cert_chain:
30
30
  2aIZ9lf6/AT4LP07t9jB5oYLHlr2nBLIqtPXdJvg5RKKr79CQVmpJ5LCTjwTg9h+
31
31
  g1Q=
32
32
  -----END CERTIFICATE-----
33
- date: 2018-05-25 00:00:00.000000000 Z
33
+ date: 2018-05-26 00:00:00.000000000 Z
34
34
  dependencies: []
35
35
  description:
36
36
  email: james@jamesrobertson.eu
@@ -62,5 +62,6 @@ rubyforge_project:
62
62
  rubygems_version: 2.6.13
63
63
  signing_key:
64
64
  specification_version: 4
65
- summary: Reads or writes files from a remote DRb server.
65
+ summary: Reads or writes files from a remote DRb server. Simple as DfsFile.read or
66
+ DfsFile.write.
66
67
  test_files: []
metadata.gz.sig CHANGED
Binary file