Sha256: a2c3879030acde2ae3a3c377ee0957bc4703d39a5a4faf0ca65018e8e9448e8e

Contents?: true

Size: 629 Bytes

Versions: 18

Compression:

Stored size: 629 Bytes

Contents

class Ip2LocationRecord 
  def self.init(database, ip_version)
    cls = Class.new(BinData::Record)
    cls.class_eval {
      endian :little
      i2l_ip_data :ip_from, :ip_version => ip_version
      database.each do |col|
        if [:latitude, :longitude].include? col.first
          i2l_float_data col.first
        elsif col.first == :country
          i2l_string_data :country_short
          i2l_string_data :country_long, :country_long => true
        else
          i2l_string_data col.first
        end
      end
      
      i2l_ip_data :ip_to, :ip_version => ip_version
    }
    cls 
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
ip2location_ruby-8.7.3 lib/ip2location_ruby/ip2location_record.rb
ip2location_ruby-8.7.2 lib/ip2location_ruby/ip2location_record.rb
ip2location_ruby-8.7.1 lib/ip2location_ruby/ip2location_record.rb
ip2location_ruby-8.7.0 lib/ip2location_ruby/ip2location_record.rb
ip2location_ruby-8.6.0 lib/ip2location_ruby/ip2location_record.rb
ip2location_ruby-8.5.0 lib/ip2location_ruby/ip2location_record.rb
ip2location_ruby-8.4.0 lib/ip2location_ruby/ip2location_record.rb
ip2location_ruby-8.3.2 lib/ip2location_ruby/ip2location_record.rb
ip2location_ruby-8.3.1 lib/ip2location_ruby/ip2location_record.rb
ip2location_ruby-8.3.0 lib/ip2location_ruby/ip2location_record.rb
ip2location_ruby-8.2.3 lib/ip2location_ruby/ip2location_record.rb
ip2location_ruby-8.2.2 lib/ip2location_ruby/ip2location_record.rb
ip2location_ruby-8.2.1 lib/ip2location_ruby/ip2location_record.rb
ip2location_ruby-8.2.0 lib/ip2location_ruby/ip2location_record.rb
ip2location_ruby-8.1.1 lib/ip2location_ruby/ip2location_record.rb
ip2location_ruby-8.1.0 lib/ip2location_ruby/ip2location_record.rb
ip2location_ruby-8.0.3 lib/ip2location_ruby/ip2location_record.rb
ip2location_ruby-8.0.2 lib/ip2location_ruby/ip2location_record.rb