Class: Imposter::CSZ

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

Class Method Summary collapse

Class Method Details

.city(zip5 = nil) ⇒ Object



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

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

.get_randObject



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

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



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

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



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

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



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

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

.zip5Object



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

def zip5
	@@csz_get['zip5']
end