Class: GemChangelogDiff::Interactive
- Inherits:
-
Object
- Object
- GemChangelogDiff::Interactive
- Defined in:
- lib/gem_changelog_diff/interactive.rb
Overview
Presents a multi-select prompt for choosing which gems to check.
Instance Method Summary collapse
-
#initialize(gems:) ⇒ Interactive
constructor
A new instance of Interactive.
-
#select ⇒ Array<OutdatedGem>
Displays the selection prompt and returns chosen gems.
Constructor Details
#initialize(gems:) ⇒ Interactive
Returns a new instance of Interactive.
8 9 10 |
# File 'lib/gem_changelog_diff/interactive.rb', line 8 def initialize(gems:) @gems = gems end |
Instance Method Details
#select ⇒ Array<OutdatedGem>
Displays the selection prompt and returns chosen gems.
14 15 16 17 18 19 20 21 22 |
# File 'lib/gem_changelog_diff/interactive.rb', line 14 def select prompt = TTY::Prompt.new prompt.multi_select("Select gems to check:", per_page: 15, help: "(Space to select, Enter to confirm)") do || @gems.each do |gem| .choice "#{gem.name} (#{gem.current_version} → #{gem.newest_version})", gem end end end |