lib/stars/client.rb in stars-0.3.0 vs lib/stars/client.rb in stars-0.3.1
- old
+ new
@@ -1,5 +1,7 @@
+# encoding: utf-8
+
module Stars
class Client
def self.load!(new_username=nil)
remember_username(new_username) if new_username
@@ -51,13 +53,20 @@
end
display if selection == ''
end
def self.show_selection(id)
- puts ''
- puts wrap_text(' ' + @recent[id.to_i - 1]['title'], 60)
- puts parse_who(@recent[id.to_i - 1]['guid'])
- puts ''
+ id = id.to_i - 1
+ if @recent[id]
+ puts ''
+ puts wrap_text(' ' + @recent[id]['title'], 60)
+ puts parse_who(@recent[id]['guid'])
+ puts ''
+ else
+ puts ''
+ puts 'Oops, no such toot.'
+ puts ''
+ end
end
def self.parse_who(url)
Stars::Favstar.new.show(url)
end