Class: Ora::Cli::Stdin
- Inherits:
-
Object
- Object
- Ora::Cli::Stdin
- Defined in:
- lib/ora/cli/stdin.rb
Instance Method Summary collapse
- #gets(pattern = '') ⇒ Object
-
#initialize(bash:, print: Print.new, inputs: []) ⇒ Stdin
constructor
A new instance of Stdin.
- #select(command) ⇒ Object
Constructor Details
Instance Method Details
#gets(pattern = '') ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ora/cli/stdin.rb', line 11 def gets(pattern = '') input = nil until input input = @inputs.shift || STDIN.gets.chomp.strip unless input.match(pattern) @print.red "Please match #{pattern.inspect}" input = nil end end input end |
#select(command) ⇒ Object
25 26 27 |
# File 'lib/ora/cli/stdin.rb', line 25 def select(command) @inputs.shift || @bash.select(command) end |