Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 11 additions and 17 deletions.
  1. +7 −15 geoip.gemspec
  2. +4 −2 lib/geoip.rb
View
22 geoip.gemspec
@@ -4,16 +4,13 @@
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
- s.name = %q{geoip}
- s.version = "1.1.1"
+ s.name = "geoip"
+ s.version = "1.1.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Clifford Heath", "Roland Moriz"]
- s.date = %q{2011-05-06}
- s.default_executable = %q{geoip}
- s.description = %q{GeoIP searches a GeoIP database for a given host or IP address, and
-returns information about the country where the IP address is allocated,
-and the city, ISP and other information, if you have that database version.}
+ s.date = "2012-01-26"
+ s.description = "GeoIP searches a GeoIP database for a given host or IP address, and\nreturns information about the country where the IP address is allocated,\nand the city, ISP and other information, if you have that database version."
s.email = ["clifford.heath@gmail.com", "rmoriz@gmail.com"]
s.executables = ["geoip"]
s.extra_rdoc_files = [
@@ -42,18 +39,13 @@ and the city, ISP and other information, if you have that database version.}
"website/stylesheets/screen.css",
"website/template.rhtml"
]
- s.homepage = %q{http://github.com/cjheath/geoip}
+ s.homepage = "http://github.com/cjheath/geoip"
s.licenses = ["MIT"]
s.require_paths = ["lib"]
- s.rubygems_version = %q{1.3.7}
- s.summary = %q{GeoIP searches a GeoIP database for a given host or IP address, and returns information about the country where the IP address is allocated, and the city, ISP and other information, if you have that database version.}
- s.test_files = [
- "test/test_geoip.rb",
- "test/test_helper.rb"
- ]
+ s.rubygems_version = "1.8.10"
+ s.summary = "GeoIP searches a GeoIP database for a given host or IP address, and returns information about the country where the IP address is allocated, and the city, ISP and other information, if you have that database version."
if s.respond_to? :specification_version then
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
View
6 lib/geoip.rb
@@ -54,7 +54,7 @@
class GeoIP
# The GeoIP GEM version number
- VERSION = "1.1.1"
+ VERSION = "1.1.2"
# The +data/+ directory for geoip
DATA_DIR = File.expand_path(File.join(File.dirname(__FILE__),'..','data','geoip'))
@@ -487,7 +487,7 @@ def read_city(pos, hostname = '', ip = '') #:nodoc:
end
def lookup_ip(ip_or_hostname) # :nodoc:
- return ip_or_hostname unless (ip_or_hostname.kind_of?(String) && ip_or_hostname !~ /^[0-9.]*$/)
+ return ip_or_hostname unless (ip_or_hostname.kind_of?(String) && ip_or_hostname !~ /^[0-9.]+$/)
# Lookup IP address, we were given a name
ip = IPSocket.getaddress(ip_or_hostname)
@@ -500,6 +500,8 @@ def iptonum(ip) #:nodoc:
if (ip.kind_of?(String) &&
ip =~ /^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$/)
ip = be_to_ui(Regexp.last_match().to_a.slice(1..4))
+ else
+ ip = ip.to_i
end
return ip

No commit comments for this range

Something went wrong with that request. Please try again.