mupdf 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 05e6a6512e33869f2f404082dd81f74ae2b8510c173674ade3098645805028f9
4
- data.tar.gz: 0a426de664750da3d5c586199861096e330628a3697fb3854a57215449a1ab9a
3
+ metadata.gz: 30427fb29d23f8bc2a555d17ae7efd5c605cb4aaf43fc73e47d6ff208bb268ac
4
+ data.tar.gz: 767cfd14a5cf828e77cbc5db6e0bacb3ad1f7345fa3d479d46df25e99588d66c
5
5
  SHA512:
6
- metadata.gz: 8808759fa4b42c1b8a361b706c6d3dd614bad2a7db2a6bea88ed610033a3e8f8ca23e78de45afed4b40fa3462b8da9fb5b0890c4c4c0b26545715a169523556d
7
- data.tar.gz: 31a021a75da552cc82063cde4e16cd3ee96d83603628dc48dc9afacd4b076a3e85662ca76a5f24effb42fb819424f79bd889c499786bbda9dfc3555850e99acd
6
+ metadata.gz: a6c7811a6bf8194162022aeee62c53229e178205f28bee46f25a23766b71e5ae2f518c0b8693005c3cd96cc2134cc5c65dcd9f4991e59088ab4c2c15761ab5f4
7
+ data.tar.gz: '09902f5f9492c357967d609750b4c1dcfe1a9a39c112c9efd2c642cdaec979760e89ce777adbbb4068a4660aa5fa28dc6bd7e0ba82cf473c1aa0cbd4a71780ad'
data/lib/mupdf/box.rb CHANGED
@@ -28,7 +28,7 @@ module MuPDF
28
28
  # @param text [String]
29
29
  # @param kind [Symbol]
30
30
  #
31
- # @return [MuPDF::Box]
31
+ # @return [MuPDF::Box, nil]
32
32
  def self.parse(text, kind:)
33
33
  match = text.match(REGEX)
34
34
  return unless match
data/lib/mupdf/page.rb CHANGED
@@ -28,67 +28,77 @@ module MuPDF
28
28
 
29
29
  # @param text [String]
30
30
  #
31
- # @return [MuPDF::Box]
31
+ # @return [MuPDF::Box, nil]
32
32
  def self.parse_media_box(text)
33
33
  match = MEDIA_BOX_REGEX.match(text)
34
+ return unless match
35
+
34
36
  MuPDF::Box.parse(match[:content], kind: :media)
35
37
  end
36
38
 
37
39
  # @param text [String]
38
40
  #
39
- # @return [MuPDF::Box]
41
+ # @return [MuPDF::Box, nil]
40
42
  def self.parse_crop_box(text)
41
43
  match = CROP_BOX_REGEX.match(text)
44
+ return unless match
45
+
42
46
  MuPDF::Box.parse(match[:content], kind: :crop)
43
47
  end
44
48
 
45
49
  # @param text [String]
46
50
  #
47
- # @return [MuPDF::Box]
51
+ # @return [MuPDF::Box, nil]
48
52
  def self.parse_art_box(text)
49
53
  match = ART_BOX_REGEX.match(text)
54
+ return unless match
55
+
50
56
  MuPDF::Box.parse(match[:content], kind: :art)
51
57
  end
52
58
 
53
59
  # @param text [String]
54
60
  #
55
- # @return [MuPDF::Box]
61
+ # @return [MuPDF::Box, nil]
56
62
  def self.parse_bleed_box(text)
57
63
  match = BLEED_BOX_REGEX.match(text)
64
+ return unless match
65
+
58
66
  MuPDF::Box.parse(match[:content], kind: :bleed)
59
67
  end
60
68
 
61
69
  # @param text [String]
62
70
  #
63
- # @return [MuPDF::Box]
71
+ # @return [MuPDF::Box, nil]
64
72
  def self.parse_trim_box(text)
65
73
  match = TRIM_BOX_REGEX.match(text)
74
+ return unless match
75
+
66
76
  MuPDF::Box.parse(match[:content], kind: :trim)
67
77
  end
68
78
 
69
79
  # @!attribute media_box
70
- # @return [MuPDFBox]
80
+ # @return [MuPDFBox, nil]
71
81
  attr_accessor :media_box
72
82
 
73
83
  # @!attribute crop_box
74
- # @return [MuPDFBox]
84
+ # @return [MuPDFBox, nil]
75
85
  attr_accessor :crop_box
76
86
 
77
87
  # @!attribute art_box
78
- # @return [MuPDFBox]
88
+ # @return [MuPDFBox, nil]
79
89
  attr_accessor :art_box
80
90
 
81
91
  # @!attribute bleed_box
82
- # @return [MuPDFBox]
92
+ # @return [MuPDFBox, nil]
83
93
  attr_accessor :bleed_box
84
94
 
85
95
  # @!attribute trim_box
86
- # @return [MuPDFBox]
96
+ # @return [MuPDFBox, nil]
87
97
  attr_accessor :trim_box
88
98
 
89
- # @!attribute pagenum
99
+ # @!attribute number
90
100
  # @return [Integer]
91
- attr_accessor :pagenum
101
+ attr_accessor :number
92
102
 
93
103
  # @param media_box [MuPDF::Box]
94
104
  # @param crop_box [MuPDF::Box]
@@ -107,17 +117,17 @@ module MuPDF
107
117
 
108
118
  # @return [String]
109
119
  def inspect
110
- "#<#{self.class.name} number=#{@number}>"
120
+ "#<#{self.class.name} number=#{@number} width=#{width} height=#{height}>"
111
121
  end
112
122
 
113
- # @return [Integer]
123
+ # @return [Integer, nil]
114
124
  def width
115
- @media_box.width
125
+ @media_box&.width
116
126
  end
117
127
 
118
- # @return [Integer]
128
+ # @return [Integer, nil]
119
129
  def height
120
- @media_box.height
130
+ @media_box&.height
121
131
  end
122
132
  end
123
133
  end
data/lib/mupdf/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MuPDF
4
- VERSION = '1.0.1'
4
+ VERSION = '1.0.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mupdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Sylvestre
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-02 00:00:00.000000000 Z
11
+ date: 2025-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: open3
@@ -62,8 +62,8 @@ licenses:
62
62
  metadata:
63
63
  rubygems_mfa_required: 'true'
64
64
  homepage_uri: https://github.com/ksylvest/mupdf
65
- source_code_uri: https://github.com/ksylvest/mupdf/tree/v1.0.1
66
- changelog_uri: https://github.com/ksylvest/mupdf/releases/tag/v1.0.1
65
+ source_code_uri: https://github.com/ksylvest/mupdf/tree/v1.0.3
66
+ changelog_uri: https://github.com/ksylvest/mupdf/releases/tag/v1.0.3
67
67
  documentation_uri: https://mupdf.ksylvest.com/
68
68
  post_install_message:
69
69
  rdoc_options: []