Class: Shaf::Generator::Scaffold

Inherits:
Base
  • Object
show all
Defined in:
lib/shaf/generator/scaffold.rb

Instance Attribute Summary

Attributes inherited from Base

#args, #options

Instance Method Summary collapse

Methods inherited from Base

identified_by, identifier, #identifier, inherited, #initialize, options, usage

Constructor Details

This class inherits a constructor from Shaf::Generator::Base

Instance Method Details

#callObject



8
9
10
11
12
13
14
# File 'lib/shaf/generator/scaffold.rb', line 8

def call
  check_name_arg!

  options[:specs] = true if options[:specs].nil? 
  Generator::Factory.create('model', *args, **options).call
  Generator::Factory.create('controller', *args, **options).call
end

#check_name_arg!Object



16
17
18
19
20
21
# File 'lib/shaf/generator/scaffold.rb', line 16

def check_name_arg!
  return if args.first && !args.first.empty?

  raise Command::ArgumentError,
    "Please provide a name when using the scaffold generator!"
end