Sha256: 719aaa7d2bbaa0b96b5be0d08f3f615eb972c9fd014ef89cbe371732a8e6487a
Contents?: true
Size: 936 Bytes
Versions: 2
Compression:
Stored size: 936 Bytes
Contents
require 'erb' module Xcmultilingual class Writer attr_accessor :name, :verbose def initialize(destination, bundle_data) @destination = destination @bundle_data = bundle_data @filename = File.basename(@destination) end def write puts "+ START UPDATING\n\n" if @verbose if !File.exist?("#{@destination}") puts " There is no destination file." if @verbose puts "\n+ FAILED UPDATING\n" if @verbose return end File.open("#{@destination}", "w") do |file| template_file = templates_file(default_templates_dir) body = ERB.new(File.open(template_file).read, nil, '-').result(binding) file.write(body) end puts "+ END UPDATING\n\n" if @verbose end private def default_templates_dir File.dirname(__FILE__) + '/templates' end def templates_file(dir) dir + "/swift.erb" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
xcmultilingual-0.1.1 | lib/xcmultilingual/writer.rb |
xcmultilingual-0.1.0 | lib/xcmultilingual/writer.rb |