Sha256: 9e897b3c1f500ec17cd253036d21539dbeb9ed0783dc6ef254d49a89ef59c77d

Contents?: true

Size: 445 Bytes

Versions: 2

Compression:

Stored size: 445 Bytes

Contents

# frozen_string_literal: true

module GitMQ
  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

2 entries across 2 versions & 1 rubygems

Version Path
gitmq-0.1.3 lib/producer.rb
gitmq-0.1.2 lib/producer.rb