Class: AdLocalize::Platform::YmlFormatter

Inherits:
PlatformFormatter show all
Defined in:
lib/ad_localize/platform/yml_formatter.rb

Constant Summary

Constants inherited from PlatformFormatter

PlatformFormatter::OPTIONS, PlatformFormatter::PLURAL_KEY_SYMBOL, PlatformFormatter::SINGULAR_KEY_SYMBOL

Instance Attribute Summary

Attributes inherited from PlatformFormatter

#add_intermediate_platform_dir, #default_locale, #output_path, #platform_dir

Instance Method Summary collapse

Methods inherited from PlatformFormatter

#initialize

Constructor Details

This class inherits a constructor from AdLocalize::Platform::PlatformFormatter

Instance Method Details

#export(locale, data, export_extension = "yml", substitution_format = "yml") ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/ad_localize/platform/yml_formatter.rb', line 7

def export(locale, data, export_extension = "yml", substitution_format = "yml")
  locale = locale.to_sym
  yml_data = build_platform_data_splitting_on_dots(locale, data)

  platform_dir.join("#{locale.to_s}.#{export_extension}").open("w") do |file|
    file.puts yml_data.to_yaml
  end

  AdLocalize::LOGGER.log(:debug, :green, "YAML [#{locale}] ---> DONE!")
end

#platformObject



3
4
5
# File 'lib/ad_localize/platform/yml_formatter.rb', line 3

def platform
  :yml
end