pubid-iso 0.1.11 → 0.1.12

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: 5970af41e67f70e22e928d11ac1eabd71d42ca1855f5d3d6254dea8f98844aab
4
- data.tar.gz: fface01211f338c08b5ab853be7a48573400e4ca8c290bca9f52e9f6d9361c89
3
+ metadata.gz: e97d39eae4c4c0962361910084b0ba9ed9613a01761214d2f4a0750e0c71fe39
4
+ data.tar.gz: 0b41fc99349db1c5c5672e690305561e01dac3503d7c226b049bada4fcf857b7
5
5
  SHA512:
6
- metadata.gz: 7b4431cc30c76062a19fc1531ad3e2b57ec2b31b0fc9604672ad9a6a3a5908fc756c256f5552d94b0165b36f5032df084250b68fe7c884435339e6628ec365ba
7
- data.tar.gz: b0d2a810b02ceff7044fe35a88a81e3ef2c5feb0a39a8592655136d4b9f0bd6d3ab01e3fb325a743843e057cc816930bfeb09f6cb0d0b45c586b6a8f127bee9d
6
+ metadata.gz: 7859c8ac83fc94369f1fab9fc6d4c7529cc49d35a5a09c2fa34dda3b95b2d21d1cd5917e277e6c63bbf96ec174496494ca328f8fff0d995e59ae160423d0ba01
7
+ data.tar.gz: 7a104ec181c49142996ef2133648a9145a2c0a0d01a05348abddf362285327d915e59d0b283913113b03bd343ee44f5f5de5265ba111ad21ed2da25bffee2ef8
@@ -40,10 +40,10 @@ module Pubid::Iso
40
40
  raise Errors::SupplementWithoutYearError, "Cannot apply supplement to document without edition year"
41
41
  end
42
42
  if stage
43
- if stage.abbr == "IS" && iteration
43
+ @stage = (stage.is_a?(Symbol) || stage.is_a?(String)) ? Stage.new(abbr: stage) : stage
44
+ if @stage.abbr == "IS" && iteration
44
45
  raise Errors::IsStageIterationError, "IS stage document cannot have iteration"
45
46
  end
46
- @stage = stage
47
47
  end
48
48
  @iteration = iteration.to_i if iteration
49
49
  @supplement = supplement if supplement
@@ -63,7 +63,7 @@ module Pubid::Iso
63
63
  (space | str(".")).repeat(1).maybe >>
64
64
  digits.as(:number) >>
65
65
  (str(".") >> digits.as(:iteration)).maybe >>
66
- ((str(":") | str("-")) >> digits.as(:year)).maybe).as(:amendments)
66
+ ((str(":") | str("-")) >> digits.as(:year)).maybe).repeat(1).as(:amendments)
67
67
  end
68
68
 
69
69
  rule(:corrigendum) do
@@ -73,7 +73,7 @@ module Pubid::Iso
73
73
  (space | str(".")).repeat(1).maybe >>
74
74
  digits.as(:number) >>
75
75
  (str(".") >> digits.as(:iteration)).maybe >>
76
- ((str(":") | str("-")) >> digits.as(:year)).maybe).as(:corrigendums)
76
+ ((str(":") | str("-")) >> digits.as(:year)).maybe).repeat(1).as(:corrigendums)
77
77
  end
78
78
 
79
79
  rule(:language) do
@@ -9,7 +9,7 @@ module Pubid::Iso
9
9
  # @see Pubid::Core::Supplement for other options
10
10
  def initialize(stage: nil, publisher: nil, edition: nil, iteration: nil, **args)
11
11
  super(**args)
12
- @stage = stage
12
+ @stage = (stage.is_a?(Symbol) || stage.is_a?(String)) ? Stage.new(abbr: stage) : stage
13
13
  @publisher = publisher.to_s
14
14
  @edition = edition&.to_i
15
15
  @iteration = iteration&.to_i
@@ -10,23 +10,25 @@ module Pubid::Iso
10
10
 
11
11
  rule(amendments: subtree(:amendments)) do |context|
12
12
  context[:amendments] =
13
- [Amendment.new(
14
- number: context[:amendments][:number],
15
- year: context[:amendments][:year],
16
- stage: context[:amendments][:stage] && convert_stage(context[:amendments][:stage]),
17
- iteration: context[:amendments][:iteration])]
18
-
13
+ context[:amendments].map do |amendment|
14
+ Amendment.new(
15
+ number: amendment[:number],
16
+ year: amendment[:year],
17
+ stage: amendment[:stage] && convert_stage(amendment[:stage]),
18
+ iteration: amendment[:iteration])
19
+ end
19
20
  context
20
21
  end
21
22
 
22
23
  rule(corrigendums: subtree(:corrigendums)) do |context|
23
24
  context[:corrigendums] =
24
- [Corrigendum.new(
25
- number: context[:corrigendums][:number],
26
- year: context[:corrigendums][:year],
27
- stage: context[:corrigendums][:stage] && convert_stage(context[:corrigendums][:stage]),
28
- iteration: context[:corrigendums][:iteration])]
29
-
25
+ context[:corrigendums].map do |corrigendum|
26
+ Corrigendum.new(
27
+ number: corrigendum[:number],
28
+ year: corrigendum[:year],
29
+ stage: corrigendum[:stage] && convert_stage(corrigendum[:stage]),
30
+ iteration: corrigendum[:iteration])
31
+ end
30
32
  context
31
33
  end
32
34
 
@@ -1,5 +1,5 @@
1
1
  module Pubid
2
2
  module Iso
3
- VERSION = "0.1.11".freeze
3
+ VERSION = "0.1.12".freeze
4
4
  end
5
5
  end
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.11
4
+ version: 0.1.12
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-09-16 00:00:00.000000000 Z
11
+ date: 2022-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 1.1.2
103
+ version: 1.2.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 1.1.2
110
+ version: 1.2.0
111
111
  description: Library to generate, parse and manipulate ISO PubID.
112
112
  email:
113
113
  - open.source@ribose.com