Class: Ows::Query::Generators::CreateGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Ows::Query::Generators::CreateGenerator
- Defined in:
- lib/generators/ows/query/create/create_generator.rb
Instance Method Summary collapse
- #create_query ⇒ Object
-
#initialize(args, *_options) ⇒ CreateGenerator
constructor
A new instance of CreateGenerator.
Constructor Details
#initialize(args, *_options) ⇒ CreateGenerator
Returns a new instance of CreateGenerator.
11 12 13 14 15 16 |
# File 'lib/generators/ows/query/create/create_generator.rb', line 11 def initialize(args, *) super @query_name = args[0].camelize @model_name = args[1].camelize end |
Instance Method Details
#create_query ⇒ Object
18 19 20 21 22 |
# File 'lib/generators/ows/query/create/create_generator.rb', line 18 def create_query create_file Rails.root.join("app/queries/#{file_name}_query.rb"), sample_file.gsub('{{QUERY_NAME}}', query_name) .gsub('{{MODEL_NAME}}', model_name) end |