pubid-core 1.10.2 → 1.10.4

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: ebe928af0a08e530bc616c88526fa076841d66f32fdb075640f67b7a72847b83
4
- data.tar.gz: 438ade1f287d204a01aea76ea44e2bbc6cac186fd73bf5332bc1974dcec45df6
3
+ metadata.gz: c3e8a5c951d09085272bd38ce431166aa6c9022c1bc05849843cccd7cb088923
4
+ data.tar.gz: e6787ce70f4c22a3122eb1f83d9d71a8320842cae23793bae8b70d9f717aea3c
5
5
  SHA512:
6
- metadata.gz: b4d60fc2b2dc1f146a31f3b03275522d598b18adc8e86c9b229fd9cea4375c851fea88b02e96ff74e2c55d6e215e849ec7f026f53fa34d18a77a47d7e2312a81
7
- data.tar.gz: 8d7e1fffb7cf18ff56524be8187fb4895a2e1043ccc1941c9a6500f834bf566461758cca8aac34be8c64bc637610602d65129e4b658e76a973ac91ea4a7a5541
6
+ metadata.gz: 99f9146360a1c236b50624888c86e5bad0240cc0b61feb7baced9bbcb8d1858f2f8cc0fd3f22198ce2644fe834ce2bbd08aa3bbe52cbe5c3f41d9b4197dd4249
7
+ data.tar.gz: 19f5b3f0faf42c2555cbfd4dd23d7f1c4d6463f6a0b39e41774db395b1c6600ef2a66a151ef35f2be7b09ce7e145487427e69a8cdb8462f96ff0e58e1cc5b1f7
@@ -63,15 +63,17 @@ module Pubid::Core
63
63
  end
64
64
 
65
65
  # @return [Hash] Identifier's parameters
66
- def to_h
66
+ def to_h(deep: true)
67
67
  instance_variables.map do |var|
68
68
  value = instance_variable_get(var)
69
69
 
70
70
  [var.to_s.gsub("@", "").to_sym,
71
71
  if value.is_a?(Array)
72
- value.map { |v| v.respond_to?(:to_h) ? v.to_h : v }
72
+ value.map { |v| (v.respond_to?(:to_h) && deep) ? v.to_h : v }
73
+ elsif value.nil?
74
+ nil
73
75
  else
74
- value.respond_to?(:to_h) ? value.to_h : value
76
+ (value.respond_to?(:to_h) && deep) ? value.to_h : value
75
77
  end
76
78
  ]
77
79
  end.to_h
@@ -83,7 +85,7 @@ module Pubid::Core
83
85
 
84
86
  # Render identifier using default renderer
85
87
  def to_s
86
- self.class.get_renderer_class.new(to_h).render
88
+ self.class.get_renderer_class.new(to_h(deep: false)).render
87
89
  end
88
90
 
89
91
  def exclude(*attrs)
@@ -1,5 +1,5 @@
1
1
  module Pubid
2
2
  module Core
3
- VERSION = "1.10.2".freeze
3
+ VERSION = "1.10.4".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: 1.10.2
4
+ version: 1.10.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-04 00:00:00.000000000 Z
11
+ date: 2023-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake