Class: GitMQ::Producer
- Inherits:
-
Object
- Object
- GitMQ::Producer
- Defined in:
- lib/producer.rb
Instance Method Summary collapse
-
#initialize(storage:, branch:) ⇒ Producer
constructor
A new instance of Producer.
- #publish(event) ⇒ Object
Constructor Details
#initialize(storage:, branch:) ⇒ Producer
Returns a new instance of Producer.
5 6 7 8 |
# File 'lib/producer.rb', line 5 def initialize(storage:, branch:) @storage = storage @branch = branch end |
Instance Method Details
#publish(event) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/producer.rb', line 10 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 |