Class: PolyglotJs::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- PolyglotJs::Generators::InstallGenerator
- Defined in:
- lib/rails/generators/polyglot_js/install/install_generator.rb
Instance Method Summary collapse
Instance Method Details
#copy_empty_files ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rails/generators/polyglot_js/install/install_generator.rb', line 8 def copy_empty_files Dir.foreach("config/locales/") do |filename| if filename.match(/[a-zA-Z]/) name_js = filename.gsub(".yml", ".js.coffee") locale = filename.split(".") locale.delete_at(locale.size - 1) create_file "app/assets/javascripts/locales/#{name_js}" do "window.#{locale.reverse.join('.')} = {}" end end end end |
#initialize_empty_directory ⇒ Object
5 6 7 |
# File 'lib/rails/generators/polyglot_js/install/install_generator.rb', line 5 def initialize_empty_directory empty_directory "app/assets/javascripts/locales" end |