Sha256: 2801ba947a0d83a8970d3d5fb42267bfbc65646e7b3433d68f4c60dec6ae8214

Contents?: true

Size: 736 Bytes

Versions: 34

Compression:

Stored size: 736 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

34 entries across 34 versions & 1 rubygems

Version Path
awesome_translations-0.0.58 lib/awesome_translations/handlers.rb
awesome_translations-0.0.57 lib/awesome_translations/handlers.rb
awesome_translations-0.0.56 lib/awesome_translations/handlers.rb
awesome_translations-0.0.55 lib/awesome_translations/handlers.rb
awesome_translations-0.0.54 lib/awesome_translations/handlers.rb
awesome_translations-0.0.53 lib/awesome_translations/handlers.rb
awesome_translations-0.0.52 lib/awesome_translations/handlers.rb
awesome_translations-0.0.51 lib/awesome_translations/handlers.rb
awesome_translations-0.0.50 lib/awesome_translations/handlers.rb
awesome_translations-0.0.49 lib/awesome_translations/handlers.rb
awesome_translations-0.0.48 lib/awesome_translations/handlers.rb
awesome_translations-0.0.47 lib/awesome_translations/handlers.rb
awesome_translations-0.0.46 lib/awesome_translations/handlers.rb
awesome_translations-0.0.45 lib/awesome_translations/handlers.rb
awesome_translations-0.0.44 lib/awesome_translations/handlers.rb
awesome_translations-0.0.43 lib/awesome_translations/handlers.rb
awesome_translations-0.0.42 lib/awesome_translations/handlers.rb
awesome_translations-0.0.41 lib/awesome_translations/handlers.rb
awesome_translations-0.0.40 lib/awesome_translations/handlers.rb
awesome_translations-0.0.39 lib/awesome_translations/handlers.rb