resolve-hostname 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/resolve/hostname.rb +9 -0
- data/lib/resolve/hostname/version.rb +1 -1
- data/spec/resolve_hostname_spec.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22db4fda8e23d989ad1c6aaf1597f6a5e9675aa4
|
4
|
+
data.tar.gz: 527f73d5200a67c927ffa288578cd65e0d01c050
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6657496ca8bc1e67a8266e28a3a655bf49e265ab9f5956696d0fb4663e339bb790def23f759e480498f71495cfb50abcc4a7009ed1241f99e3fd2d7f47d3bfa
|
7
|
+
data.tar.gz: 4b9b1cca197f5832e44a66054240d83c97d552c29afd17645ae504f9f4e7c9a138414fef9b4e12f4e60548e2c058f60f35f44425f2aed49d1d68fb18617bae4b
|
data/lib/resolve/hostname.rb
CHANGED
@@ -80,6 +80,15 @@ module Resolve
|
|
80
80
|
def resolve(name)
|
81
81
|
secondary = nil
|
82
82
|
|
83
|
+
is_address = false
|
84
|
+
begin
|
85
|
+
IPAddr.new(name)
|
86
|
+
is_address = true
|
87
|
+
rescue IPAddr::InvalidAddressError
|
88
|
+
# ignore
|
89
|
+
end
|
90
|
+
return name if is_address
|
91
|
+
|
83
92
|
if @system_resolver_enabled
|
84
93
|
addr = resolve_builtin(name)
|
85
94
|
if addr
|
@@ -81,6 +81,12 @@ describe Resolve::Hostname do
|
|
81
81
|
it 'returns 127.0.0.1 for localhost' do
|
82
82
|
expect(r.getaddress('localhost')).to eq('127.0.0.1')
|
83
83
|
end
|
84
|
+
|
85
|
+
it 'returns address string itself for address string' do
|
86
|
+
expect(r.getaddress('127.0.0.1')).to eq('127.0.0.1')
|
87
|
+
expect(r.getaddress('::1')).to eq('::1')
|
88
|
+
expect(r.getaddress('192.168.0.1')).to eq('192.168.0.1')
|
89
|
+
end
|
84
90
|
end
|
85
91
|
end
|
86
92
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resolve-hostname
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TAGOMORI Satoshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
11
|
+
date: 2013-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|