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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 09936f07931da8b10a837040fb23d13c42052bca
4
- data.tar.gz: e5e7c20a2e29d17e8d98f7d96b920e9354cc40c4
3
+ metadata.gz: 22db4fda8e23d989ad1c6aaf1597f6a5e9675aa4
4
+ data.tar.gz: 527f73d5200a67c927ffa288578cd65e0d01c050
5
5
  SHA512:
6
- metadata.gz: 4a3a6627c33d3b6a2f6160fe76a059887906b5af1c6ff9846b5ed81a4b73dc25096260978d8c408d8e57b5a723d062580f3d68c5fce65fdee49bc40f157fe75b
7
- data.tar.gz: 255aef3c9fca5906287208ef3c3670a084d2101c4d0733406f0f217f6d92f8fb16b82c750ce2609a1affe5aac9188856a1f05ffdc0e5f7dfcbbab84582d9f72d
6
+ metadata.gz: c6657496ca8bc1e67a8266e28a3a655bf49e265ab9f5956696d0fb4663e339bb790def23f759e480498f71495cfb50abcc4a7009ed1241f99e3fd2d7f47d3bfa
7
+ data.tar.gz: 4b9b1cca197f5832e44a66054240d83c97d552c29afd17645ae504f9f4e7c9a138414fef9b4e12f4e60548e2c058f60f35f44425f2aed49d1d68fb18617bae4b
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Resolve
2
2
  class Hostname
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -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.2
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-10 00:00:00.000000000 Z
11
+ date: 2013-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler