Class: PokemonNameGenerator::CLI::Commands::Generate

Inherits:
Dry::CLI::Command
  • Object
show all
Defined in:
lib/pokemon_name_generator/cli/commands/generate.rb

Instance Method Summary collapse

Instance Method Details

#call(**options) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/pokemon_name_generator/cli/commands/generate.rb', line 17

def call(**options)
  algorithm = Algorithm::Factory.new(**options).build_algorithm

  unless options.fetch(:quiet)
    puts "============================="
    puts "๐Ÿงช Generator: #{algorithm.name}"
    puts "============================="
    puts ""

    if options.fetch(:number).to_i > 1
      puts "Generating #{options.fetch(:number)} names..."
      puts ""
    end
  end

  options.fetch(:number).to_i.times { puts algorithm.generate_name }
end