Permalink
Browse files

allow user customize filter class

  • Loading branch information...
1 parent d961de1 commit 50d85f4f9559e07b87f5e15ced22feb63bbcb5b3 @siuying committed Mar 22, 2010
Showing with 6 additions and 4 deletions.
  1. +3 −1 bin/tappy
  2. +1 −1 lib/tappy.rb
  3. +2 −2 lib/tappy/tappy_base.rb
View
@@ -7,13 +7,15 @@ host = ARGV[0] || "localhost"
port = ARGV[1].to_i
port = 9090 if port == 0
@@filter_option = ARGV[2] || "foursquare"
+@@filter_class = ARGV[3] || "Tappy::AgentFilter"
module Tappy
class MyTappy < TappyBase
+ set :filter_class, @@filter_class
set :filter_options, @@filter_option
end
end
-puts "Start Tappy server on #{host}:#{port}, options: #{@@filter_option}"
+puts "Start Tappy server on #{host}:#{port}, options: #{@@filter_option}, filter: #{@@filter_class}"
Tappy::MyTappy.run! :host => host, :port => port
View
@@ -6,5 +6,5 @@
require 'tappy/filter/agent_filter'
module Tappy
- VERSION = '1.0.4'
+ VERSION = '1.0.5'
end
View
@@ -6,8 +6,8 @@
module Tappy
class TappyBase < Sinatra::Base
set :twitter_host, "http://api.twitter.com"
- set :filter, "Tappy::AgentFilter"
- set :filter_options, ENV["TAPPY_OPTIONS"] || "foursquare"
+ set :filter, ENV["TAPPY_FILTER_CLASS"] || "Tappy::AgentFilter"
+ set :filter_options, ENV["TAPPY_FILTER_OPTIONS"] || "foursquare"
helpers do
def handle_request(url, request_params={}, params={})

0 comments on commit 50d85f4

Please sign in to comment.