-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconfig.ru
More file actions
36 lines (28 loc) · 1018 Bytes
/
config.ru
File metadata and controls
36 lines (28 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# frozen_string_literal: true
# An example file that is a part of the acceptance tests for the Hooks framework.
# This can be used as a reference point as it is a working implementation of a Hooks application.
require_relative "lib/hooks"
# Example publisher class that simulates publishing messages
# This class could be literally anything and it is used here to demonstrate how to pass in custom kwargs...
# ... to the Hooks application which later become available in Handlers throughout the application.
class ExamplePublisher
def initialize
@published_messages = []
end
def call(data)
@published_messages << data
puts "Published: #{data.inspect}"
"Message published successfully"
end
def publish(data)
call(data)
end
def messages
@published_messages
end
end
# Create publisher instance
publisher = ExamplePublisher.new
# Create and run the hooks application with custom publisher
app = Hooks.build(config: "./spec/acceptance/config/hooks.yaml", publisher:)
run app