Class: Ip2ProxyRecord
- Inherits:
-
Object
- Object
- Ip2ProxyRecord
- Defined in:
- lib/ip2proxy_ruby/ip2proxy_record.rb
Class Method Summary collapse
Class Method Details
.init(database, ip_version) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/ip2proxy_ruby/ip2proxy_record.rb', line 2 def self.init(database, ip_version) cls = Class.new(BinData::Record) cls.class_eval { endian :little i2p_ip_data :ip_from, :ip_version => ip_version database.each do |col| if col.first == :country i2p_string_data :country_short i2p_string_data :country_long, :country_long => true else i2p_string_data col.first end end i2p_ip_data :ip_to, :ip_version => ip_version } cls end |