Class: GitMQ::Consumer

Inherits:
Object
  • Object
show all
Defined in:
lib/consumer.rb

Instance Method Summary collapse

Constructor Details

#initialize(storage:, name:, branch:) ⇒ Consumer

Returns a new instance of Consumer.



7
8
9
10
11
# File 'lib/consumer.rb', line 7

def initialize(storage:, name:, branch:)
  @storage = storage
  @branch = branch
  @name = name
end

Instance Method Details

#branch_fileObject



13
14
15
# File 'lib/consumer.rb', line 13

def branch_file
  @branch_file ||= File.join(@storage.path, 'refs', 'heads')
end

#consume(&block) ⇒ Object



17
18
19
20
21
# File 'lib/consumer.rb', line 17

def consume(&block)
  @block = block
  consume_commits
  listener.start
end

#stopObject



23
24
25
# File 'lib/consumer.rb', line 23

def stop
  listener.stop
end