Sha256: 88034d1c47f7f810f15365f88ef8acb31869980eb461f1057a17bbe673899780

Contents?: true

Size: 737 Bytes

Versions: 8

Compression:

Stored size: 737 Bytes

Contents

class AwesomeTranslations::Handlers
  AutoAutoloader.autoload_sub_classes(self, __FILE__)

  def self.list
    unless @handlers
      @handlers = []

      Dir.foreach("#{File.dirname(__FILE__)}/handlers") do |file|
        match = file.match(/\A(.+)_handler\.rb\Z/)
        next unless match

        const_name_snake = "#{match[1]}_handler"
        next if const_name_snake == "base_handler"

        const_name_camel = StringCases.snake_to_camel(const_name_snake)

        handler = AwesomeTranslations::Handler.new(
          id: const_name_snake,
          const_name: const_name_camel,
          name: const_name_camel
        )

        @handlers << handler if handler.instance.enabled?
      end
    end

    @handlers
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
awesome_translations-0.0.66 lib/awesome_translations/handlers.rb
awesome_translations-0.0.65 lib/awesome_translations/handlers.rb
awesome_translations-0.0.64 lib/awesome_translations/handlers.rb
awesome_translations-0.0.63 lib/awesome_translations/handlers.rb
awesome_translations-0.0.62 lib/awesome_translations/handlers.rb
awesome_translations-0.0.61 lib/awesome_translations/handlers.rb
awesome_translations-0.0.60 lib/awesome_translations/handlers.rb
awesome_translations-0.0.59 lib/awesome_translations/handlers.rb