semantic_naming 2.2.1 → 2.2.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.
@@ -256,13 +256,13 @@ module N
256
256
  # Encodes the uri in a modified base64 format that will always form a legal
257
257
  # HTML id tag.
258
258
  def safe_encoded
259
- 'uri_' << Base64.encode64(@uri_s).gsub(/==\s*\Z/, '').gsub('+', '_').gsub('/', '-')
259
+ 'uri_' << Base64.encode64(@uri_s).gsub('=', ':').gsub('+', '_').gsub('/', '-').gsub(/\s/, '')
260
260
  end
261
261
 
262
262
 
263
263
  # Creates a new URI object from a string that was encoded with #safe_encoded
264
264
  def self.from_encoded(encoded_uri)
265
- uri = Base64.decode64(encoded_uri.gsub(/\Auri_/, '').gsub('_', '+').gsub('-', '/') + '==')
265
+ uri = Base64.decode64(encoded_uri.gsub(/\Auri_/, '').gsub('_', '+').gsub('-', '/').gsub(':', '='))
266
266
  self.new(uri)
267
267
  end
268
268
 
data/test/uri_test.rb CHANGED
@@ -226,11 +226,11 @@ class URITest < Test::Unit::TestCase
226
226
 
227
227
  def test_encode_uri
228
228
  uri = N::URI.new(N::RDFTEST::encoding)
229
- assert_equal('uri_aHR0cDovL3JkZnRlc3RkdW1teS9lbmNvZGluZw', uri.safe_encoded)
229
+ assert_equal('uri_aHR0cDovL3JkZnRlc3RkdW1teS9lbmNvZGluZw::', uri.safe_encoded)
230
230
  end
231
231
 
232
232
  def test_from_encoded
233
- uri = N::URI.from_encoded('uri_aHR0cDovL3JkZnRlc3RkdW1teS9lbmNvZGluZw')
233
+ uri = N::URI.from_encoded('uri_aHR0cDovL3JkZnRlc3RkdW1teS9lbmNvZGluZw::')
234
234
  assert_equal(N::RDFTEST::encoding, uri)
235
235
  end
236
236
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semantic_naming
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Hahn