module InputStream
Public Class Methods
analyze(input)
click to toggle source
# File lib/input_stream_module/input_stream.rb, line 3 def self.analyze(input) if input.empty? self.prompt("--- Please input your text below ----") self.get_input else self.read_file(input) end end
get_input()
click to toggle source
# File lib/input_stream_module/input_stream.rb, line 16 def self.get_input STDIN.gets end
prompt(string)
click to toggle source
# File lib/input_stream_module/input_stream.rb, line 12 def self.prompt(string) puts string end
read_file(input)
click to toggle source
# File lib/input_stream_module/input_stream.rb, line 20 def self.read_file(input) if input.detect { |path| File.file?(path) == false } raise LoadError, "File not found: Please try again." exit 2 else ARGF.read end end