Class: Imposter::CSZ

Inherits:
Object
  • Object
show all
Defined in:
lib/imposter/csz.rb

Class Method Summary collapse

Class Method Details

.city(zip5 = nil) ⇒ Object



35
36
37
# File 'lib/imposter/csz.rb', line 35

def city(zip5=nil)
	@@csz_get['city']
end

.get_randObject



13
14
15
16
# File 'lib/imposter/csz.rb', line 13

def get_rand
	rand_row = (1+rand($total_rows[1][0].to_i - 1)).to_s
	@@csz_get = $csz_db.execute2("select city,state,statefull,zip5 from us limit " +  rand_row  + ",1")[1]
end

.get_rand_city(cty = nil) ⇒ Object



23
24
25
26
# File 'lib/imposter/csz.rb', line 23

def get_rand_city(cty = nil)
	rand_row =  (1 + rand($csz_db.execute2("select count(*) from us where upper(city)='"+ cty.upcase + "'")[1][0].to_i - 1)).to_s 
	@@csz_get = $csz_db.execute2("select city,state,statefull,zip5 from us where upper(city)='" + cty.upcase + "' limit " +  rand_row  + ",1")[1]
end

.get_rand_state(st = nil) ⇒ Object



18
19
20
21
# File 'lib/imposter/csz.rb', line 18

def get_rand_state(st=nil)
	rand_row =  (1 + rand($csz_db.execute2("select count(*) from us where upper(state)='"+ st.upcase + "'")[1][0].to_i - 1)).to_s 
	@@csz_get = $csz_db.execute2("select city,state,statefull,zip5 from us where state='" + st.upcase + "' limit " +  rand_row  + ",1")[1]
end

.state(zip5 = nil) ⇒ Object



31
32
33
# File 'lib/imposter/csz.rb', line 31

def state(zip5=nil)
	@@csz_get['state']
end

.zip5Object



28
29
30
# File 'lib/imposter/csz.rb', line 28

def zip5
	@@csz_get['zip5']
end