uri_template 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,5 +1,10 @@
1
+ # 0.4.0 - 06.07.2012
2
+ + expand now accepts symbols as keys
3
+ + expand now accepts arrays of pairs
4
+ * fixed some testing bugs
5
+
1
6
  # 0.3.0 - 24.05.2012
2
- * Implemented the final version. Default implementation is now RFC 6570
7
+ + Implemented the final version. Default implementation is now RFC 6570
3
8
  * BUGFIX: variables with terminal dots were allowed
4
9
  * BUGFIX: lists of commas were parsed incorrectly
5
10
 
data/README CHANGED
@@ -1,5 +1,7 @@
1
1
  = URITemplate - a uri template library
2
2
 
3
+ {<img src="https://secure.travis-ci.org/hannesg/uri_template.png" />}[http://travis-ci.org/hannesg/uri_template] {<img src="https://gemnasium.com/hannesg/uri_template.png" />}[https://gemnasium.com/hannesg/uri_template]
4
+
3
5
  With URITemplate you can generate URI based on simple templates. The syntax if defined by RFC 6570 ( http://tools.ietf.org/html/rfc6570 ).
4
6
 
5
7
  For backward compatibility, there is an implementation based on draft 7 of the uri template spec ( http://tools.ietf.org/html/draft-gregorio-uritemplate-07 ), too. For the syntax read that spec. Draft 2 of that specification is implemented as addressable gem.
@@ -221,11 +221,19 @@ module URITemplate
221
221
 
222
222
  # Expands this uri template with the given variables.
223
223
  # The variables should be converted to strings using {Utils#object_to_param}.
224
+ #
225
+ # The keys in the variables hash are converted to
226
+ # strings in order to support the Ruby 1.9 hash syntax.
227
+ #
224
228
  # @raise {Unconvertable} if a variable could not be converted to a string.
225
229
  # @param variables Hash
226
230
  # @return String
227
231
  def expand(variables = {})
228
- raise ArgumentError, "Expected something that returns to :[], but got: #{variables.inspect}" unless variables.respond_to? :[]
232
+ raise ArgumentError, "Expected something that returns to :map, but got: #{variables.inspect}" unless variables.respond_to? :map
233
+
234
+ # Stringify variables
235
+ variables = Hash[variables.map{ |k, v| [k.to_s, v] }]
236
+
229
237
  tokens.map{|part|
230
238
  part.expand(variables)
231
239
  }.join
@@ -78,7 +78,6 @@ module URITemplate
78
78
  # @method to_ascii(string)
79
79
  # converts a string to ascii
80
80
  #
81
- # This method checks which encoding method is available.
82
81
  # @param str [String]
83
82
  # @return String
84
83
  # @visibility public
@@ -89,7 +88,6 @@ module URITemplate
89
88
  # @method to_utf8(string)
90
89
  # converts a string to utf8
91
90
  #
92
- # This method checks which encoding method is available.
93
91
  # @param str [String]
94
92
  # @return String
95
93
  # @visibility public
@@ -106,15 +104,15 @@ module URITemplate
106
104
  end
107
105
 
108
106
  if "".respond_to?(:encode)
109
- # @private
110
- alias_method :to_ascii, :to_ascii_encode
111
- # @private
112
- alias_method :to_utf8, :to_utf8_encode
107
+ # @api private
108
+ send(:alias_method, :to_ascii, :to_ascii_encode)
109
+ # @api private
110
+ send(:alias_method, :to_utf8, :to_utf8_encode)
113
111
  else
114
- # @private
115
- alias_method :to_ascii, :to_ascii_fallback
116
- # @private
117
- alias_method :to_utf8, :to_utf8_fallback
112
+ # @api private
113
+ send(:alias_method, :to_ascii, :to_ascii_fallback)
114
+ # @api private
115
+ send(:alias_method, :to_utf8, :to_utf8_fallback)
118
116
  end
119
117
 
120
118
  public :to_ascii
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'uri_template'
3
- s.version = '0.3.0'
4
- s.date = '2012-05-24'
3
+ s.version = '0.4.0'
4
+ s.date = '2012-07-06'
5
5
  s.authors = ["HannesG"]
6
6
  s.email = %q{hannes.georg@googlemail.com}
7
7
  s.summary = 'A templating system for URIs.'
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.3.0
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-24 00:00:00.000000000 Z
12
+ date: 2012-07-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
16
- requirement: &18775000 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *18775000
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: rspec
27
- requirement: &18773940 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '0'
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *18773940
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: yard
38
- requirement: &18773480 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: '0'
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *18773480
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: rake
49
- requirement: &18773060 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ! '>='
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: '0'
55
70
  type: :development
56
71
  prerelease: false
57
- version_requirements: *18773060
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: bundler
60
- requirement: &18772600 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ! '>='
@@ -65,7 +85,12 @@ dependencies:
65
85
  version: '0'
66
86
  type: :development
67
87
  prerelease: false
68
- version_requirements: *18772600
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
69
94
  description: ! 'A templating system for URIs, which implements RFC 6570: http://tools.ietf.org/html/rfc6570.
70
95
  An implementation of an older version of that spec is known as addressable. This
71
96
  gem however is intended to be extended when newer specs evolve. For now only draft
@@ -76,9 +101,9 @@ extensions: []
76
101
  extra_rdoc_files: []
77
102
  files:
78
103
  - lib/uri_template/utils.rb
79
- - lib/uri_template/draft7.rb
80
104
  - lib/uri_template/colon.rb
81
105
  - lib/uri_template/rfc6570.rb
106
+ - lib/uri_template/draft7.rb
82
107
  - lib/uri_template.rb
83
108
  - uri_template.gemspec
84
109
  - README
@@ -103,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
128
  version: '0'
104
129
  requirements: []
105
130
  rubyforge_project:
106
- rubygems_version: 1.8.17
131
+ rubygems_version: 1.8.24
107
132
  signing_key:
108
133
  specification_version: 3
109
134
  summary: A templating system for URIs.