Class: Alonzo::Commands::Gen
- Inherits:
-
Object
- Object
- Alonzo::Commands::Gen
- Defined in:
- lib/alonzo/commands/gen.rb
Constant Summary collapse
- DEFAULTS =
{ project_root: Dir.pwd, template_type: :rb_class }
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#global ⇒ Object
Returns the value of attribute global.
-
#options ⇒ Object
Returns the value of attribute options.
-
#output ⇒ Object
Returns the value of attribute output.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(cmd_opts_and_args = {}, options = {}) ⇒ Gen
constructor
A new instance of Gen.
- #run ⇒ Object
Constructor Details
#initialize(cmd_opts_and_args = {}, options = {}) ⇒ Gen
Returns a new instance of Gen.
20 21 22 23 24 25 26 |
# File 'lib/alonzo/commands/gen.rb', line 20 def initialize(cmd_opts_and_args = {}, = {}) cmd_opts_and_args.each do |key, value| self.send("#{key}=", value) end self.output = .delete(:output) || STDOUT end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
9 10 11 |
# File 'lib/alonzo/commands/gen.rb', line 9 def args @args end |
#global ⇒ Object
Returns the value of attribute global.
9 10 11 |
# File 'lib/alonzo/commands/gen.rb', line 9 def global @global end |
#options ⇒ Object
Returns the value of attribute options.
9 10 11 |
# File 'lib/alonzo/commands/gen.rb', line 9 def end |
#output ⇒ Object
Returns the value of attribute output.
9 10 11 |
# File 'lib/alonzo/commands/gen.rb', line 9 def output @output end |
Class Method Details
.defaults ⇒ Object
16 17 18 |
# File 'lib/alonzo/commands/gen.rb', line 16 def self.defaults DEFAULTS end |
.run(cmd_opts_and_args, options = {}) ⇒ Object
11 12 13 14 |
# File 'lib/alonzo/commands/gen.rb', line 11 def self.run(cmd_opts_and_args, = {}) gen = new(cmd_opts_and_args, ) gen.run end |
Instance Method Details
#run ⇒ Object
28 29 30 |
# File 'lib/alonzo/commands/gen.rb', line 28 def run Generator.generate(args, { output: output, root: [:root], type: [:type] }) end |