pubid-core 0.2.1 → 0.2.2

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: 8847ef40fe0ba41c09fa45dd46c2451d3d5f855a95528f740211a5558197b7b4
4
- data.tar.gz: 200ac6ed205bfd7a2f145995f070f45725fbcf20fc7e9ad70739781bbaf0e0fa
3
+ metadata.gz: 5961503e7e921ca44202798588badd95d5977fd62fbf98275777770439b5da17
4
+ data.tar.gz: 2840650728ca920a51a615d2ee81e2884607e485e7740fdd4fc4279cb34cb6fd
5
5
  SHA512:
6
- metadata.gz: 7a1c32702076a06496b53347c050db49b563543749a001f0876a1b0c4da61dee598bacb70a46bea8707ec6d97d9046a9f1bacaa89e3255d6ffb80c7ac0c69a80
7
- data.tar.gz: d426ab52f5f2e81dd90fdcbc435910f9e71ff4347d980260743975408d060b7e0b5462b8b990cd8248298b47716b1750a666b07d33ccc4562d2d2f3bb77cfc78
6
+ metadata.gz: 9a956ff7eb7a323b86e3c8656e4396d0c8af503a89f05c96dbd9ff3cc37ec1f6f43ae8a1111eb6c1437b98d3a846f62e0a72b658e2d89a207099351327953c2e
7
+ data.tar.gz: d55c54c9dc464c01af7bda543bf482d82472ab169101759b510793824e4ee963725e43fe5a486c05627f886f0111e7525fff05d1bd3beafe7612dbe93abe2b87
@@ -56,8 +56,18 @@ module Pubid::Core
56
56
  Transformer
57
57
  end
58
58
 
59
+ def update_old_code(code)
60
+ return code unless defined?(UPDATE_CODES)
61
+
62
+ UPDATE_CODES.each do |from, to|
63
+ code = code.gsub(from.match?(/^\/.*\/$/) ? Regexp.new(from[1..-2]) : /^#{Regexp.escape(from)}$/, to)
64
+ end
65
+ code
66
+ end
67
+
59
68
  def parse(code_or_params)
60
- params = code_or_params.is_a?(String) ? get_parser_class.new.parse(code_or_params) : code_or_params
69
+ params = code_or_params.is_a?(String) ?
70
+ get_parser_class.new.parse(update_old_code(code_or_params)) : code_or_params
61
71
  # Parslet returns an array when match any copublisher
62
72
  # otherwise it's hash
63
73
  if params.is_a?(Array)
@@ -1,5 +1,5 @@
1
1
  module Pubid
2
2
  module Core
3
- VERSION = "0.2.1".freeze
3
+ VERSION = "0.2.2".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubid-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
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-06-22 00:00:00.000000000 Z
11
+ date: 2022-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake