uri_template 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,7 +12,7 @@
12
12
  # You should have received a copy of the GNU General Public License
13
13
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
14
14
  #
15
- # (c) 2011 by Hannes Georg
15
+ # (c) 2011 - 2012 by Hannes Georg
16
16
  #
17
17
 
18
18
  module URITemplate
@@ -79,7 +79,7 @@ module URITemplate
79
79
  # converts a string to ascii
80
80
  #
81
81
  # This method checks which encoding method is available.
82
- # @param String
82
+ # @param str [String]
83
83
  # @return String
84
84
  # @visibility public
85
85
  def to_ascii_encode(str)
@@ -90,7 +90,7 @@ module URITemplate
90
90
  # converts a string to utf8
91
91
  #
92
92
  # This method checks which encoding method is available.
93
- # @param String
93
+ # @param str [String]
94
94
  # @return String
95
95
  # @visibility public
96
96
  def to_utf8_encode(str)
@@ -266,7 +266,7 @@ module URITemplate
266
266
  # @param x the value to convert
267
267
  # @param careful [true,false] wheter to check every array item. Use this when you expect array with subarrays which are not pairs. Setting this to false however improves runtime by ~30% even with comparetivly short arrays.
268
268
  def pair_array_to_hash(x, careful = false )
269
- if careful ? pair_array?(x) : (x.kind_of?(Array) and x.first.kind_of?(Array))
269
+ if careful ? pair_array?(x) : (x.kind_of?(Array) and ( x.empty? or x.first.kind_of?(Array) ) )
270
270
  return Hash[ *x.flatten(1) ]
271
271
  else
272
272
  return x
@@ -275,6 +275,24 @@ module URITemplate
275
275
 
276
276
  extend self
277
277
 
278
+ # @api privat
279
+ def pair_array_to_hash2(x)
280
+ c = {}
281
+ result = []
282
+
283
+ x.each do | (k,v) |
284
+ e = c[k]
285
+ if !e
286
+ result << c[k] = [k,v]
287
+ else
288
+ e[1] = [e[1]] unless e[1].kind_of? Array
289
+ e[1] << v
290
+ end
291
+ end
292
+
293
+ return result
294
+ end
295
+
278
296
  end
279
297
 
280
298
  end
@@ -1,17 +1,18 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'uri_template'
3
- s.version = '0.2.1'
4
- s.date = '2011-12-30'
3
+ s.version = '0.3.0'
4
+ s.date = '2012-05-24'
5
5
  s.authors = ["HannesG"]
6
6
  s.email = %q{hannes.georg@googlemail.com}
7
7
  s.summary = 'A templating system for URIs.'
8
8
  s.homepage = 'http://github.com/hannesg/uri_template'
9
- s.description = 'A templating system for URIs, which implements http://tools.ietf.org/html/draft-gregorio-uritemplate-07 . An implementation of an older version of that spec is known as addressable. This gem however is intended to be extended when newer specs evolve. For now only draft 7 and a simple colon based format are supported.'
9
+ s.description = 'A templating system for URIs, which implements RFC 6570: http://tools.ietf.org/html/rfc6570. An implementation of an older version of that spec is known as addressable. This gem however is intended to be extended when newer specs evolve. For now only draft 7 and a simple colon based format are supported.'
10
10
 
11
11
  s.require_paths = ['lib']
12
12
 
13
13
  s.files = Dir.glob('lib/**/**/*.rb') + ['uri_template.gemspec', 'README', 'CHANGELOG']
14
-
14
+
15
+ s.add_development_dependency 'multi_json'
15
16
  s.add_development_dependency 'rspec'
16
17
  s.add_development_dependency 'yard'
17
18
  s.add_development_dependency 'rake'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uri_template
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-30 00:00:00.000000000 Z
12
+ date: 2012-05-24 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: multi_json
16
+ requirement: &18775000 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *18775000
14
25
  - !ruby/object:Gem::Dependency
15
26
  name: rspec
16
- requirement: &7325660 !ruby/object:Gem::Requirement
27
+ requirement: &18773940 !ruby/object:Gem::Requirement
17
28
  none: false
18
29
  requirements:
19
30
  - - ! '>='
@@ -21,10 +32,10 @@ dependencies:
21
32
  version: '0'
22
33
  type: :development
23
34
  prerelease: false
24
- version_requirements: *7325660
35
+ version_requirements: *18773940
25
36
  - !ruby/object:Gem::Dependency
26
37
  name: yard
27
- requirement: &7325220 !ruby/object:Gem::Requirement
38
+ requirement: &18773480 !ruby/object:Gem::Requirement
28
39
  none: false
29
40
  requirements:
30
41
  - - ! '>='
@@ -32,10 +43,10 @@ dependencies:
32
43
  version: '0'
33
44
  type: :development
34
45
  prerelease: false
35
- version_requirements: *7325220
46
+ version_requirements: *18773480
36
47
  - !ruby/object:Gem::Dependency
37
48
  name: rake
38
- requirement: &7324800 !ruby/object:Gem::Requirement
49
+ requirement: &18773060 !ruby/object:Gem::Requirement
39
50
  none: false
40
51
  requirements:
41
52
  - - ! '>='
@@ -43,10 +54,10 @@ dependencies:
43
54
  version: '0'
44
55
  type: :development
45
56
  prerelease: false
46
- version_requirements: *7324800
57
+ version_requirements: *18773060
47
58
  - !ruby/object:Gem::Dependency
48
59
  name: bundler
49
- requirement: &7324380 !ruby/object:Gem::Requirement
60
+ requirement: &18772600 !ruby/object:Gem::Requirement
50
61
  none: false
51
62
  requirements:
52
63
  - - ! '>='
@@ -54,20 +65,21 @@ dependencies:
54
65
  version: '0'
55
66
  type: :development
56
67
  prerelease: false
57
- version_requirements: *7324380
58
- description: A templating system for URIs, which implements http://tools.ietf.org/html/draft-gregorio-uritemplate-07
59
- . An implementation of an older version of that spec is known as addressable. This
68
+ version_requirements: *18772600
69
+ description: ! 'A templating system for URIs, which implements RFC 6570: http://tools.ietf.org/html/rfc6570.
70
+ An implementation of an older version of that spec is known as addressable. This
60
71
  gem however is intended to be extended when newer specs evolve. For now only draft
61
- 7 and a simple colon based format are supported.
72
+ 7 and a simple colon based format are supported.'
62
73
  email: hannes.georg@googlemail.com
63
74
  executables: []
64
75
  extensions: []
65
76
  extra_rdoc_files: []
66
77
  files:
67
- - lib/uri_template.rb
68
- - lib/uri_template/colon.rb
69
- - lib/uri_template/draft7.rb
70
78
  - lib/uri_template/utils.rb
79
+ - lib/uri_template/draft7.rb
80
+ - lib/uri_template/colon.rb
81
+ - lib/uri_template/rfc6570.rb
82
+ - lib/uri_template.rb
71
83
  - uri_template.gemspec
72
84
  - README
73
85
  - CHANGELOG
@@ -91,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
103
  version: '0'
92
104
  requirements: []
93
105
  rubyforge_project:
94
- rubygems_version: 1.8.10
106
+ rubygems_version: 1.8.17
95
107
  signing_key:
96
108
  specification_version: 3
97
109
  summary: A templating system for URIs.