Class: Codeowners::Cli::Wizards::NewOwnerWizard
- Inherits:
-
Object
- Object
- Codeowners::Cli::Wizards::NewOwnerWizard
- Includes:
- InteractiveOps
- Defined in:
- lib/codeowners/cli/wizards/new_owner_wizard.rb
Overview
Attempt to find a name similar to one provided in the owners list. Suggest to add new owner to the owners list. Only return decision without applying any modifications.
Constant Summary collapse
- DEFAULT_OPTIONS =
{ 'a' => '(a) add a new owner', 'r' => '(r) rename owner', 'i' => '(i) ignore owner in this session', 'q' => '(q) quit and save' }.freeze
Instance Method Summary collapse
-
#initialize(owners_list) ⇒ NewOwnerWizard
constructor
A new instance of NewOwnerWizard.
- #suggest_fixing(line, new_owner) ⇒ Object
Methods included from InteractiveOps
Constructor Details
#initialize(owners_list) ⇒ NewOwnerWizard
Returns a new instance of NewOwnerWizard.
21 22 23 |
# File 'lib/codeowners/cli/wizards/new_owner_wizard.rb', line 21 def initialize(owners_list) @owners_list = owners_list end |
Instance Method Details
#suggest_fixing(line, new_owner) ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/codeowners/cli/wizards/new_owner_wizard.rb', line 25 def suggest_fixing(line, new_owner) suggested_owner = suggest_name_from_owners_list(new_owner) case prompt(line, new_owner, suggested_owner) when 'y' then [:rename, suggested_owner] when 'a' then :add when 'r' then [:rename, keep_asking_until_valid_owner] when 'i' then :ignore when 'q' then :quit end end |