Class: Escort::Arguments
- Inherits:
-
Object
- Object
- Escort::Arguments
- Defined in:
- lib/escort/arguments.rb
Class Method Summary collapse
Class Method Details
.read(arguments, requires_arguments = false) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/escort/arguments.rb', line 6 def read(arguments, requires_arguments=false) if arguments.empty? && requires_arguments while command = Readline.readline("> ", true) arguments << command end arguments = arguments.compact.keep_if{|value| value.length > 0} if arguments.empty? raise Escort::UserError.new("You must provide some arguments to this script") end end arguments end |