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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/ro_crate/model/contextual_entity.rb +1 -2
- data/lib/ro_crate/model/entity.rb +6 -1
- data/ro_crate.gemspec +1 -1
- data/test/entity_test.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b489bc85ce753f46035d1f5843ac9539de35e1403b92a9139c19061901d6b2d6
|
4
|
+
data.tar.gz: 6aab0b3d9f9323d7470554d82a887376fc00db95f68d0fae011416c66eb38937
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55769c5b1a9b22ec5ad19e762ce9651e47407dbd01673c790c59753c6ac617cfa2ea81ecdcc6004313775069344845147c765e6396303491c94091e006c98b5b
|
7
|
+
data.tar.gz: 1798256fa994b7851da4b0adf0d78514aeaadc2e48935820d3c1f5dc546a8a633d5da11db19adeec7bd8763093a133744551e37f702d943a376c1b082e12d388
|
data/Gemfile.lock
CHANGED
@@ -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
|
-
|
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
|
-
|
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
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.
|
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-
|
11
|
+
date: 2022-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|