Sha256: 1f8102fdf7b10c25735a3e48d547bf1a2c8e54e942824ea379d0258cf0fab490

Contents?: true

Size: 551 Bytes

Versions: 7

Compression:

Stored size: 551 Bytes

Contents

module Ganapati
  
  class HFile
    def initialize(client, handle, pathname)
      @client = client
      @handle = handle
      @pathname = pathname
    end

    def write(data)
      call :write, data
    end

    def read(offset=0, size=nil)
      size ||= stat.length
      call :read, offset, size
    end

    def close
      call :close
    end

    def stat
      @client.stat(@pathname)
    end

    def length
      stat.length
    end

    private
    def call(method, *args)
      @client.send method, @handle, *args
    end  
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ganapati-0.0.7 lib/ganapati/hfile.rb
ganapati-0.0.6 lib/ganapati/hfile.rb
ganapati-0.0.5 lib/ganapati/hfile.rb
ganapati-0.0.4 lib/ganapati/hfile.rb
ganapati-0.0.3 lib/ganapati/hfile.rb
ganapati-0.0.2 lib/ganapati/hfile.rb
ganapati-0.0.1 lib/ganapati/hfile.rb