Sha256: 27dbaac2e8feb9ef7f4253be7a5210e9c0c4981c9f6e3328a24c46b0b1d5a0fd

Contents?: true

Size: 585 Bytes

Versions: 2

Compression:

Stored size: 585 Bytes

Contents

class DbConfig 
  COLUMNS = { 
     :COUNTRY                  => [0, 2, 3, 3, 3],
     :REGION                   => [0, 0, 0, 4, 4],
     :CITY                     => [0, 0, 0, 5, 5],
     :ISP                      => [0, 0, 0, 0, 6],
     :PROXYTYPE                => [0, 0, 2, 2, 2]
   }
   
 def self.setup_database(db_index)
   # strip all 0 value & downcase keys
  cols = COLUMNS.inject({}) {|memo, (key, value)|
   (memo[key.to_s.downcase.to_sym] = value[db_index] if value[db_index] > 0)
   memo
  }
  # order by value
  col_array = cols.sort_by {|key,value| value}
 end
 
end
 

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ip2proxy_ruby-1.0.1 lib/ip2proxy_ruby/database_config.rb
ip2proxy_ruby-1.0.0 lib/ip2proxy_ruby/database_config.rb