lib/stars/client.rb in stars-0.2.1 vs lib/stars/client.rb in stars-0.3.0

- old
+ new

@@ -11,22 +11,26 @@ system 'clear' puts "\n ★ by @#{username}" puts Stars::Formatter.new(@recent) select_star end + + def self.input + STDIN.gets + end def self.username File.exists?(config_path) ? File.read(config_path) : prompt_for_username end def self.prompt_for_username puts "" puts "" - puts " ★ stars." + puts " ★ stars" puts "" puts "Type your Twitter username:" - remember_username(gets.chomp) + remember_username(self.input.chomp) end def self.remember_username(username) File.open(config_path, 'w') {|f| f.write(username) } username @@ -38,12 +42,12 @@ def self.select_star selection = '' while true puts "Type the number of the toot that you want to learn about" - puts " (or hit return to view all again, you ego-maniac) >>" - selection = gets.chomp + print " (or hit return to view all again, you ego-maniac) >> " + selection = self.input.chomp break if ['','q','quit','exit','fuckthis'].include?(selection.downcase) show_selection(selection) end display if selection == '' end @@ -63,6 +67,6 @@ txt.gsub(/(.{1,#{col}})( +|$\n?)|(.{1,#{col}})/, "\\1\\3\n ") end end -end \ No newline at end of file +end