Class: RobotLab::Generators::RobotGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- RobotLab::Generators::RobotGenerator
- Defined in:
- lib/generators/robot_lab/robot_generator.rb
Overview
Generates a new RobotLab robot
Usage:
rails generate robot_lab:robot NAME [options]
Examples:
rails generate robot_lab:robot Support
rails generate robot_lab:robot Billing --description="Handles billing queries"
Instance Method Summary collapse
-
#create_robot_file ⇒ void
Creates the robot class file.
-
#create_test_file ⇒ void
Creates the robot test file.
Instance Method Details
#create_robot_file ⇒ void
This method returns an undefined value.
Creates the robot class file.
29 30 31 32 33 34 35 |
# File 'lib/generators/robot_lab/robot_generator.rb', line 29 def create_robot_file if [:routing] template "routing_robot.rb.tt", "app/robots/#{file_name}_robot.rb" else template "robot.rb.tt", "app/robots/#{file_name}_robot.rb" end end |
#create_test_file ⇒ void
This method returns an undefined value.
Creates the robot test file.
40 41 42 |
# File 'lib/generators/robot_lab/robot_generator.rb', line 40 def create_test_file template "robot_test.rb.tt", "test/robots/#{file_name}_robot_test.rb" end |