ryodo 0.1.0.1 → 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.
- data/README.md +13 -2
- data/VERSION +1 -1
- data/lib/ryodo.rb +1 -1
- data/lib/ryodo/domain.rb +12 -1
- data/lib/ryodo/ext/string.rb +4 -0
- data/lib/ryodo/methods.rb +5 -0
- data/ryodo.gemspec +2 -2
- metadata +3 -3
data/README.md
CHANGED
@@ -48,12 +48,23 @@ Ryodo.parse("my.awesome.domain.co.jp")
|
|
48
48
|
Ryodo("my.awesome.domain.co.jp")
|
49
49
|
Ryodo["my.awesome.domain.co.jp"]
|
50
50
|
ryodo("my.awesome.domain.co.jp")
|
51
|
+
```
|
52
|
+
|
53
|
+
### String extension
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
require "ryodo/ext/string"
|
51
57
|
|
52
|
-
# String extension
|
53
58
|
"my.awesome.domain.co.jp".to_domain
|
54
59
|
"my.awesome.domain.co.jp".ryodo
|
55
60
|
```
|
56
61
|
|
62
|
+
In Gemfile:
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
gem "ryodo", :require => ["ryodo", "ryodo/ext/string"]
|
66
|
+
```
|
67
|
+
|
57
68
|
### UTF-8 junkie?
|
58
69
|
|
59
70
|
```ruby
|
@@ -83,7 +94,7 @@ uri.host.domain
|
|
83
94
|
In Gemfile:
|
84
95
|
|
85
96
|
```ruby
|
86
|
-
gem "ryodo", :require => ["ryodo","ryodo/ext/uri"]
|
97
|
+
gem "ryodo", :require => ["ryodo", "ryodo/ext/uri"]
|
87
98
|
```
|
88
99
|
|
89
100
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/ryodo.rb
CHANGED
data/lib/ryodo/domain.rb
CHANGED
@@ -38,8 +38,9 @@ module Ryodo
|
|
38
38
|
|
39
39
|
parts = Ryodo::Parser.run(@domain_string)
|
40
40
|
|
41
|
-
@suffix = no_leading_dot && parts ?
|
41
|
+
@suffix = no_leading_dot && parts ? parts[0].reverse.join(".") : nil
|
42
42
|
@domain = no_leading_dot && parts && !parts[1].empty? ? (parts[0] + parts[1]).reverse.join(".") : nil
|
43
|
+
@secondary = no_leading_dot && parts && !parts[1].empty? ? parts[1].first : nil
|
43
44
|
@subdomain = no_leading_dot && parts && !parts[2].empty? ? (parts[2]).reverse.join(".") : nil
|
44
45
|
end
|
45
46
|
|
@@ -54,6 +55,12 @@ module Ryodo
|
|
54
55
|
alias_method :registered_domain, :domain
|
55
56
|
alias_method :regdomain, :domain
|
56
57
|
|
58
|
+
def second_level
|
59
|
+
DomainString.new @secondary if @secondary
|
60
|
+
end
|
61
|
+
alias_method :sld, :second_level
|
62
|
+
alias_method :registered_name, :second_level
|
63
|
+
|
57
64
|
def subdomain
|
58
65
|
DomainString.new @subdomain if @subdomain
|
59
66
|
end
|
@@ -62,6 +69,10 @@ module Ryodo
|
|
62
69
|
DomainString.new "#{to_s}."
|
63
70
|
end
|
64
71
|
|
72
|
+
def is_valid?
|
73
|
+
!!@suffix && !!@secondary
|
74
|
+
end
|
75
|
+
|
65
76
|
def to_s
|
66
77
|
@domain_string
|
67
78
|
end
|
data/lib/ryodo/ext/string.rb
CHANGED
data/lib/ryodo/methods.rb
CHANGED
data/ryodo.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "ryodo"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Christoph Grabo"]
|
12
|
-
s.date = "2012-06-
|
12
|
+
s.date = "2012-06-08"
|
13
13
|
s.description = "ry\u{14d}do\u{3010}\u{9818}\u{571f}\u{3011} \u{308a}\u{3087}\u{3046}\u{3069} \u{2014} A domain name parser gem using public suffix list (provided by publicsuffix.org/mozilla)"
|
14
14
|
s.email = "chris@dinarrr.com"
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ryodo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -179,7 +179,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
179
179
|
version: '0'
|
180
180
|
segments:
|
181
181
|
- 0
|
182
|
-
hash:
|
182
|
+
hash: -3115775854791943199
|
183
183
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
184
184
|
none: false
|
185
185
|
requirements:
|