pdf-reader 0.9.2 → 0.9.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.
Files changed (3) hide show
  1. data/CHANGELOG +4 -0
  2. data/lib/pdf/reader/reference.rb +11 -5
  3. metadata +3 -3
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ v0.9.3 (2nd July 2011)
2
+ - add PDF::Reader::Reference#hash method
3
+ - improves behaviour of Reference objects when tehy're used as Hash keys
4
+
1
5
  v0.9.2 (24th April 2011)
2
6
  - add basic support for fonts with Identity-V encoding.
3
7
  - bug: improve robustness of text extraction
@@ -43,17 +43,23 @@ class PDF::Reader
43
43
  def to_i
44
44
  self.id
45
45
  end
46
+ ################################################################################
47
+ # returns true if the provided object points to the same PDF Object as the
48
+ # current object
46
49
  def ==(obj)
47
50
  return false unless obj.kind_of?(PDF::Reader::Reference)
48
51
 
49
- if obj.id == self.id && obj.gen == self.gen
50
- true
51
- else
52
- false
53
- end
52
+ self.hash == obj.hash
54
53
  end
55
54
  alias :eql? :==
56
55
  ################################################################################
56
+ # returns a hash based on the PDF::Reference this object points to. Two
57
+ # different Reference objects that point to the same PDF Object will
58
+ # return an identical hash
59
+ def hash
60
+ "#{self.id}:#{self.gen}".hash
61
+ end
62
+ ################################################################################
57
63
  end
58
64
  ################################################################################
59
65
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 2
9
- version: 0.9.2
8
+ - 3
9
+ version: 0.9.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - James Healy
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-04-24 00:00:00 +10:00
17
+ date: 2011-07-02 00:00:00 +10:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency