public
Description: Fast, Nimble PDF Writer for Ruby
Homepage: http://prawn.majesticseacreature.com
Clone URL: git://github.com/sandal/prawn.git
Move offset reader out of Prawn
sandal (author)
Thu Jul 24 15:45:35 -0700 2008
commit  50ff78422473262ed2acafa82c8410d12f33265d
tree    4c799323d5f914652221b8c46ce4f97cf441e371
parent  2ee6d504646525f4789f628b0b44d9a7908dab2e
...
6
7
8
9
10
11
12
13
14
...
6
7
8
 
 
 
9
10
11
0
@@ -6,9 +6,6 @@
0
 #
0
 # This is free software. Please see the LICENSE and COPYING files for details.
0
 
0
-require 'prawn/images/offset_reader'
0
-
0
-
0
 module Prawn
0
 
0
   module Images
...
25
26
27
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
30
31
...
74
75
76
77
 
78
79
80
...
25
26
27
 
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
...
91
92
93
 
94
95
96
97
0
@@ -25,7 +25,24 @@
0
 # no response to emails asking for my extensions to be integrated and a
0
 # RubyGem package to be made available.
0
 
0
-class ImageInfo
0
+class ImageInfo  
0
+  
0
+  module OffsetReader
0
+    def read_o(length = 1, offset = nil)
0
+      @offset ||= 0
0
+      @offset = offset if offset
0
+      ret = self[@offset, length]
0
+      @offset += length
0
+      ret
0
+    end
0
+    def offset
0
+      @offset
0
+    end
0
+    def offset=(o)
0
+      @offset = o || 0
0
+    end
0
+  end
0
+  
0
   # Image Format Constants
0
   module Formats
0
     OTHER     = "OTHER"
0
@@ -74,7 +91,7 @@ class ImageInfo
0
     elsif @data.is_a?(String)
0
       @top = @data[0, 128]
0
       # Define Singleton-method definition to String (byte, offset)
0
-      @data.extend(Prawn::Images::OffsetReader)
0
+      @data.extend(OffsetReader)
0
     else
0
       raise "argument class error!! #{data.type}"
0
     end

Comments