Sha256: a50799245ee9041202fcfeb3d6d8a207e5ceb9ac0a5628f175a804f507d36760

Contents?: true

Size: 442 Bytes

Versions: 1

Compression:

Stored size: 442 Bytes

Contents

# frozen_string_literal: true

module GitMQueue
  class Consumer
    def initialize(storage:, name:, branch:)
      @storage = storage
      @branch = branch
      @name = name
      @label = "#{branch}.#{name}"
    end

    def consume(&block)
      @storage.wait_branch @branch

      loop do
        commit = @storage.poll(@branch, @label)
        block.call commit.message
        @storage.tag(@label, commit)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gitmqueue-0.1.0 lib/consumer.rb