Module: MotionVj::Helpers::Input

Defined in:
lib/motion_vj/helpers/input.rb

Class Method Summary collapse

Class Method Details

.gets_until_not_blank(input_name = :input) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/motion_vj/helpers/input.rb', line 4

def self.gets_until_not_blank(input_name = :input)
  loop do
    value = $stdin.gets.to_s.strip
    if value.empty?
      print("Please provide a valid #{ input_name }: ")
    else
      return value  
    end
  end
end