class Riffer::Rig::Terminal::Host
Constants
- CAPABILITIES
Public Class Methods
(prompter: Riffer::Rig::Terminal::_Prompter, renderer: Riffer::Rig::Terminal::Renderer) → void
Source
# File lib/riffer/rig/terminal/host.rb, line 12 def initialize(prompter:, renderer:) @prompter = prompter @renderer = renderer end
@rbs prompter: Riffer::Rig::Terminal::_Prompter @rbs renderer: Riffer::Rig::Terminal::Renderer @rbs return: void
Public Instance Methods
(?String? question, ?options: Array[String]?, ?secret: bool) → String?
Source
# File lib/riffer/rig/terminal/host.rb, line 26 def ask(question = nil, options: nil, secret: false) answer = @prompter.ask(question, options: options, secret: secret) return nil if answer.nil? choice(answer.strip, options) end
@rbs question: String? @rbs options: Array? @rbs secret: bool @rbs return: String?
() → Set[Symbol]
Source
# File lib/riffer/rig/terminal/host.rb, line 18 def capabilities CAPABILITIES end
@rbs return: Set
(?String? question) → bool?
Source
# File lib/riffer/rig/terminal/host.rb, line 35 def confirm(question = nil) ask("#{question} [y/N]")&.downcase&.start_with?('y') end
@rbs question: String? @rbs return: bool?
(?String? message, ?level: Symbol) → void
Source
# File lib/riffer/rig/terminal/host.rb, line 42 def notify(message = nil, level: :info) @renderer.notify(message.to_s, level) end
@rbs message: String? @rbs level: Symbol @rbs return: void
(?String? label) ?{ () → void } → void
Source
# File lib/riffer/rig/terminal/host.rb, line 49 def progress(label = nil, &block) @renderer.notice(label) if label block&.call end
@rbs label: String? @rbs &block: ? () -> void @rbs return: void