Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
require 'rubygems' require 'twitter' connection = Twitter::Base.new('yourname', 'yourpass') class Array def names self.map{|u| u.screen_name} end end module Twitter class Base alias_method :throw_method_missing, :method_missing def method_missing(method_name, *args, &bloke) if (method_name.to_s =~ /^all_.+/) all_entries(method_name.to_s[/all_(.+)/,1], args[0] || {}) else throw_method_missing(method_name, *args, &bloke) end end def all_entries(method, options = {}) all_entries = [] next_100 = self.send method, {:page => (current_page = 1)}.merge(options) while (next_100.size != 0) do all_entries << next_100 next_100 = self.send method, {:page => (current_page += 1)}.merge(options) end all_entries.flatten end def not_following_back all_friends.names - all_followers.names end end end p connection.not_following_back
This paste will be private.
From the Design Piracy series on my blog: