pubid-iso 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pubid/iso/identifier.rb +9 -0
- data/lib/pubid/iso/version.rb +1 -1
- 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: d3db426781c12fb80bbd99118bc9b601fe93473d0c9b395f88929ac8eb3b996d
|
4
|
+
data.tar.gz: 7e2c155d3397e1ac4888258c680357b204edb8252a3e03fa8d336292be85ccbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 765bdaef471049f21f15ba5cf9f45bbb42edfe88baf53ee5f67d155fdba6f0b8ef8a1b8cf212a9f6d3d35ce289946c6c5281efd94e913d59274b9ea1a7143e8c
|
7
|
+
data.tar.gz: 628307f60259f11b97476d893861b73f1042104c940958ee695acc24069033e4689b0bfe490a641a6c7d557a5f8635ec6cf2140bed56d594910c8e2c46670d6f
|
data/lib/pubid/iso/identifier.rb
CHANGED
@@ -27,6 +27,15 @@ module Pubid::Iso
|
|
27
27
|
Urn.new(**get_params)
|
28
28
|
end
|
29
29
|
|
30
|
+
def self.parse_from_title(title)
|
31
|
+
title.split.reverse.inject(title) do |acc, part|
|
32
|
+
return parse(acc)
|
33
|
+
rescue Pubid::Iso::Errors::ParseError
|
34
|
+
# delete parts from the title until it's parseable
|
35
|
+
acc.reverse.sub(part.reverse, "").reverse.strip
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
30
39
|
def self.parse(code_or_params)
|
31
40
|
params = code_or_params.is_a?(String) ? Parser.new.parse(code_or_params) : code_or_params
|
32
41
|
# Parslet returns an array when match any copublisher
|
data/lib/pubid/iso/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pubid-iso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|