dominatrix 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -133
- data/dominatrix.gemspec +6 -0
- data/lib/dominatrix.rb +1 -0
- data/lib/dominatrix/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba69e63d1f8805b15b888d02ac6d5b442170dbee
|
4
|
+
data.tar.gz: 88de43affd54bf9f4fc15be6186ac74e1f071b59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c744eb0fa134ce610a5923b00fe195dd39874f328628f94c8f6b7dc6281a7e67c5c007a49ea0b29b197e25c9e3fc4c213f7f87f15f5f351f3c39e75ebca79ec
|
7
|
+
data.tar.gz: 4a7d7aff0b1dc0564435253998bcb9c917acab4a931a835325cdf8ae6f4c62feed4912b809c1c857fa405d45a248ce21110a7e7297ba4c38af21df5dc1942fb3
|
data/README.md
CHANGED
@@ -1,135 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# Domainatrix is now Domainator
|
2
2
|
|
3
|
-
|
3
|
+
Dominatrix will be known as Domainator moving forward. Domainator can be found at:
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
Add this line to your application's Gemfile:
|
8
|
-
|
9
|
-
```ruby
|
10
|
-
gem 'dominatrix'
|
11
|
-
```
|
12
|
-
|
13
|
-
And then execute:
|
14
|
-
|
15
|
-
$ bundle
|
16
|
-
|
17
|
-
Or install it yourself as:
|
18
|
-
|
19
|
-
$ gem install dominatrix
|
20
|
-
|
21
|
-
## Usage
|
22
|
-
|
23
|
-
### Parsing Domains
|
24
|
-
|
25
|
-
There are two approaches to parsing domains with Dominatrix: `Dominatrix.parse`
|
26
|
-
and `Dominatrix#parse`.
|
27
|
-
|
28
|
-
#### Dominatrix.parse
|
29
|
-
|
30
|
-
Call the `Dominatrix.parse` method with a URI object or parseable URI string.
|
31
|
-
|
32
|
-
```ruby
|
33
|
-
Dominatrix.parse('http://www.google.com')
|
34
|
-
# => "google.com"
|
35
|
-
|
36
|
-
uri = URI.parse('http://maps.google.co.uk/map?foo=bar')
|
37
|
-
Dominatrix.parse(uri)
|
38
|
-
# => "google.co.uk"
|
39
|
-
|
40
|
-
Dominatrix.parse('http://10.0.0.1')
|
41
|
-
# => Dominatrix::NotFoundError: no matching domain for "http://10.0.0.1"
|
42
|
-
```
|
43
|
-
|
44
|
-
A second parameter can alternatively be passed to define the known extensions.
|
45
|
-
This parameter should be an `Enumerable` (optimally a `Set`) in which each
|
46
|
-
extension contains the leading dot. By default, this value is set to
|
47
|
-
`Dominatrix.default_extensions`.
|
48
|
-
|
49
|
-
```ruby
|
50
|
-
extensions = %w[.com .net .co.uk].to_set
|
51
|
-
|
52
|
-
Dominatrix.parse('http://www.google.com', extensions)
|
53
|
-
# => "google.com"
|
54
|
-
|
55
|
-
Dominatrix.parse('http://www.google.ca', extensions)
|
56
|
-
# => Dominatrix::NotFoundError: no matching domain for "http://www.google.ca"
|
57
|
-
```
|
58
|
-
|
59
|
-
If a domain is found, then a string will be returned. Otherwise, one of the
|
60
|
-
following errors will be raised:
|
61
|
-
|
62
|
-
* `ArgumentError`: the URI param was not passed in as a `String` or `URI`, or
|
63
|
-
the URI param does not include a host, or the extensions param was not passed
|
64
|
-
in as an `Enumerable`.
|
65
|
-
* `URI::InvalidURIError`: the URI was passed in as a `String` and cannot be
|
66
|
-
parsed.
|
67
|
-
* `Dominatrix::NotFoundError`: the URI does not contain a valid domain name.
|
68
|
-
|
69
|
-
#### Dominatrix#parse
|
70
|
-
|
71
|
-
Instantiate a `Dominatrix` object by passing in an optional set of valid domain
|
72
|
-
extensions. By default, this value is set to `Dominatrix.default_extensions`.
|
73
|
-
|
74
|
-
```ruby
|
75
|
-
dominatrix = Dominatrix.new
|
76
|
-
# => #<Dominatrix:0x007fda8428a8f0 @extensions=#<Set: {".ac", ".com.ac", ".gov.ac", ".mil.ac", ... }>>
|
77
|
-
|
78
|
-
dominatrix = Dominatrix.new(%w[.com .net].to_set)
|
79
|
-
# => #<Dominatrix:0x007fda823861c0 @extensions=#<Set: {".com", ".net"}>>
|
80
|
-
```
|
81
|
-
|
82
|
-
Once instantiated, call the `#parse` method with a URI object or parseable URI
|
83
|
-
string.
|
84
|
-
|
85
|
-
```ruby
|
86
|
-
dominatrix.parse('http://www.google.com')
|
87
|
-
# => "google.com"
|
88
|
-
|
89
|
-
dominatrix.parse('http://www.google.foo')
|
90
|
-
# => Dominatrix::NotFoundError: no matching domain for "http://www.google.foo"
|
91
|
-
```
|
92
|
-
|
93
|
-
### Domain Extensions
|
94
|
-
|
95
|
-
To see the list of domain extensions built into the gem, call the
|
96
|
-
`Dominatrix.default_extensions` method.
|
97
|
-
|
98
|
-
```ruby
|
99
|
-
Dominatrix.default_extensions
|
100
|
-
# => #<Set: {".ac", ".com.ac", ".gov.ac", ".mil.ac", ... }>
|
101
|
-
```
|
102
|
-
|
103
|
-
You can manually add to and remove from this list via the
|
104
|
-
[`Set#add`](http://www.ruby-doc.org/stdlib-2.1.5/libdoc/set/rdoc/Set.html#method-i-add)
|
105
|
-
([`Set#<<`](http://www.ruby-doc.org/stdlib-2.1.5/libdoc/set/rdoc/Set.html#method-i-3C-3C))
|
106
|
-
and [`Set#delete`](http://www.ruby-doc.org/stdlib-2.1.5/libdoc/set/rdoc/Set.html#method-i-delete)
|
107
|
-
methods.
|
108
|
-
|
109
|
-
```ruby
|
110
|
-
Dominatrix.default_extensions.include? '.foo'
|
111
|
-
# => false
|
112
|
-
Dominatrix.default_extensions.include? '.com'
|
113
|
-
# => true
|
114
|
-
|
115
|
-
Dominatrix.default_extensions << '.foo'
|
116
|
-
Dominatrix.default_extensions.delete('.com')
|
117
|
-
|
118
|
-
Dominatrix.default_extensions.include? '.foo'
|
119
|
-
# => true
|
120
|
-
Dominatrix.default_extensions.include? '.com'
|
121
|
-
# => false
|
122
|
-
```
|
123
|
-
|
124
|
-
## Known Issues
|
125
|
-
|
126
|
-
This gem does not currently work with domains that require right-to-left
|
127
|
-
language support.
|
128
|
-
|
129
|
-
## Contributing
|
130
|
-
|
131
|
-
1. Fork it ( https://github.com/[my-github-username]/dominatrix/fork )
|
132
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
133
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
134
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
135
|
-
5. Create a new Pull Request
|
5
|
+
* [github.com/mhuggins/domainator](https://github.com/mhuggins/domainator)
|
6
|
+
* [rubygems.org/gems/domainator](http://rubygems.org/gems/domainator)
|
data/dominatrix.gemspec
CHANGED
@@ -21,4 +21,10 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency 'bundler', '~> 1.6'
|
22
22
|
spec.add_development_dependency 'rake'
|
23
23
|
spec.add_development_dependency 'rspec'
|
24
|
+
|
25
|
+
spec.post_install_message = <<-MESSAGE
|
26
|
+
! The 'dominatrix' gem has been deprecated and has been replaced by 'domainator'.
|
27
|
+
! See: https://rubygems.org/gems/domainator
|
28
|
+
! And: https://github.com/mhuggins/domainator
|
29
|
+
MESSAGE
|
24
30
|
end
|
data/lib/dominatrix.rb
CHANGED
@@ -8,6 +8,7 @@ class Dominatrix
|
|
8
8
|
attr_reader :extensions
|
9
9
|
|
10
10
|
def initialize(extensions = self.class.default_extensions)
|
11
|
+
warn '[DEPRECATION] Dominatrix has been renamed to Domainator and will no longer be supported. Please switch to Domainator as soon as possible.'
|
11
12
|
self.extensions = extensions
|
12
13
|
end
|
13
14
|
|
data/lib/dominatrix/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dominatrix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Huggins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -75,7 +75,10 @@ homepage: https://github.com/mhuggins/dominatrix
|
|
75
75
|
licenses:
|
76
76
|
- MIT
|
77
77
|
metadata: {}
|
78
|
-
post_install_message:
|
78
|
+
post_install_message: |2
|
79
|
+
! The 'dominatrix' gem has been deprecated and has been replaced by 'domainator'.
|
80
|
+
! See: https://rubygems.org/gems/domainator
|
81
|
+
! And: https://github.com/mhuggins/domainator
|
79
82
|
rdoc_options: []
|
80
83
|
require_paths:
|
81
84
|
- lib
|