Sha256: e03c0afce582e94f2717e3eb31a5c6db42dea6eea3ae0defb9186c54d7f0e565

Contents?: true

Size: 682 Bytes

Versions: 6

Compression:

Stored size: 682 Bytes

Contents

class PeakFlowUtils::HandlersFinderService < PeakFlowUtils::ApplicationService
  def execute
    handlers = []

    Dir.foreach("#{File.dirname(__FILE__)}/../../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

6 entries across 6 versions & 1 rubygems

Version Path
peak_flow_utils-0.1.12 app/services/peak_flow_utils/handlers_finder_service.rb
peak_flow_utils-0.1.11 app/services/peak_flow_utils/handlers_finder_service.rb
peak_flow_utils-0.1.10 app/services/peak_flow_utils/handlers_finder_service.rb
peak_flow_utils-0.1.9 app/services/peak_flow_utils/handlers_finder_service.rb
peak_flow_utils-0.1.8 app/services/peak_flow_utils/handlers_finder_service.rb
peak_flow_utils-0.1.7 app/services/peak_flow_utils/handlers_finder_service.rb