Class: Techbook::Generator
- Inherits:
-
Object
- Object
- Techbook::Generator
- Defined in:
- lib/techbook/generator.rb
Instance Attribute Summary collapse
-
#basename ⇒ Object
Returns the value of attribute basename.
-
#name ⇒ Object
Returns the value of attribute name.
-
#output ⇒ Object
Returns the value of attribute output.
-
#path ⇒ Object
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(name, output) ⇒ Generator
constructor
A new instance of Generator.
Constructor Details
#initialize(name, output) ⇒ Generator
Returns a new instance of Generator.
13 14 15 16 |
# File 'lib/techbook/generator.rb', line 13 def initialize(name, output) @name = name @output = output end |
Instance Attribute Details
#basename ⇒ Object
Returns the value of attribute basename.
6 7 8 |
# File 'lib/techbook/generator.rb', line 6 def basename @basename end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/techbook/generator.rb', line 6 def name @name end |
#output ⇒ Object
Returns the value of attribute output.
6 7 8 |
# File 'lib/techbook/generator.rb', line 6 def output @output end |
#path ⇒ Object
Returns the value of attribute path.
6 7 8 |
# File 'lib/techbook/generator.rb', line 6 def path @path end |
Class Method Details
.run(name, output:) ⇒ Object
8 9 10 11 |
# File 'lib/techbook/generator.rb', line 8 def self.run(name, output:) g = new name, output g.generate end |
Instance Method Details
#generate ⇒ Object
18 19 20 21 22 |
# File 'lib/techbook/generator.rb', line 18 def generate puts "Generating book as #{@name} in #{@output}...".yellow create_dir copy_files end |