jmhodges (owner)

Revisions

gist: 130970 Download_button fork
public
Public Clone URL: git://gist.github.com/130970.git
Embed All Files: show embed
Text only #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
class ReverseGeoThread < Thread; end
class ListingThread < Thread; end
 
def run
  cj = caller.join
  if cj =~ /reverse_geo/
    klass = ReverseGeoThread
  elsif cj =~ /listings/
    klass = ListingThread
  else
    klass = Thread
  end
  klass.new {
    # a bunch of stuff
  }
    
end
 
# old version
def run
  cj = caller.join
  if cj =~ /reverse_geo/
    klass = ReverseGeoThread
  elsif cj =~ /listings/
    klass = ListingThread
  end
 
  Thread.new {
    # a bunch of stuff
  }
end