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



37
38
39
# File 'lib/imposter/csz.rb', line 37

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

.get_randObject



15
16
17
18
# File 'lib/imposter/csz.rb', line 15

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



25
26
27
28
# File 'lib/imposter/csz.rb', line 25

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



20
21
22
23
# File 'lib/imposter/csz.rb', line 20

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



33
34
35
# File 'lib/imposter/csz.rb', line 33

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

.zip5Object



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

def zip5
	@@csz_get['zip5']
end