adomain 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f12152322fbc0b75e36dcfc4dcc05497cdd16e1f47082949f42ee2af9bebae12
4
- data.tar.gz: 2f267c665cb5ec0084a9d4752e57763a95f169b34719b4a478622f39ba5c7ece
3
+ metadata.gz: 83a5d692e2425fec3d5bbc93a753d7c96a73223f2c0e63c13cb7554519dccf86
4
+ data.tar.gz: 29d37fcdca4db2f997c4d473b012a06677e06e0d713899e4e76569f2ad2ce630
5
5
  SHA512:
6
- metadata.gz: c5ad2bed3658959228d70d592ebf9e6d34d3d14a3b928f945e1dfd916ea1f751a32a3c60fb342bff1e1a4385a9b034a97dd877a0e8ea5a3ecc2e6acf6e725d80
7
- data.tar.gz: 5a8c239d1972737ecb21d6b15d7e64f4c806933d505f75d289aa42ccd3b34b65ea338d8995ecf65202ff70b9345f8c12be02d3880455f6fdf83857ebfff1169f
6
+ metadata.gz: 3f9ffd06b85aac9718c5d450125838acc7a38034fa805f5578c621d70522e3d33dbe451c988c56c6a593d9b0e2359fca128975599f53a21956883c1fc8993d2d
7
+ data.tar.gz: ae911c83f0e65a877837b3fb8cd4eeacf2d9058f380b2a07da48369880d532bb7c04eb2747196c5f0aaa68c1b2ba962adf5bfbd730eef53a5bb0924a3416a783
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- adomain (0.1.1)
4
+ adomain (0.1.2)
5
5
  addressable (~> 2.5)
6
6
  logger
7
7
 
@@ -14,19 +14,19 @@ GEM
14
14
  logger (1.4.1)
15
15
  public_suffix (4.0.1)
16
16
  rake (10.5.0)
17
- rspec (3.8.0)
18
- rspec-core (~> 3.8.0)
19
- rspec-expectations (~> 3.8.0)
20
- rspec-mocks (~> 3.8.0)
21
- rspec-core (3.8.2)
22
- rspec-support (~> 3.8.0)
23
- rspec-expectations (3.8.4)
17
+ rspec (3.9.0)
18
+ rspec-core (~> 3.9.0)
19
+ rspec-expectations (~> 3.9.0)
20
+ rspec-mocks (~> 3.9.0)
21
+ rspec-core (3.9.0)
22
+ rspec-support (~> 3.9.0)
23
+ rspec-expectations (3.9.0)
24
24
  diff-lcs (>= 1.2.0, < 2.0)
25
- rspec-support (~> 3.8.0)
26
- rspec-mocks (3.8.1)
25
+ rspec-support (~> 3.9.0)
26
+ rspec-mocks (3.9.0)
27
27
  diff-lcs (>= 1.2.0, < 2.0)
28
- rspec-support (~> 3.8.0)
29
- rspec-support (3.8.2)
28
+ rspec-support (~> 3.9.0)
29
+ rspec-support (3.9.0)
30
30
 
31
31
  PLATFORMS
32
32
  ruby
@@ -38,4 +38,4 @@ DEPENDENCIES
38
38
  rspec (~> 3.0)
39
39
 
40
40
  BUNDLED WITH
41
- 1.16.6
41
+ 1.17.3
data/lib/adomain.rb CHANGED
@@ -4,14 +4,6 @@ require "logger"
4
4
 
5
5
  class Adomain
6
6
  class << self
7
-
8
- ADDRESSABLE_WARNING = %{
9
- WARNING: breaking change planned:
10
- Adomain will catch Addressable::URI::InvalidURIError.
11
- This error will be caught in version 0.2.
12
- Any code relying on the error will break.
13
- }.gsub(/\s+/, ' ').strip
14
-
15
7
  # [] is a convenience method to subdomain the URL,
16
8
  # or optionally domain or subdomain_www.
17
9
  # Adomain["http://abc.xyz.com"] # => "abc.xyz.com"
@@ -49,6 +41,22 @@ class Adomain
49
41
  subdomain(string, true)
50
42
  end
51
43
 
44
+ # scheme is a wrapper around Addressable::URI's scheme
45
+ # it is only included for convenience
46
+ def scheme(string)
47
+ Addressable::URI.parse(string).scheme
48
+ rescue Addressable::URI::InvalidURIError => e
49
+ nil
50
+ end
51
+
52
+ # path is a wrapper around Addressable::URI's path
53
+ # it is only included for convenience
54
+ def path(string)
55
+ Addressable::URI.parse(string).path
56
+ rescue Addressable::URI::InvalidURIError => e
57
+ nil
58
+ end
59
+
52
60
  private
53
61
  # parse_for_domain accepts one hash of arguments that allow
54
62
  # changes to the parsing behavior of domains
@@ -85,9 +93,7 @@ class Adomain
85
93
 
86
94
  return domain
87
95
  rescue Addressable::URI::InvalidURIError => e
88
- logger.warn ADDRESSABLE_WARNING
89
-
90
- raise e
96
+ nil
91
97
  end
92
98
 
93
99
  def logger
@@ -1,3 +1,3 @@
1
1
  class Adomain
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adomain
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Nissen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-05 00:00:00.000000000 Z
11
+ date: 2019-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -120,8 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  - !ruby/object:Gem::Version
121
121
  version: '0'
122
122
  requirements: []
123
- rubyforge_project:
124
- rubygems_version: 2.7.10
123
+ rubygems_version: 3.0.6
125
124
  signing_key:
126
125
  specification_version: 4
127
126
  summary: Simple, uncomplicated, schemed domain parsing using Addressable