Sha256: 1ab0620bb978eb3095dcfc0dfd4c00d3915f6d6b30bfb8cca1676caeca68c43e

Contents?: true

Size: 850 Bytes

Versions: 2

Compression:

Stored size: 850 Bytes

Contents

class AwesomeTranslations::Handlers::GlobalHandler < AwesomeTranslations::Handlers::BaseHandler
  def groups
    ArrayEnumerator.new do |yielder|
      yielder << AwesomeTranslations::Group.new(
        id: "global",
        handler: self,
        data: {
          name: "Global translations"
        }
      )
    end
  end

  def translations_for_group(group)
    ArrayEnumerator.new do |yielder|
      translations_found = {}

      erb_inspector = AwesomeTranslations::ErbInspector.new
      erb_inspector.files.each do |file|
        file.translations.each do |translation|
          next if translation.key.start_with?(".")

          unless translations_found.key?(translation.full_key)
            translations_found[translation.full_key] = true
            yielder << translation.model
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
awesome_translations-0.0.3 lib/awesome_translations/handlers/global_handler.rb
awesome_translations-0.0.2 lib/awesome_translations/handlers/global_handler.rb