class Translator::YamlFileFlattener

Attributes

paths[R]
result[R]

Public Class Methods

new(paths) click to toggle source
# File lib/translator/yaml_file_flattener.rb, line 7
def initialize(paths)
  @paths = paths
  @result = Hash.new { |hash, key| hash[key] = {} }
end

Public Instance Methods

process() click to toggle source
# File lib/translator/yaml_file_flattener.rb, line 12
def process
  paths.each do |path|
    load_file(path) do |lang, data|
      result[lang].merge!(data)
    end
  end
  result
end

Private Instance Methods

load_file(path) { |lang, data| ... } click to toggle source
# File lib/translator/yaml_file_flattener.rb, line 22
def load_file(path)
  YAML.load_file(path).each { |lang, data| yield(lang, data) }
end