ro-crate 0.4.15 → 0.4.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 92f4b8cd765215082edea1be4e3c065a29ddcdbbc43a79576a4782ba8d797f07
4
- data.tar.gz: d8936210124988edd8fd942c978a93ea6ee6f17fa1bcbfd3b6528e7475143ca1
3
+ metadata.gz: b489bc85ce753f46035d1f5843ac9539de35e1403b92a9139c19061901d6b2d6
4
+ data.tar.gz: 6aab0b3d9f9323d7470554d82a887376fc00db95f68d0fae011416c66eb38937
5
5
  SHA512:
6
- metadata.gz: cf88d846278c037fd4437db9f1cd5f3fd31d6901eeb161a38417a5919edaf9e013f28cfadea7a59bf77a687c5946f540ee6cfa28ccc001d473dac41eaf3c5f3e
7
- data.tar.gz: ab8413b46ad23145ca6d68f2554cad6eacb9f2ecd349e890b6380295029da5426110e447c863170d997071a6dba3f76c72006ca6a90b9a456ac96858e114aa86
6
+ metadata.gz: 55769c5b1a9b22ec5ad19e762ce9651e47407dbd01673c790c59753c6ac617cfa2ea81ecdcc6004313775069344845147c765e6396303491c94091e006c98b5b
7
+ data.tar.gz: 1798256fa994b7851da4b0adf0d78514aeaadc2e48935820d3c1f5dc546a8a633d5da11db19adeec7bd8763093a133744551e37f702d943a376c1b082e12d388
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ro-crate (0.4.15)
4
+ ro-crate (0.4.16)
5
5
  addressable (>= 2.7, < 2.9)
6
6
  rubyzip (~> 2.0.0)
7
7
 
@@ -4,8 +4,7 @@ module ROCrate
4
4
  # Contextual Entities are used to describe and provide context to the Data Entities within the crate.
5
5
  class ContextualEntity < Entity
6
6
  def self.format_local_id(id)
7
- i = super
8
- i.start_with?('#') ? i : "##{i}"
7
+ super(id.start_with?('#') ? id : "##{id}")
9
8
  end
10
9
 
11
10
  ##
@@ -57,7 +57,12 @@ module ROCrate
57
57
  # @param id [String] The candidate local ID to be formatted.
58
58
  # @return [String] The formatted local ID.
59
59
  def self.format_local_id(id)
60
- Addressable::URI.escape(id.sub(/\A\.\//, '')) # Remove initial ./ if present
60
+ if id.start_with?('#')
61
+ '#' + Addressable::URI.encode_component(id[1..-1], Addressable::URI::CharacterClasses::QUERY)
62
+ else
63
+ # Remove initial ./ if present
64
+ Addressable::URI.encode_component(id.sub(/\A\.\//, ''), Addressable::URI::CharacterClasses::PATH)
65
+ end
61
66
  end
62
67
 
63
68
  ##
data/ro_crate.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'ro-crate'
3
- s.version = '0.4.15'
3
+ s.version = '0.4.16'
4
4
  s.summary = 'Create, manipulate, read RO-Crates.'
5
5
  s.authors = ['Finn Bacall']
6
6
  s.email = 'finn.bacall@manchester.ac.uk'
data/test/entity_test.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'test_helper'
2
3
 
3
4
  class EntityTest < Test::Unit::TestCase
@@ -75,6 +76,7 @@ class EntityTest < Test::Unit::TestCase
75
76
  assert_equal "#Hello%20World/Goodbye%20World", ROCrate::ContextualEntity.format_id('#Hello World/Goodbye World')
76
77
  assert_equal "#Hello%20World/Goodbye%20World", ROCrate::ContextualEntity.format_id('Hello World/Goodbye World')
77
78
  assert_equal "#%F0%9F%98%8A", ROCrate::ContextualEntity.format_id("😊")
79
+ assert_equal "https://orcid.org/0000-0002-0048-3300", ROCrate::ContextualEntity.format_id("https://orcid.org/0000-0002-0048-3300")
78
80
 
79
81
  assert_equal "test123/hello.txt", ROCrate::File.format_id('./test123/hello.txt')
80
82
  assert_equal "test123/hello.txt", ROCrate::File.format_id('./test123/hello.txt/')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ro-crate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.15
4
+ version: 0.4.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Finn Bacall
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-15 00:00:00.000000000 Z
11
+ date: 2022-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable