whois 5.0.0 → 5.0.1

This diff has not been reviewed by any users.
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
  SHA256:
3
- metadata.gz: fb9fa20211291994c62267b7d254509ba77b9b79bacf8035423052d17ed7d366
4
- data.tar.gz: d7c987fcdcde95084dc1099e8cc1fe5be78fc25b850fd556dde39c38c057a1e4
3
+ metadata.gz: 52436e2b73659a4173b3d88fef2d252538a01352f2b7a706268bfe97ac3f590e
4
+ data.tar.gz: c5a52485ffd2c583e133f91b5e327cdec57823084244131f154b12877d6f385b
5
5
  SHA512:
6
- metadata.gz: cc78d80c44eb0cf4474d8b2d5fc732c8511482262da4a1b7b8723332ad66dba989741e05387edb8f3fe3f09751701a88e0c8f6d8726abd252b5f7f1a6f0a7bc4
7
- data.tar.gz: 3d73aa8a5cd70949776a5e81445850aa1021432566ec9993a693968123eac399e4c9d3c3939d96bf8ed96476185fe5a23ab5d752d47dfc0c791474d933e0d40e
6
+ metadata.gz: 8603e49b42982d7c283fce5cc9db540ed017d5c4b90da87e3aa86ca676f369e0137aa794585fb784446a9067010c46108b13e471a9941a56b15cac9f32ecc9f1
7
+ data.tar.gz: ac4a72c2a9ab24aa7bac3c213e5525cecebe76c0e1d6160ecda04a9f5d28d2a2a554b0ad60fe68eccf535515a405045ac9eb7983945993f83337eb99e3a93192
@@ -3,9 +3,15 @@
3
3
  This project uses [Semantic Versioning 2.0.0](http://semver.org/).
4
4
 
5
5
 
6
+ #### Release 5.0.1
7
+
8
+ - CHANGED: Use `String#match?` rather than `#=~` to improve performance (GH-589). Thanks @casperisfine @byroot
9
+ - CHANGED: Empty Hash allocation optimization (GH-588). Thanks @casperisfine @byroot
10
+
11
+
6
12
  #### Release 5.0.0
7
13
 
8
- - CHANGED: Minimum Ruby version 2.5
14
+ - CHANGED: Minimum Ruby version 2.4
9
15
  - SERVER: Update Amazon Registry whois hosts
10
16
 
11
17
  - FIXED: Fixed issue that prevented to query .CAT domains (GH-583).
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2009-2019 Simone Carletti
3
+ Copyright (c) 2009-2020 Simone Carletti
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -213,4 +213,4 @@ Report issues or feature requests to [GitHub Issues](https://github.com/weppos/w
213
213
 
214
214
  ## License
215
215
 
216
- Copyright (c) 2009-2019 [Simone Carletti](https://simonecarletti.com/). This is Free Software distributed under the MIT license.
216
+ Copyright (c) 2009-2020 [Simone Carletti](https://simonecarletti.com/). This is Free Software distributed under the MIT license.
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2019 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2020 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2019 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2020 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2019 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2020 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2019 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2020 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2019 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2020 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -4,7 +4,7 @@
4
4
  #
5
5
  # An intelligent pure Ruby WHOIS client and parser.
6
6
  #
7
- # Copyright (c) 2009-2019 Simone Carletti <weppos@weppos.net>
7
+ # Copyright (c) 2009-2020 Simone Carletti <weppos@weppos.net>
8
8
  #++
9
9
 
10
10
 
@@ -47,6 +47,10 @@ module Whois
47
47
  TYPE_ASN32 = :asn32,
48
48
  ].freeze
49
49
 
50
+ # Empty hash constant used to save allocation for definitions with empty settings.
51
+ EMPTY_HASH = {}.freeze
52
+ private_constant :EMPTY_HASH
53
+
50
54
  class << self
51
55
 
52
56
  # Clears the definition and reset them to an empty list.
@@ -78,7 +82,12 @@ module Whois
78
82
  settings.reject! { |k, _| k.start_with?("_") }
79
83
  host = settings.delete("host")
80
84
  host = intern_string(host) if host
81
- define(type, allocation, host, Hash[settings.map { |k,v| [k.to_sym, v.is_a?(String) ? intern_string(v) : v] }])
85
+ options = if settings.empty?
86
+ EMPTY_HASH
87
+ else
88
+ Hash[settings.map { |k,v| [k.to_sym, v.is_a?(String) ? intern_string(v) : v] }].freeze
89
+ end
90
+ define(type, allocation, host, options)
82
91
  end
83
92
  end
84
93
 
@@ -145,11 +154,11 @@ module Whois
145
154
  # :adapter => Whois::Server::Adapters::Web,
146
155
  # :url => "http://www.nic.ar/"
147
156
  #
148
- def define(type, allocation, host, options = {})
157
+ def define(type, allocation, host, options = EMPTY_HASH)
149
158
  TYPES.include?(type) or
150
159
  raise(ArgumentError, "`#{type}` is not a valid definition type")
151
160
 
152
- _definitions(type)[allocation] = [allocation, host, options]
161
+ _definitions(type)[allocation] = [allocation, host, options.freeze]
153
162
  end
154
163
 
155
164
  # Creates a new server adapter from given arguments
@@ -354,7 +363,7 @@ module Whois
354
363
  end
355
364
 
356
365
  def matches_tld?(string)
357
- string =~ /^\.(xn--)?[a-z0-9]+$/
366
+ string.match?(/^\.(xn--)?[a-z0-9]+$/)
358
367
  end
359
368
 
360
369
  def matches_ip?(string)
@@ -362,14 +371,13 @@ module Whois
362
371
  end
363
372
 
364
373
  def matches_email?(string)
365
- string =~ /@/
374
+ string.include?('@')
366
375
  end
367
376
 
368
377
  def matches_asn?(string)
369
- string =~ /^as\d+$/i
378
+ string.match?(/^as\d+$/i)
370
379
  end
371
380
 
372
-
373
381
  def valid_ipv4?(addr)
374
382
  if /\A(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\Z/ =~ addr
375
383
  return $~.captures.all? {|i| i.to_i < 256}
@@ -379,9 +387,9 @@ module Whois
379
387
 
380
388
  def valid_ipv6?(addr)
381
389
  # IPv6 (normal)
382
- return true if /\A[\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*\Z/ =~ addr
383
- return true if /\A[\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*::([\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*)?\Z/ =~ addr
384
- return true if /\A::([\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*)?\Z/ =~ addr
390
+ return true if addr.match?(/\A[\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*\Z/)
391
+ return true if addr.match?(/\A[\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*::([\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*)?\Z/)
392
+ return true if addr.match?(/\A::([\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*)?\Z/)
385
393
  # IPv6 (IPv4 compat)
386
394
  return true if /\A[\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*:/ =~ addr && valid_ipv4?($')
387
395
  return true if /\A[\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*::([\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*:)?/ =~ addr && valid_ipv4?($')
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2019 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2020 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2019 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2020 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2019 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2020 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -28,7 +28,7 @@ module Whois
28
28
  # "192.in-addr.arpa" => "192.0.0.0"
29
29
  # "in-addr.arpa" => "0.0.0.0"
30
30
  def inaddr_to_ip(string)
31
- unless /^([0-9]{1,3}\.?){0,4}in-addr\.arpa$/ =~ string
31
+ unless string.match?(/^([0-9]{1,3}\.?){0,4}in-addr\.arpa$/)
32
32
  raise ServerError, "Invalid .in-addr.arpa address"
33
33
  end
34
34
  a, b, c, d = string.scan(/[0-9]{1,3}\./).reverse
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2019 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2020 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2019 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2020 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2019 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2020 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2019 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2020 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2019 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2020 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2019 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2020 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2019 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2020 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2019 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2020 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -3,11 +3,11 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2019 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2020 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
10
10
  module Whois
11
11
  # The current library version.
12
- VERSION = "5.0.0".freeze
12
+ VERSION = "5.0.1".freeze
13
13
  end
@@ -13,7 +13,7 @@ end
13
13
 
14
14
  Dir.glob("#{File.expand_path(IANAWHOIS_DIR)}/*").each do |entry|
15
15
  basename = File.basename(entry)
16
- next unless basename =~ /^[A-Z]+$/
16
+ next unless basename.match?(/^[A-Z]+$/)
17
17
  content = File.read(entry)
18
18
  server = content =~ /^whois:\s+(.+)\n$/ && $1
19
19
  servers[".#{basename.downcase}"] = server
@@ -41,7 +41,7 @@ P = Whois::Record::Parser
41
41
  PROPERTIES = [:disclaimer, :domain, :domain_id, :status, :available?, :registered?, :created_on, :updated_on, :expires_on, :registrar, :registrant_contacts, :admin_contacts, :technical_contacts, :nameservers]
42
42
 
43
43
  hosts = Dir.glob(File.join(LIB, "whois/record/parser/*.rb"))
44
- .reject { |f| f =~ /\/(base|blank|example)/ }
44
+ .reject { |f| f.match?(/\/(base|blank|example)/) }
45
45
  .map { |f| File.basename(f, ".rb") }
46
46
 
47
47
  pthin = %w(
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whois
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simone Carletti
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-19 00:00:00.000000000 Z
11
+ date: 2020-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -161,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
161
  - !ruby/object:Gem::Version
162
162
  version: '0'
163
163
  requirements: []
164
- rubygems_version: 3.0.3
164
+ rubygems_version: 3.1.2
165
165
  signing_key:
166
166
  specification_version: 4
167
167
  summary: An intelligent pure Ruby WHOIS client and parser.