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 +4 -4
- data/lib/relaton_bib/image.rb +18 -19
- data/lib/relaton_bib/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: d3a558692c0fed85db446e5e09bc97b88cd593b950c56deea611644a51ea541e
|
4
|
+
data.tar.gz: 5714aa8ce2e246e41477370b0562762b9ab242ae93c78ec71ef2d62e517ad54c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 034d246df4a77e85fe262e54bcab074747aa4260e3dfb17e619630e8181f3c3e869333099d69a2296a216d192e855496738eb29a8f6bcab08ac0ecedd8fbd395
|
7
|
+
data.tar.gz: 68df9e862afcdfd8f026647af0b0aa1e20c78fa50b08225f80cc7a950d450302fbc79f8e76c8741b6104b861c190ce6d587b1b64e7db96c8d43a7b93c45addd8
|
data/lib/relaton_bib/image.rb
CHANGED
@@ -1,32 +1,29 @@
|
|
1
1
|
module RelatonBib
|
2
2
|
class Image
|
3
3
|
# @return [String]
|
4
|
-
|
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
|
14
|
-
# @option args [String] :
|
15
|
-
# @option args [String] :
|
16
|
-
# @option args [String] :
|
17
|
-
# @option args [String] :
|
18
|
-
# @option args [String] :
|
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(
|
21
|
-
@id = id
|
23
|
+
def initialize(src:, mimetype:, **args)
|
22
24
|
@src = src
|
23
25
|
@mimetype = mimetype
|
24
|
-
|
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" => { "
|
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 = "
|
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
|
data/lib/relaton_bib/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2024-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|