Sha256: 038f1faf53ad9827d65005c78a24a24980a8c62c6a180171c7d2d7465d269c72

Contents?: true

Size: 449 Bytes

Versions: 3

Compression:

Stored size: 449 Bytes

Contents

# frozen_string_literal: true

module GitMQueue
  class Producer
    def initialize(storage:, branch:)
      @storage = storage
      @branch = branch
    end

    def publish(event)
      commit = Rugged::Commit.create(
        @storage.repo,
        tree: @storage.tree,
        message: event.to_s,
        parents: [@storage.branch(@branch)&.target].compact
      )
      @storage.branches.create(@branch, commit, force: true)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gitmqueue-0.1.2 lib/producer.rb
gitmqueue-0.1.1 lib/producer.rb
gitmqueue-0.1.0 lib/producer.rb