Sha256: 2812e837e87950b811b860e4471940aeb2b1a6a83b4f0abcdaeb25b4086c2792

Contents?: true

Size: 365 Bytes

Versions: 1

Compression:

Stored size: 365 Bytes

Contents

class Baza::Driver::Tiny::Result < Baza::ResultBase
  def initialize(result)
    @result = result.to_a
  end

  def each(&blk)
    enum.each(&blk)
  end

  def fetch
    enum.next
  rescue StopIteration
    nil
  end

private

  def enum
    @enum ||= Enumerator.new do |yielder|
      @result.each do |result|
        yielder << result
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
baza-0.0.36 lib/baza/driver/tiny/result.rb