uri-tag 0.0.1 → 0.0.2
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 +4 -4
- data/CHANGELOG.markdown +5 -0
- data/README.markdown +3 -0
- data/Rakefile +5 -3
- data/lib/uri/tag.rb +19 -7
- data/test/uri/test_uri-tag.rb +8 -2
- data/uri-tag.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eba57a59e170fd532f754455311164af281eea70
|
4
|
+
data.tar.gz: 1f05d8cdabab981a5bd9dcd7939d54a43b2ac69e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49fe88df2f397fc66a7f69644f9104329a9c074157a18842e2478d1aad111736a96399c3cb901f61f1be7ae0eb553d6b7d2997f03fd55e1c5056b5c56dbcf5a8
|
7
|
+
data.tar.gz: e3e52eb59c3293f144ab07a3f7e50539ba72b4f6fa8b91e1b64fc03fccb3d9fc345374bb18bbe50fd2e49e0e306b5365769a00d5916403119452987601e11d7d
|
data/CHANGELOG.markdown
CHANGED
data/README.markdown
CHANGED
data/Rakefile
CHANGED
@@ -4,13 +4,15 @@ require 'rdoc/task'
|
|
4
4
|
|
5
5
|
task :default => :test
|
6
6
|
|
7
|
+
GEMSPEC = Gem::Specification.load(File.join(__dir__, 'uri-tag.gemspec'))
|
8
|
+
|
7
9
|
Rake::TestTask.new do |task|
|
8
|
-
task.test_files =
|
10
|
+
task.test_files = GEMSPEC.test_files
|
9
11
|
end
|
10
12
|
|
11
13
|
Gem::Tasks.new
|
14
|
+
|
12
15
|
Rake::RDocTask.new do |task|
|
13
|
-
|
14
|
-
task.rdoc_files = spec.require_paths.inject([]) {|files, dir| files + Dir.glob("#{dir}/**/*.rb")} + spec.extra_rdoc_files
|
16
|
+
task.rdoc_files.include GEMSPEC.require_paths.inject([]) {|files, dir| files + Dir.glob("#{dir}/**/*.rb")}, GEMSPEC.extra_rdoc_files
|
15
17
|
task.main = 'README.markdown'
|
16
18
|
end
|
data/lib/uri/tag.rb
CHANGED
@@ -24,12 +24,7 @@ module URI
|
|
24
24
|
|
25
25
|
def self.build(args)
|
26
26
|
tmp = Util.make_components_hash(self, args)
|
27
|
-
|
28
|
-
tmp[:opaque] = '' << tmp[:authority] << ',' << tmp[:date] << ':'
|
29
|
-
|
30
|
-
if tmp[:specific]
|
31
|
-
tmp[:opaque] << tmp[:specific]
|
32
|
-
end
|
27
|
+
tmp[:opaque] = "%{authority},%{date}:%{specific}" % tmp
|
33
28
|
|
34
29
|
return super(tmp)
|
35
30
|
end
|
@@ -79,6 +74,23 @@ module URI
|
|
79
74
|
value
|
80
75
|
end
|
81
76
|
|
77
|
+
#
|
78
|
+
# == Description
|
79
|
+
#
|
80
|
+
# Returns Time object which represents date part
|
81
|
+
#
|
82
|
+
# Example:
|
83
|
+
#
|
84
|
+
# require 'uri/tag'
|
85
|
+
#
|
86
|
+
# uri = URI.parse('tag:example.org,2000:')
|
87
|
+
# uri.date_to_time # => 2000-01-01 00:00:00 UTC
|
88
|
+
# uri.date_to_time.class # => Time
|
89
|
+
#
|
90
|
+
def date_to_time
|
91
|
+
Time.utc(*date.split('-'))
|
92
|
+
end
|
93
|
+
|
82
94
|
protected
|
83
95
|
|
84
96
|
def set_authority(authority)
|
@@ -113,7 +125,7 @@ module URI
|
|
113
125
|
|
114
126
|
def check_specific(value)
|
115
127
|
if value !~ /\A#{SPECIFIC_PATTERN}\z/o
|
116
|
-
raise InvalidComponentError, "
|
128
|
+
raise InvalidComponentError, "bad component(expected specific component: #{value})"
|
117
129
|
end
|
118
130
|
|
119
131
|
return true
|
data/test/uri/test_uri-tag.rb
CHANGED
@@ -90,6 +90,7 @@ class TestTag < Test::Unit::TestCase
|
|
90
90
|
assert_raise InvalidComponentError do
|
91
91
|
@uri.specific = '#frag'
|
92
92
|
end
|
93
|
+
assert_equal '', URI.parse('tag:example.net,2000:').specific
|
93
94
|
end
|
94
95
|
|
95
96
|
def test_opaque
|
@@ -129,8 +130,13 @@ class TestTag < Test::Unit::TestCase
|
|
129
130
|
assert(URI.parse('tag:example.com,2000:') != URI.parse('tag:example.com,2000-01-01:'))
|
130
131
|
end
|
131
132
|
|
132
|
-
def
|
133
|
-
|
133
|
+
def test_date_to_time
|
134
|
+
assert_instance_of Time, @uri.date_to_time
|
135
|
+
assert @uri.date_to_time.utc?
|
136
|
+
%w[2000 2000-01 2000-01-01].each do |date|
|
137
|
+
@uri.date = date
|
138
|
+
assert_equal Time.new(2000, 1, 1, 0, 0, 0, '+00:00'), @uri.date_to_time
|
139
|
+
end
|
134
140
|
end
|
135
141
|
end
|
136
142
|
|
data/uri-tag.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "uri-tag"
|
3
|
-
spec.version = '0.0.
|
3
|
+
spec.version = '0.0.2'
|
4
4
|
spec.authors = ["KITAITI Makoto"]
|
5
5
|
spec.email = ["KitaitiMakoto@gmail.com"]
|
6
6
|
spec.summary = %q{This library extends standard bundled URI library to parse and build tag scheme URI defined in RFC 4151.}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uri-tag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- KITAITI Makoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|