Sha256: 1b0d199c54213111426b63122d2c2e7d4ac3a1a91c7d9e18a85b8d41a7e77fe4

Contents?: true

Size: 605 Bytes

Versions: 5

Compression:

Stored size: 605 Bytes

Contents

module HBaseRb
  
  class Scanner
    def initialize(client, scanner_id)
      @client = client
      @sid = scanner_id
      if block_given?
        n = next_row
        while n.length > 0
          yield n.first
          n = next_row
        end        
        close
      end
    end

    def next_row
      call :scannerGet
    end

    def close
      call :scannerClose
    end

    def each 
      n = next_row
      while n.length > 0
        yield n.first
        n = next_row
      end
    end

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

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hbaserb-0.0.5 lib/hbaserb/scanner.rb
hbaserb-0.0.4 lib/hbaserb/scanner.rb
hbaserb-0.0.3 lib/hbaserb/scanner.rb
hbaserb-0.0.2 lib/hbaserb/scanner.rb
hbaserb-0.0.1 lib/hbaserb/scanner.rb