relaton-bib 1.19.2 → 1.19.3

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: b9d25f7a3197e13a268ac65f498dd9122c89bdbcbb270f999773ce77898fb0df
4
- data.tar.gz: ef52d177ebc581ec707f97e34f7af095a4ed97bc99aa9095b58e8bc360bcfca3
3
+ metadata.gz: d3a558692c0fed85db446e5e09bc97b88cd593b950c56deea611644a51ea541e
4
+ data.tar.gz: 5714aa8ce2e246e41477370b0562762b9ab242ae93c78ec71ef2d62e517ad54c
5
5
  SHA512:
6
- metadata.gz: 9c4b66e2a97ef5dc7e4ada16c2e49bb3d9d0e30bfc1c00565451cfa90124475c2134dd1adfef17f71eec091ef338e781472d9ea72c602dff125c8e79dbe4047a
7
- data.tar.gz: 16e83196283dc4cdf84282786ea72c2649cfdb1dbfe2e49c0f5dcb2511fc74f43d5455188b44fdb06d3497ae8bd01dc9892e2b3586b715c37e44d422e89288a9
6
+ metadata.gz: 034d246df4a77e85fe262e54bcab074747aa4260e3dfb17e619630e8181f3c3e869333099d69a2296a216d192e855496738eb29a8f6bcab08ac0ecedd8fbd395
7
+ data.tar.gz: 68df9e862afcdfd8f026647af0b0aa1e20c78fa50b08225f80cc7a950d450302fbc79f8e76c8741b6104b861c190ce6d587b1b64e7db96c8d43a7b93c45addd8
@@ -1,32 +1,29 @@
1
1
  module RelatonBib
2
2
  class Image
3
3
  # @return [String]
4
- attr_reader :id, :src, :mimetype, :filename, :width, :height, :alt, :title, :longdesc
4
+ attr_accessor :src, :mimetype
5
+
6
+ # @return [String, nil]
7
+ attr_accessor :id, :filename, :width, :height, :alt, :title, :longdesc
5
8
 
6
9
  #
7
10
  # Initializes a new Image object.
8
11
  #
9
- # @param id [String] the ID of the image
10
12
  # @param src [String] the source URL of the image
11
13
  # @param mimetype [String] the MIME type of the image
12
14
  # @param args [Hash] additional arguments
13
- # @option args [String] :filename the filename of the image
14
- # @option args [String] :width the width of the image
15
- # @option args [String] :height the height of the image
16
- # @option args [String] :alt the alternative text for the image
17
- # @option args [String] :title the title of the image
18
- # @option args [String] :longdesc the long description of the image
15
+ # @option id [String, nil] the ID of the image
16
+ # @option args [String, nil] :filename the filename of the image
17
+ # @option args [String, nil] :width the width of the image
18
+ # @option args [String, nil] :height the height of the image
19
+ # @option args [String, nil] :alt the alternative text for the image
20
+ # @option args [String, nil] :title the title of the image
21
+ # @option args [String, nil] :longdesc the long description of the image
19
22
  #
20
- def initialize(id:, src:, mimetype:, **args)
21
- @id = id
23
+ def initialize(src:, mimetype:, **args)
22
24
  @src = src
23
25
  @mimetype = mimetype
24
- @filename = args[:filename]
25
- @width = args[:width]
26
- @height = args[:height]
27
- @alt = args[:alt]
28
- @title = args[:title]
29
- @longdesc = args[:longdesc]
26
+ args.each { |k, v| send "#{k}=", v }
30
27
  end
31
28
 
32
29
  def ==(other)
@@ -44,7 +41,7 @@ module RelatonBib
44
41
  #
45
42
  def to_xml(builder) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength
46
43
  builder.image do
47
- builder.parent[:id] = id
44
+ builder.parent[:id] = id if id
48
45
  builder.parent[:src] = src
49
46
  builder.parent[:mimetype] = mimetype
50
47
  builder.parent[:filename] = filename if filename
@@ -62,7 +59,8 @@ module RelatonBib
62
59
  # @return [Hash] The hash representation of the Image object.
63
60
  #
64
61
  def to_hash # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity
65
- hash = { "image" => { "id" => id, "src" => src, "mimetype" => mimetype } }
62
+ hash = { "image" => { "src" => src, "mimetype" => mimetype } }
63
+ hash["image"]["id"] = id if id
66
64
  hash["image"]["filename"] = filename if filename
67
65
  hash["image"]["width"] = width if width
68
66
  hash["image"]["height"] = height if height
@@ -81,7 +79,8 @@ module RelatonBib
81
79
  #
82
80
  def to_asciibib(prefix = "") # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity,Metrics/MethodLength
83
81
  pref = prefix.empty? ? "image." : "#{prefix}.image."
84
- out = "#{pref}id:: #{id}\n"
82
+ out = ""
83
+ out += "#{pref}id:: #{id}\n" if id
85
84
  out += "#{pref}src:: #{src}\n"
86
85
  out += "#{pref}mimetype:: #{mimetype}\n"
87
86
  out += "#{pref}filename:: #{filename}\n" if filename
@@ -1,3 +1,3 @@
1
1
  module RelatonBib
2
- VERSION = "1.19.2".freeze
2
+ VERSION = "1.19.3".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-bib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.19.2
4
+ version: 1.19.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-12 00:00:00.000000000 Z
11
+ date: 2024-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable