class Locraft::ConstantsGenerator
Public Instance Methods
constant_from(_key)
click to toggle source
# File lib/locraft/generators/constants_generator.rb, line 27 def constant_from(_key) raise NotImplementedError end
constants_keys_with(localizations)
click to toggle source
# File lib/locraft/generators/constants_generator.rb, line 21 def constants_keys_with(localizations) localizations.select(&:valid?).map do |l| { key: l.key, const: constant_from(l.key) } end end
files_header()
click to toggle source
# File lib/locraft/generators/constants_generator.rb, line 31 def files_header Utils.resource_file('macro_files_header.txt') end
files_name()
click to toggle source
# File lib/locraft/generators/constants_generator.rb, line 17 def files_name @config.dev_prefix + @config.macro_file end
write_file_content(file, content)
click to toggle source
# File lib/locraft/generators/constants_generator.rb, line 10 def write_file_content(file, content) File.open(file, 'w+') do |f| f.puts files_header + "\n" f.puts content end end