Class: RubyPipeline::RemoteFile
- Inherits:
-
Object
- Object
- RubyPipeline::RemoteFile
- Includes:
- DRbUndumped
- Defined in:
- lib/remote_file.rb
Instance Method Summary collapse
-
#filename ⇒ Object
we flatten the filesystem out, maybe we shouldnt.
-
#get(buf_size = 8192) ⇒ Object
returns the bytes of the file, buf_size at a time.
-
#initialize(filename) ⇒ RemoteFile
constructor
A new instance of RemoteFile.
Constructor Details
#initialize(filename) ⇒ RemoteFile
Returns a new instance of RemoteFile.
10 11 12 |
# File 'lib/remote_file.rb', line 10 def initialize(filename) @filename = filename end |
Instance Method Details
#filename ⇒ Object
we flatten the filesystem out, maybe we shouldnt
15 16 17 |
# File 'lib/remote_file.rb', line 15 def filename File.basename(@filename) end |
#get(buf_size = 8192) ⇒ Object
returns the bytes of the file, buf_size at a time. dave, thanks for the buffer size suggestion; that just about quadrupled performance
21 22 23 24 25 26 27 |
# File 'lib/remote_file.rb', line 21 def get(buf_size=8192) File.open(@filename) do |f| while buf = f.read(buf_size) yield buf end end end |