Class: InertiaI18n::Converter

Inherits:
Object
  • Object
show all
Defined in:
lib/inertia_i18n/converter.rb

Constant Summary collapse

PLURAL_KEYS =
%w[zero one two few many other].freeze

Instance Method Summary collapse

Constructor Details

#initialize(yaml_data, locale:) ⇒ Converter

Returns a new instance of Converter.



7
8
9
10
11
# File 'lib/inertia_i18n/converter.rb', line 7

def initialize(yaml_data, locale:)
  @yaml_data = yaml_data
  @locale = locale.to_s
  @config = InertiaI18n.configuration
end

Instance Method Details

#convertObject



13
14
15
16
# File 'lib/inertia_i18n/converter.rb', line 13

def convert
  data = @yaml_data[@locale] || {}
  process(data)
end