Class: DRbFileServer
- Inherits:
-
Object
- Object
- DRbFileServer
- Defined in:
- lib/drb_fileserver_plus.rb
Instance Method Summary collapse
-
#initialize(nodes) ⇒ DRbFileServer
constructor
A new instance of DRbFileServer.
- #read(fname) ⇒ Object
- #write(fname, content) ⇒ Object
Constructor Details
#initialize(nodes) ⇒ DRbFileServer
Returns a new instance of DRbFileServer.
13 14 15 16 |
# File 'lib/drb_fileserver_plus.rb', line 13 def initialize(nodes) @nodes = nodes.map {|x| 'dfs://' + x} @failcount = 0 end |
Instance Method Details
#read(fname) ⇒ Object
18 19 20 21 22 |
# File 'lib/drb_fileserver_plus.rb', line 18 def read(fname) file_op {|f| f.read File.join(@nodes.first, fname) } end |
#write(fname, content) ⇒ Object
24 25 26 27 28 |
# File 'lib/drb_fileserver_plus.rb', line 24 def write(fname, content) file_op {|f| f.write File.join(@nodes.first, fname), content } end |