Class: Localer::Data

Inherits:
Object
  • Object
show all
Extended by:
Dry::Initializer
Defined in:
lib/localer/data.rb,
lib/localer/data/checker.rb,
lib/localer/data/service.rb,
lib/localer/data/processor.rb,
lib/localer/data/missing_translations.rb

Overview

Stores translations and provides check methods

Defined Under Namespace

Classes: Checker, MissingTranslations, Processor, Service

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Data

Returns a new instance of Data.



18
19
20
21
# File 'lib/localer/data.rb', line 18

def initialize(*args)
  super
  @locales, @translations = Processor.call(source, config)
end

Instance Attribute Details

#localesObject (readonly)

Returns the value of attribute locales.



16
17
18
# File 'lib/localer/data.rb', line 16

def locales
  @locales
end

#translationsObject (readonly)

Returns the value of attribute translations.



16
17
18
# File 'lib/localer/data.rb', line 16

def translations
  @translations
end

Instance Method Details

#complete?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/localer/data.rb', line 23

def complete?
  Checker.call(self)
end

#eachObject



31
32
33
34
35
36
37
# File 'lib/localer/data.rb', line 31

def each
  @translations.each do |key, value|
    @locales.each do |locale|
      yield locale, key, value[locale]
    end
  end
end

#missing_translationsObject



27
28
29
# File 'lib/localer/data.rb', line 27

def missing_translations
  MissingTranslations.call(self)
end