class Generator::AcceptInput

STDIN is separated into a class so that it can be extracted and tested

Public Class Methods

str(type) click to toggle source
# File lib/ngi/generator.rb, line 13
def self.str(type)
  case type
  when :condensed
    $stdin.gets.gsub(WHITESPACE, EMPTY)
  when :comma_delimited_to_array
    $stdin.gets.split(',').map(&:strip).reject(&:empty?)
  when :downcased
    $stdin.gets.strip.downcase
  end
end