Class: Localer::Parser

Inherits:
Service show all
Defined in:
lib/localer/parser.rb

Overview

Parse translations into hash: key: translation key value: hash of locale values

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Service

call, new

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



11
12
13
# File 'lib/localer/parser.rb', line 11

def data
  @data
end

#localesObject (readonly)

Returns the value of attribute locales.



11
12
13
# File 'lib/localer/parser.rb', line 11

def locales
  @locales
end

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/localer/parser.rb', line 13

def call
  @data = {}
  @locales = []
  @translations.each do |(locale, translation)|
    @locales.push locale
    compare(locale, translation)
  end

  self
end