2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'app/services/peak_flow_utils/handlers_finder_service.rb', line 2
def perform
handlers = []
Dir.foreach("#{__dir__}/../../handlers/peak_flow_utils") do |file|
match = file.match(/\A(.+)_handler\.rb\Z/)
next unless match
const_name_snake = "#{match[1]}_handler"
next if const_name_snake == "application_handler"
const_name_camel = const_name_snake.camelize
handler = PeakFlowUtils::HandlerHelper.new(
id: const_name_snake,
const_name: const_name_camel,
name: const_name_camel
)
handlers << handler if handler.instance.enabled?
end
succeed! handlers
end
|