murlsh 0.5.0 → 0.5.1
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/VERSION +1 -1
- data/lib/murlsh/uri.rb +5 -1
- data/lib/murlsh/url_body.rb +1 -1
- data/murlsh.gemspec +3 -1
- data/public/js/js.js +1 -1
- data/test/uri_test.rb +21 -0
- metadata +3 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.1
|
data/lib/murlsh/uri.rb
CHANGED
@@ -4,7 +4,11 @@ require 'uri'
|
|
4
4
|
class URI::Generic
|
5
5
|
|
6
6
|
# Return the domain.
|
7
|
-
def domain
|
7
|
+
def domain
|
8
|
+
if (host and (d = host[/[a-z\d-]+\.[a-z]{2,}(\.[a-z]{2})?$/]))
|
9
|
+
d.downcase
|
10
|
+
end
|
11
|
+
end
|
8
12
|
|
9
13
|
# Return the path and query string.
|
10
14
|
def path_query; path + (query ? "?#{query}" : ''); end
|
data/lib/murlsh/url_body.rb
CHANGED
data/murlsh.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{murlsh}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Matthew M. Boedicker"]
|
@@ -60,6 +60,7 @@ Gem::Specification.new do |s|
|
|
60
60
|
"test/auth_test.rb",
|
61
61
|
"test/markup_test.rb",
|
62
62
|
"test/uri_ask_test.rb",
|
63
|
+
"test/uri_test.rb",
|
63
64
|
"test/xhtml_response_test.rb"
|
64
65
|
]
|
65
66
|
s.homepage = %q{http://github.com/mmb/murlsh}
|
@@ -71,6 +72,7 @@ Gem::Specification.new do |s|
|
|
71
72
|
"test/xhtml_response_test.rb",
|
72
73
|
"test/uri_ask_test.rb",
|
73
74
|
"test/markup_test.rb",
|
75
|
+
"test/uri_test.rb",
|
74
76
|
"test/atom_feed_test.rb",
|
75
77
|
"test/auth_test.rb"
|
76
78
|
]
|
data/public/js/js.js
CHANGED
data/test/uri_test.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
|
3
|
+
require 'murlsh'
|
4
|
+
|
5
|
+
require 'test/unit'
|
6
|
+
|
7
|
+
class UriTest < Test::Unit::TestCase
|
8
|
+
|
9
|
+
def test_good
|
10
|
+
assert_equal('foo.com', URI('http://foo.com/').domain)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_invalid
|
14
|
+
assert_nil(URI('foo').domain)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_trailing_dot
|
18
|
+
assert_nil(URI('http://foo.com.').domain)
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: murlsh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew M. Boedicker
|
@@ -133,6 +133,7 @@ files:
|
|
133
133
|
- test/auth_test.rb
|
134
134
|
- test/markup_test.rb
|
135
135
|
- test/uri_ask_test.rb
|
136
|
+
- test/uri_test.rb
|
136
137
|
- test/xhtml_response_test.rb
|
137
138
|
has_rdoc: true
|
138
139
|
homepage: http://github.com/mmb/murlsh
|
@@ -166,5 +167,6 @@ test_files:
|
|
166
167
|
- test/xhtml_response_test.rb
|
167
168
|
- test/uri_ask_test.rb
|
168
169
|
- test/markup_test.rb
|
170
|
+
- test/uri_test.rb
|
169
171
|
- test/atom_feed_test.rb
|
170
172
|
- test/auth_test.rb
|