Class: Ganapati::HFile
- Inherits:
-
Object
- Object
- Ganapati::HFile
- Defined in:
- lib/ganapati/hfile.rb
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(client, handle, pathname) ⇒ HFile
constructor
A new instance of HFile.
- #length ⇒ Object
- #read(offset = 0, size = nil) ⇒ Object
- #stat ⇒ Object
- #write(data) ⇒ Object
Constructor Details
#initialize(client, handle, pathname) ⇒ HFile
Returns a new instance of HFile.
4 5 6 7 8 |
# File 'lib/ganapati/hfile.rb', line 4 def initialize(client, handle, pathname) @client = client @handle = handle @pathname = pathname end |
Instance Method Details
#close ⇒ Object
19 20 21 |
# File 'lib/ganapati/hfile.rb', line 19 def close call :close end |
#length ⇒ Object
27 28 29 |
# File 'lib/ganapati/hfile.rb', line 27 def length stat.length end |
#read(offset = 0, size = nil) ⇒ Object
14 15 16 17 |
# File 'lib/ganapati/hfile.rb', line 14 def read(offset=0, size=nil) size ||= stat.length call :read, offset, size end |
#stat ⇒ Object
23 24 25 |
# File 'lib/ganapati/hfile.rb', line 23 def stat @client.stat(@pathname) end |
#write(data) ⇒ Object
10 11 12 |
# File 'lib/ganapati/hfile.rb', line 10 def write(data) call :write, data end |