Class: CrudGenerator
- Inherits:
-
Object
- Object
- CrudGenerator
- Defined in:
- lib/scaffolding/crud_generator.rb
Constant Summary collapse
- ACTIONS =
%w[list create detail edit].freeze
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(base_name, scaffolding_class, config_loader) ⇒ CrudGenerator
constructor
A new instance of CrudGenerator.
- #planned_files ⇒ Object
Constructor Details
#initialize(base_name, scaffolding_class, config_loader) ⇒ CrudGenerator
Returns a new instance of CrudGenerator.
8 9 10 11 12 |
# File 'lib/scaffolding/crud_generator.rb', line 8 def initialize(base_name, scaffolding_class, config_loader) @base_name = NameNormalizer.normalize(base_name) @scaffolding_class = scaffolding_class @config_loader = config_loader end |
Instance Method Details
#generate ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/scaffolding/crud_generator.rb', line 14 def generate generated = [] ACTIONS.each do |action| name = "#{@base_name}_#{action}" generate_page(name) generate_test(name) generated << name end generate_model generated end |
#planned_files ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/scaffolding/crud_generator.rb', line 26 def planned_files files = [] ACTIONS.each do |action| name = "#{@base_name}_#{action}" files << "page_objects/pages/#{name}.rb" files << test_path(name) end files << "models/data/#{@base_name}.yml" files end |