Class: PresenterGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- PresenterGenerator
- Defined in:
- lib/generators/presenter/presenter_generator.rb
Instance Method Summary collapse
Instance Method Details
#create_presenter_file ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/generators/presenter/presenter_generator.rb', line 7 def create_presenter_file path = "app/presenters/#{file_name}_presenter.rb" if FileTest.exist? path raise FileExistError, "This filename ist used by another presenter:#{path}" end copy_file "presenter_template.rb", path replace_class_name path replace_singular_name path end |
#create_presenter_test_file ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/generators/presenter/presenter_generator.rb', line 18 def create_presenter_test_file path = "test/presenters/#{file_name}_presenter_test.rb" if FileTest.exist? path raise FileExistError, "This filename ist used by another PresenterTest:#{path}" end copy_file "presenter_test_template.rb", path replace_class_name path end |