Class: ProxyFS::File
- Inherits:
-
Object
- Object
- ProxyFS::File
- Defined in:
- lib/proxyfs.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path) ⇒ File
constructor
A new instance of File.
Constructor Details
#initialize(path) ⇒ File
Returns a new instance of File.
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/proxyfs.rb', line 21 def initialize path @path = path @entry = fs.entry(@path) if Array === @entry @file = @entry[0].new(*@entry[1..(-1)]) elsif Hash === e else @file = @entry end end |
Class Method Details
.binread(name, length = nil, offset = nil) ⇒ Object
49 50 51 52 53 54 |
# File 'lib/proxyfs.rb', line 49 def self.binread name, length=nil, offset=nil f = self.new name f.binmode f.seek offset if offset f.read *([length].compact) end |
.binwrite(name, string, offset = nil) ⇒ Object
56 57 58 59 60 61 |
# File 'lib/proxyfs.rb', line 56 def self.binwrite name, string, offset=nil f = self.new name f.binmode f.seek offset if offset f.write string end |