Parent

Methods

Files

UbiquoScaffold::TranslationUpdater

Attributes

locales[RW]

(Not documented)

template_path[RW]

(Not documented)

translations_path[RW]

(Not documented)

Public Class Methods

new(template_path) click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_scaffold/lib/ubiquo_scaffold/translation_updater.rb, line 8
 8:     def initialize(template_path)
 9:       @locales = Ubiquo.supported_locales.map(&:to_s)
10:       @template_path = template_path
11:       @translations_path = Rails.root.join('config', 'locales')
12:     end

Public Instance Methods

update_with(file, tpl_file_pattern, b) {|contents, new_model, locale| ...} click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_scaffold/lib/ubiquo_scaffold/translation_updater.rb, line 14
14:     def update_with(file, tpl_file_pattern, b)
15:       @locales.each do |locale|
16:         tpl_file  = @template_path.join(tpl_file_pattern.gsub(/locale/,locale))
17:         orig_file = @translations_path.join(locale, file)
18:         contents  = YAML.load(File.read(orig_file))
19:         new_model = YAML.load(ERB.new(File.read(tpl_file), nil, '-').result(b))
20:         yield contents, new_model, locale
21:         write_yaml(contents, orig_file)
22:       end
23:     end

Disabled; run with $DEBUG to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.