Class: TypedOperationGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- TypedOperationGenerator
- Defined in:
- lib/generators/typed_operation_generator.rb
Overview
Rails generator for creating new typed operation files and their tests.
Instance Method Summary collapse
Instance Method Details
#generate_operation ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/generators/typed_operation_generator.rb', line 11 def generate_operation source_root = self.class.source_root operation_path = [:path] template( File.join(source_root, "operation.rb"), File.join(operation_path, "#{file_name}.rb") ) template( File.join(source_root, "operation_test.rb"), File.join("test/", operation_path.gsub(/\Aapp\//, ""), "#{file_name}_test.rb") ) end |