adomain 0.2.0 → 0.2.1

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: 83a5d692e2425fec3d5bbc93a753d7c96a73223f2c0e63c13cb7554519dccf86
4
- data.tar.gz: 29d37fcdca4db2f997c4d473b012a06677e06e0d713899e4e76569f2ad2ce630
3
+ metadata.gz: 1ff6ad12bb0daeb96fbb1ce22ee09f4cf09c5f6a0ac3ef21336792c977e4dce1
4
+ data.tar.gz: be1e2cfa7e6a72b6595dc2d79e70f636cce95fc3fa9d4215a366b45e458a6baf
5
5
  SHA512:
6
- metadata.gz: 3f9ffd06b85aac9718c5d450125838acc7a38034fa805f5578c621d70522e3d33dbe451c988c56c6a593d9b0e2359fca128975599f53a21956883c1fc8993d2d
7
- data.tar.gz: ae911c83f0e65a877837b3fb8cd4eeacf2d9058f380b2a07da48369880d532bb7c04eb2747196c5f0aaa68c1b2ba962adf5bfbd730eef53a5bb0924a3416a783
6
+ metadata.gz: 50d9e06e046e86d8f5e4f5fd9c58af82f101c62ddfff23a263571f2afc7315d5ea555da4ed52a4df33399c629baecbf0e98da6137b17b5487470a8cb991b4c62
7
+ data.tar.gz: b75ef3af5862e458d9389ce3bba1ba385d1bf528f30ae842c5c7121a9e818871203e728855aef1a4440f0f8060e6ed276ab42cee352e60dd0d93de93f3283ca1
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- adomain (0.1.2)
4
+ adomain (0.2.0)
5
5
  addressable (~> 2.5)
6
6
  logger
7
7
 
data/README.md CHANGED
@@ -13,10 +13,12 @@ Adomain["https://www.xyz.com"]
13
13
  # => "xyz.com"
14
14
  ```
15
15
 
16
- Adomain returns the URL host, stripping 'www' by default, scheming your URL if necessary (with "https://").
17
- Optionally, you can strip subdomains or keep 'www' subdomains -- see below.
16
+ Adomain returns the URL host, stripping 'www' by default,
17
+ scheming your URL if necessary (with "https://").
18
+ Optionally, you can strip subdomains or keep 'www' subdomains – see below.
18
19
 
19
- [`Addressable::URI.parse`](https://github.com/sporkmonger/addressable#example-usage) performs the parsing.
20
+ [`Addressable::URI.parse`](https://github.com/sporkmonger/addressable#example-usage)
21
+ performs the parsing.
20
22
 
21
23
  ## Other methods and options
22
24
 
@@ -41,36 +43,59 @@ Adomain.domain "http://abc.xyz.com" # => "xyz.com"
41
43
  Adomain.subdomain_www "http://www.xyz.com" # => "www.xyz.com"
42
44
  ```
43
45
 
46
+ ### Domain options
47
+
44
48
  Optionally, each method accepts boolean values,
45
49
  allowing you to contort the method to do something other
46
50
  than what it says it does. Don't do this, unless you want to.
47
51
 
48
- ### A gotcha: Adomain returns nil for some invalid values
52
+ #### A gotcha: Adomain returns nil for some invalid values
49
53
 
50
- Because Adomain adds a scheme to any string passed to it
51
- Addressable does not error out. So, Adomain returns nil
52
- when presented with otherwise-valid strings
53
- for which Addressable cannot find a domain.
54
+ Because Adomain adds a scheme to any string passed to it,
55
+ schemeless-but-otherwise valid strings do not raise errors.
56
+ Additionally, Adomain rescues InvalidURIError errors,
57
+ and instead returns nil.
54
58
 
55
59
  ```ruby
56
60
  Adomain["hola"] # => nil
57
61
  Adomain["::::::::"] # => nil
58
- Adomain[""] # => Addressable::URI::InvalidURIError
59
- Adomain["{}"] # => Addressable::URI::InvalidURIError
60
- Gem::Version.new(Adomain::VERSION) >= Gem::Version.new(0.2) # => false
62
+ Adomain[""] # => nil
63
+ Adomain["{}"] # => nil
61
64
  ```
62
65
 
63
- #### WARNING: All InvalidURIError will be caught in >= version 0.2
66
+ #### NOTE: InvalidURIError are now caught in >= version 0.2
64
67
 
65
- When 0.2 is released, `Addressable::URI::InvalidURIError`s will be caught
66
- and ignored. Nil will be returned.
68
+ With 0.2 `Addressable::URI::InvalidURIError`s are now caught
69
+ and ignored. Nil is returned.
67
70
 
68
71
  ```ruby
69
72
  Gem::Version.new(Adomain::VERSION) >= Gem::Version.new(0.2) # => true
70
73
  Adomain["hola"] # => nil
71
74
  Adomain["::::::::"] # => nil
72
- Adomain[""] # => nil
73
- Adomain["{}"] # => nil
75
+ Adomain[""] # => nil (formerly raised a Addressable::URI::InvalidURIError)
76
+ Adomain["{}"] # => nil (formerly raised a Addressable::URI::InvalidURIError)
77
+ ```
78
+
79
+ ### Convenience Addressable passthroughs
80
+
81
+ These methods are simply passed through to parsed
82
+ Addressable URI objects, and respond accordingly.
83
+ These are presented for your convenience, and will track with
84
+ your version of Addressable.
85
+
86
+ ```ruby
87
+ Adomain.path "http://www.xyz.com/pages/123" # => "/pages/123"
88
+ Adomain.path "{{{{{" # => "{{{{{"
89
+ Adomain.scheme "http://www.xyz.com/pages/123" # => "http"
90
+ Adomain.scheme "harrison:ford" # => "harrison"
91
+ ```
92
+
93
+ However, they are rescued from InvalidURIError,
94
+ like in other parts of the gem.
95
+
96
+ ```ruby
97
+ Adomain.path "::::::::::::" #=> nil
98
+ Adomain.scheme "::::::::::::" #=> nil
74
99
  ```
75
100
 
76
101
  ## Installation
@@ -89,16 +114,23 @@ Or install it yourself as:
89
114
 
90
115
  ## Development
91
116
 
92
- File bugs against the GitHub issue tracker and pull requests to match, where possible.
117
+ File bugs against the GitHub issue tracker and pull requests to match,
118
+ where possible.
93
119
 
94
120
  ## Contributing
95
121
 
96
- Bug reports and pull requests are welcome on GitHub at https://github.com/samnissen/adomain. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
122
+ Bug reports and pull requests are welcome on GitHub at
123
+ https://github.com/samnissen/adomain. This project is intended to be a safe,
124
+ welcoming space for collaboration, and contributors are expected to adhere
125
+ to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
97
126
 
98
127
  ## License
99
128
 
100
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
129
+ The gem is available as open source under the terms of the
130
+ [MIT License](https://opensource.org/licenses/MIT).
101
131
 
102
132
  ## Code of Conduct
103
133
 
104
- Everyone interacting in the Adomain project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/adomain/blob/master/CODE_OF_CONDUCT.md).
134
+ Everyone interacting in the Adomain project’s codebases, issue trackers,
135
+ chat rooms and mailing lists is expected to follow the
136
+ [code of conduct](https://github.com/samnissen/adomain/blob/master/CODE_OF_CONDUCT.md).
@@ -1,3 +1,3 @@
1
1
  class Adomain
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adomain
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Nissen