origami 2.0.2 → 2.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
  SHA1:
3
- metadata.gz: 60c022db7697d6bbe5ca4f592eddd6bc4ea74a84
4
- data.tar.gz: a4a7a8edab8bc927d28764232ef0ec7a19605122
3
+ metadata.gz: 747446efde7ffefe478ec34908b8555b3a5e2596
4
+ data.tar.gz: 8d92eb219be13b1070e421a6570c587a16fb9a68
5
5
  SHA512:
6
- metadata.gz: ce487c9bba392845dd43014724611e6a00caba76b8e4e053c665d549f183ae9ccd1e8a20240f6a37f801351586205d525beb2ba434045c11aafa354fe506c28b
7
- data.tar.gz: 736fcda1249205ba66b137a62837224cc63a96b272aa265b03bad90a5172e07e731584181398541b08f384253110b907d33cd2ef1829c0802687a971d2073917
6
+ metadata.gz: d3f3997e8181f448f74e9a2bc84855652b71b4ea66a2ede9f1b3f8cc696eb77e82c72f436cc430c838972e43cab0566ce52bf6c8fb0fd0ebee47889a2ff3de9f
7
+ data.tar.gz: e8895bcc5b5b4ae96bcb24d66b4befea45cf2068493814859092f2b56b25dd3d9467df3fcd72b73a6cbbb835e2cae8910a0725f3c85b042127d14aef1c57fa80
@@ -203,11 +203,11 @@ module Origami
203
203
  insn 'sc', '*' do |canvas, *c| canvas.gs.set_nonstroking_color(c) end
204
204
 
205
205
  insn 'G', Real do |canvas, c|
206
- canvas.gs.set_stroking_color([c], Graphics::Color::SPACE::DEVICE_GRAY)
206
+ canvas.gs.set_stroking_color([c], Graphics::Color::Space::DEVICE_GRAY)
207
207
  end
208
208
 
209
209
  insn 'g', Real do |canvas, c|
210
- canvas.gs.set_nonstroking_color([c], Graphics::Color::SPACE::DEVICE_GRAY)
210
+ canvas.gs.set_nonstroking_color([c], Graphics::Color::Space::DEVICE_GRAY)
211
211
  end
212
212
 
213
213
  insn 'RG', Real, Real, Real do |canvas, r, g, b|
@@ -666,15 +666,15 @@ module Origami
666
666
 
667
667
  raise ArgumentError, "Missing file format" if format.nil?
668
668
  case format.downcase
669
- when 'jpg', 'jpeg', 'jpe', 'jif', 'jfif', 'jfi'
669
+ when '.jpg', 'jpeg', '.jpe', '.jif', '.jfif', '.jfi'
670
670
  image.setFilter :DCTDecode
671
671
  image.encoded_data = data
672
672
 
673
- when 'jp2','jpx','j2k','jpf','jpm','mj2'
673
+ when '.jp2','.jpx','.j2k','.jpf','.jpm','.mj2'
674
674
  image.setFilter :JPXDecode
675
675
  image.encoded_data = data
676
676
 
677
- when 'jb2', 'jbig', 'jbig2'
677
+ when '.jb2', '.jbig', '.jbig2'
678
678
  image.setFilter :JBIG2Decode
679
679
  image.encoded_data = data
680
680
  else
@@ -63,7 +63,7 @@ module Origami
63
63
  last_trailer = (@revisions.last.trailer ||= Trailer.new)
64
64
  last_trailer.dictionary ||= Dictionary.new
65
65
 
66
- if prev_trailer.has_dictionary?
66
+ if prev_trailer.dictionary?
67
67
  last_trailer.dictionary =
68
68
  last_trailer.dictionary.merge(prev_trailer.dictionary)
69
69
  else
@@ -53,6 +53,7 @@ module Origami
53
53
  def value
54
54
  @value.to_sym
55
55
  end
56
+ alias to_sym value
56
57
 
57
58
  def <=>(name)
58
59
  return unless name.is_a?(Name)
@@ -232,7 +232,7 @@ module Origami
232
232
  class Trailer
233
233
  def to_obfuscated_str
234
234
  content = ""
235
- if self.has_dictionary?
235
+ if self.dictionary?
236
236
  content << TOKENS.first << EOL << @dictionary.to_obfuscated_str << EOL
237
237
  end
238
238
 
@@ -163,7 +163,7 @@ module Origami
163
163
  target = self.is_a?(Resources) ? self : (self.Resources ||= Resources.new)
164
164
 
165
165
  rsrc_dict = (target[type] and target[type].solve) || (target[type] = Dictionary.new)
166
- rsrc_dict[name] = rsrc
166
+ rsrc_dict[name.to_sym] = rsrc
167
167
 
168
168
  name
169
169
  end
@@ -30,7 +30,7 @@ module Origami
30
30
  #
31
31
  # First look for a standard trailer dictionary
32
32
  #
33
- if @revisions.last.trailer.has_dictionary?
33
+ if @revisions.last.trailer.dictionary?
34
34
  trl = @revisions.last.trailer
35
35
 
36
36
  #
@@ -54,7 +54,7 @@ module Origami
54
54
  def trailer_key(attr) #:nodoc:
55
55
 
56
56
  @revisions.reverse_each do |rev|
57
- if rev.trailer.has_dictionary? and not rev.trailer[attr].nil?
57
+ if rev.trailer.dictionary? and not rev.trailer[attr].nil?
58
58
  return rev.trailer[attr].solve
59
59
  elsif rev.has_xrefstm?
60
60
  xrefstm = rev.xrefstm
@@ -136,10 +136,11 @@ module Origami
136
136
  end
137
137
 
138
138
  def [](key)
139
- @dictionary[key] if has_dictionary?
139
+ @dictionary[key] if dictionary?
140
140
  end
141
141
 
142
142
  def []=(key,val)
143
+ self.dictionary = Dictionary.new unless dictionary?
143
144
  @dictionary[key] = val
144
145
  end
145
146
 
@@ -148,7 +149,7 @@ module Origami
148
149
  @dictionary = dict
149
150
  end
150
151
 
151
- def has_dictionary?
152
+ def dictionary?
152
153
  not @dictionary.nil?
153
154
  end
154
155
 
@@ -157,7 +158,7 @@ module Origami
157
158
  #
158
159
  def to_s
159
160
  content = ""
160
- if self.has_dictionary?
161
+ if self.dictionary?
161
162
  content << TOKENS.first << EOL << @dictionary.to_s << EOL
162
163
  end
163
164
 
@@ -19,5 +19,5 @@
19
19
  =end
20
20
 
21
21
  module Origami
22
- VERSION = "2.0.2"
22
+ VERSION = "2.0.3"
23
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: origami
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guillaume Delugré
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-21 00:00:00.000000000 Z
11
+ date: 2017-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -225,7 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
225
225
  requirements:
226
226
  - gtk2 to run the graphical interface
227
227
  rubyforge_project:
228
- rubygems_version: 2.6.8
228
+ rubygems_version: 2.6.11
229
229
  signing_key:
230
230
  specification_version: 4
231
231
  summary: Ruby framework to manipulate PDF documents