class Riffer::Rig::Terminal::FramePrompter
Constants
- HIDDEN
- HINT
Public Class Methods
(frame: Riffer::Rig::Terminal::Frame, keys: Thread::Queue[Riffer::Rig::Terminal::Key], theme: Riffer::Rig::Terminal::Theme) → void
Source
# File lib/riffer/rig/terminal/frame_prompter.rb, line 16 def initialize(frame:, keys:, theme:) @frame = frame @keys = keys @theme = theme end
@rbs frame: Riffer::Rig::Terminal::Frame @rbs keys: Thread::Queue @rbs theme: Riffer::Rig::Terminal::Theme @rbs return: void
Public Instance Methods
(String? question, options: Array[String]?, secret: bool) → String?
Source
# File lib/riffer/rig/terminal/frame_prompter.rb, line 26 def ask(question, options:, secret:) asked = Riffer::Rig::Terminal::Question.lines(@theme, question, options, @frame.measure&.last) @frame.append(['', *asked, *(@theme.grey(HIDDEN) if secret)].join("\n")) editor = read(secret) return nil unless editor @frame.append("#{prompt} #{editor.printable_before}#{editor.printable_after}") unless secret editor.text end
@rbs question: String? @rbs options: Array? @rbs secret: bool @rbs return: String?