Sha256: c865160a80a36574081368b2d79ad53e5d97b807e3ed6125cfd08e9632ea8821

Contents?: true

Size: 667 Bytes

Versions: 7

Compression:

Stored size: 667 Bytes

Contents

class PeakFlowUtils::HandlersFinderService < PeakFlowUtils::ApplicationService
  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
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
peak_flow_utils-0.1.19 app/services/peak_flow_utils/handlers_finder_service.rb
peak_flow_utils-0.1.18 app/services/peak_flow_utils/handlers_finder_service.rb
peak_flow_utils-0.1.17 app/services/peak_flow_utils/handlers_finder_service.rb
peak_flow_utils-0.1.16 app/services/peak_flow_utils/handlers_finder_service.rb
peak_flow_utils-0.1.15 app/services/peak_flow_utils/handlers_finder_service.rb
peak_flow_utils-0.1.14 app/services/peak_flow_utils/handlers_finder_service.rb
peak_flow_utils-0.1.13 app/services/peak_flow_utils/handlers_finder_service.rb