Skip to content
Browse files

fixed bug with reading subdomains

  • Loading branch information...
1 parent 09304bf commit 07c995227203837bf5b716243ad70b466073d92c @devp devp committed Nov 5, 2009
Showing with 2 additions and 3 deletions.
  1. +2 −3 b-productive.rb
View
5 b-productive.rb
@@ -18,9 +18,8 @@ class Productivity
# - subsequent words are subdomains to block.
productivity_ftwrc = "#{ENV['HOME']}/.productivity_ftwrc"
if File.exists?(productivity_ftwrc)
- BLOCK_LIST = File.read(productivity_ftwrc).split("\n").map do |domain, subdomains|
+ BLOCK_LIST = File.read(productivity_ftwrc).split("\n").map(&:split).map do |domain, *subdomains|
domain += ".com" unless domain =~ /\.(org|net|com)/
- subdomains ||= []
["#{domain}", "www.#{domain}"] + subdomains.map{|subdomain| "#{subdomain}.#{domain}"}
end.flatten
else
@@ -43,7 +42,7 @@ def self.start
def self.stop
BLOCK_LIST.each do |block_target|
Host.delete(block_target)
- puts "Productivity degraded -10, (Now available for distraction: #{BLOCK_LIST.join(', ')})"
end
+ puts "Productivity degraded -10, (Now available for distraction: #{BLOCK_LIST.join(', ')})"
end
end

0 comments on commit 07c9952

Please sign in to comment.
Something went wrong with that request. Please try again.