Class: ViewModelGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- ViewModelGenerator
- Defined in:
- lib/generators/view_model_generator.rb
Instance Method Summary collapse
Instance Method Details
#create_view_model_file ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/generators/view_model_generator.rb', line 7 def create_view_model_file path = "app/view_models/#{file_name}.rb" if FileTest.exists? path raise FileExistError, "This filename ist used by another view-model:#{path}" end copy_file 'view_model_template.rb', path replace_class_name path end |
#create_view_model_test_file ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/generators/view_model_generator.rb', line 18 def create_view_model_test_file path = "test/view_models/#{file_name}_view_model_test.rb" if FileTest.exists?path raise FileExistError, "This filename ist used by another view-model test:#{path}" end copy_file "view_model_test_template.rb", path replace_class_name path end |