Class: Techbook::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/techbook/generator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#basenameObject

Returns the value of attribute basename.



6
7
8
# File 'lib/techbook/generator.rb', line 6

def basename
  @basename
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/techbook/generator.rb', line 6

def name
  @name
end

#outputObject

Returns the value of attribute output.



6
7
8
# File 'lib/techbook/generator.rb', line 6

def output
  @output
end

#pathObject

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

#generateObject



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