Class: Lotus::Commands::Generate::Model
- Inherits:
-
Abstract
- Object
- Abstract
- Lotus::Commands::Generate::Model
show all
- Defined in:
- lib/lotus/commands/generate/model.rb
Overview
Instance Attribute Summary collapse
Attributes inherited from Abstract
#options, #target_path
Instance Method Summary
collapse
Methods inherited from Abstract
#template_source_path
#add_mapping, #destroy, #generator, #post_process_templates, #process_templates, #start, #target_path, #template_source_path
Constructor Details
#initialize(options, model_name) ⇒ Model
Returns a new instance of Model.
10
11
12
13
14
15
|
# File 'lib/lotus/commands/generate/model.rb', line 10
def initialize(options, model_name)
super(options)
@model_name = Utils::String.new(model_name).classify
assert_model_name!
end
|
Instance Attribute Details
#model_name ⇒ Object
8
9
10
|
# File 'lib/lotus/commands/generate/model.rb', line 8
def model_name
@model_name
end
|
Instance Method Details
#map_templates ⇒ Object
17
18
19
20
21
22
|
# File 'lib/lotus/commands/generate/model.rb', line 17
def map_templates
add_mapping('entity.rb.tt', entity_path)
add_mapping('repository.rb.tt', repository_path)
add_mapping("entity_spec.#{ test_framework.framework }.tt", entity_spec_path,)
add_mapping("repository_spec.#{ test_framework.framework }.tt", repository_spec_path)
end
|
#template_options ⇒ Object
24
25
26
27
28
|
# File 'lib/lotus/commands/generate/model.rb', line 24
def template_options
{
model_name: model_name
}
end
|