Class: EasyCreds::Onboarding::TemplatePicker
- Inherits:
-
Object
- Object
- EasyCreds::Onboarding::TemplatePicker
- Defined in:
- lib/easy_creds/onboarding/template_picker.rb
Class Method Summary collapse
Instance Method Summary collapse
- #choose ⇒ Object
-
#initialize(prompt:, global_dir: nil) ⇒ TemplatePicker
constructor
A new instance of TemplatePicker.
Constructor Details
#initialize(prompt:, global_dir: nil) ⇒ TemplatePicker
Returns a new instance of TemplatePicker.
10 11 12 13 |
# File 'lib/easy_creds/onboarding/template_picker.rb', line 10 def initialize(prompt:, global_dir: nil) @prompt = prompt @global_dir = global_dir end |
Class Method Details
.choose(prompt:, global_dir: nil) ⇒ Object
6 7 8 |
# File 'lib/easy_creds/onboarding/template_picker.rb', line 6 def self.choose(prompt:, global_dir: nil) new(prompt: prompt, global_dir: global_dir).choose end |
Instance Method Details
#choose ⇒ Object
15 16 17 18 19 20 |
# File 'lib/easy_creds/onboarding/template_picker.rb', line 15 def choose registry = Templates::Registry.new(global_dir: @global_dir) choices = build_choices(registry) name = @prompt.select('Select a template:', choices, cycle: true) name == :blank ? {} : registry.load(name) end |