Class: Cldr::Export::Yaml

Inherits:
Object
  • Object
show all
Defined in:
lib/cldr/export/yaml.rb

Instance Method Summary collapse

Instance Method Details

#export(locale, component, options = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/cldr/export/yaml.rb', line 7

def export(locale, component, options = {})
  data = Export.data(component, locale, options)
  unless data.empty?
    data = data.deep_stringify_keys if data.respond_to?(:deep_stringify_keys)
    data = { locale.to_s.gsub('_', '-') => data } if locale != ""
    path = Export.path(locale, component, 'yml')
    Export.write(path, yaml(data))
    yield(component, locale, path) if block_given?
    data
  end
end

#yaml(data) ⇒ Object



19
20
21
# File 'lib/cldr/export/yaml.rb', line 19

def yaml(data)
   data.to_yaml
end