writeexcel 0.1.0 → 0.3.0

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 (143) hide show
  1. data/README +26 -31
  2. data/examples/a_simple.rb +42 -42
  3. data/examples/{autofilters.rb → autofilter.rb} +264 -266
  4. data/examples/bigfile.rb +29 -0
  5. data/examples/chart_area.rb +120 -0
  6. data/examples/chart_bar.rb +119 -0
  7. data/examples/chart_column.rb +119 -0
  8. data/examples/chart_line.rb +119 -0
  9. data/examples/chart_pie.rb +107 -0
  10. data/examples/chart_scatter.rb +120 -0
  11. data/examples/chart_stock.rb +147 -0
  12. data/examples/copyformat.rb +51 -51
  13. data/examples/data_validate.rb +278 -278
  14. data/examples/date_time.rb +86 -86
  15. data/examples/defined_name.rb +31 -0
  16. data/examples/demo.rb +120 -118
  17. data/examples/diag_border.rb +35 -35
  18. data/examples/formats.rb +489 -489
  19. data/examples/header.rb +136 -136
  20. data/examples/hidden.rb +28 -28
  21. data/examples/hyperlink.rb +42 -42
  22. data/examples/images.rb +52 -52
  23. data/examples/merge1.rb +39 -39
  24. data/examples/merge2.rb +44 -44
  25. data/examples/merge3.rb +65 -65
  26. data/examples/merge4.rb +82 -82
  27. data/examples/merge5.rb +79 -79
  28. data/examples/properties.rb +33 -0
  29. data/examples/properties_jp.rb +32 -0
  30. data/examples/protection.rb +46 -46
  31. data/examples/regions.rb +52 -52
  32. data/examples/repeat.rb +42 -42
  33. data/examples/stats.rb +75 -75
  34. data/examples/stocks.rb +80 -80
  35. data/examples/tab_colors.rb +30 -30
  36. data/examples/write_arrays.rb +82 -0
  37. data/lib/writeexcel.rb +1134 -18
  38. data/lib/writeexcel/biffwriter.rb +273 -260
  39. data/lib/writeexcel/chart.rb +2306 -217
  40. data/lib/writeexcel/charts/area.rb +152 -0
  41. data/lib/writeexcel/charts/bar.rb +177 -0
  42. data/lib/writeexcel/charts/column.rb +156 -0
  43. data/lib/writeexcel/charts/external.rb +61 -0
  44. data/lib/writeexcel/charts/line.rb +152 -0
  45. data/lib/writeexcel/charts/pie.rb +169 -0
  46. data/lib/writeexcel/charts/scatter.rb +192 -0
  47. data/lib/writeexcel/charts/stock.rb +211 -0
  48. data/lib/writeexcel/excelformulaparser.rb +208 -195
  49. data/lib/writeexcel/format.rb +1697 -1108
  50. data/lib/writeexcel/formula.rb +1050 -986
  51. data/lib/writeexcel/olewriter.rb +322 -322
  52. data/lib/writeexcel/properties.rb +251 -250
  53. data/lib/writeexcel/storage_lite.rb +968 -0
  54. data/lib/writeexcel/workbook.rb +3294 -2630
  55. data/lib/writeexcel/worksheet.rb +9012 -6377
  56. data/test/excelfile/Chart1.xls +0 -0
  57. data/test/excelfile/Chart2.xls +0 -0
  58. data/test/excelfile/Chart3.xls +0 -0
  59. data/test/excelfile/Chart4.xls +0 -0
  60. data/test/excelfile/Chart5.xls +0 -0
  61. data/test/perl_output/Chart1.xls.data +0 -0
  62. data/test/perl_output/Chart2.xls.data +0 -0
  63. data/test/perl_output/Chart3.xls.data +0 -0
  64. data/test/perl_output/Chart4.xls.data +0 -0
  65. data/test/perl_output/Chart5.xls.data +0 -0
  66. data/test/perl_output/a_simple.xls +0 -0
  67. data/test/perl_output/autofilter.xls +0 -0
  68. data/test/perl_output/chart_area.xls +0 -0
  69. data/test/perl_output/chart_bar.xls +0 -0
  70. data/test/perl_output/chart_column.xls +0 -0
  71. data/test/perl_output/chart_line.xls +0 -0
  72. data/test/perl_output/data_validate.xls +0 -0
  73. data/test/perl_output/date_time.xls +0 -0
  74. data/test/perl_output/demo.xls +0 -0
  75. data/test/perl_output/demo101.bin +0 -0
  76. data/test/perl_output/demo201.bin +0 -0
  77. data/test/perl_output/demo301.bin +0 -0
  78. data/test/perl_output/demo401.bin +0 -0
  79. data/test/perl_output/demo501.bin +0 -0
  80. data/test/perl_output/diag_border.xls +0 -0
  81. data/test/perl_output/headers.xls +0 -0
  82. data/test/perl_output/hyperlink.xls +0 -0
  83. data/test/perl_output/images.xls +0 -0
  84. data/test/perl_output/merge1.xls +0 -0
  85. data/test/perl_output/merge2.xls +0 -0
  86. data/test/perl_output/merge3.xls +0 -0
  87. data/test/perl_output/merge4.xls +0 -0
  88. data/test/perl_output/merge5.xls +0 -0
  89. data/test/perl_output/protection.xls +0 -0
  90. data/test/perl_output/regions.xls +0 -0
  91. data/test/perl_output/stats.xls +0 -0
  92. data/test/perl_output/stocks.xls +0 -0
  93. data/test/perl_output/tab_colors.xls +0 -0
  94. data/test/perl_output/unicode_cyrillic.xls +0 -0
  95. data/test/perl_output/workbook1.xls +0 -0
  96. data/test/perl_output/workbook2.xls +0 -0
  97. data/test/tc_all.rb +32 -31
  98. data/test/tc_biff.rb +104 -104
  99. data/test/tc_chart.rb +22 -22
  100. data/test/tc_example_match.rb +1944 -1280
  101. data/test/tc_format.rb +1254 -1267
  102. data/test/tc_formula.rb +63 -63
  103. data/test/tc_ole.rb +110 -110
  104. data/test/tc_storage_lite.rb +149 -0
  105. data/test/tc_workbook.rb +140 -115
  106. data/test/tc_worksheet.rb +115 -115
  107. data/test/test_00_IEEE_double.rb +14 -14
  108. data/test/test_01_add_worksheet.rb +12 -12
  109. data/test/test_02_merge_formats.rb +58 -58
  110. data/test/test_04_dimensions.rb +397 -397
  111. data/test/test_05_rows.rb +182 -182
  112. data/test/test_06_extsst.rb +80 -80
  113. data/test/test_11_date_time.rb +484 -484
  114. data/test/test_12_date_only.rb +506 -506
  115. data/test/test_13_date_seconds.rb +486 -486
  116. data/test/test_21_escher.rb +642 -629
  117. data/test/test_22_mso_drawing_group.rb +750 -739
  118. data/test/test_23_note.rb +78 -78
  119. data/test/test_24_txo.rb +80 -80
  120. data/test/test_25_position_object.rb +82 -0
  121. data/test/test_26_autofilter.rb +327 -327
  122. data/test/test_27_autofilter.rb +144 -144
  123. data/test/test_28_autofilter.rb +174 -174
  124. data/test/test_29_process_jpg.rb +681 -131
  125. data/test/test_30_validation_dval.rb +82 -82
  126. data/test/test_31_validation_dv_strings.rb +131 -131
  127. data/test/test_32_validation_dv_formula.rb +211 -211
  128. data/test/test_40_property_types.rb +191 -191
  129. data/test/test_41_properties.rb +238 -238
  130. data/test/test_42_set_properties.rb +442 -419
  131. data/test/test_50_name_stored.rb +305 -0
  132. data/test/test_51_name_print_area.rb +363 -0
  133. data/test/test_52_name_print_titles.rb +460 -0
  134. data/test/test_53_autofilter.rb +209 -0
  135. data/test/test_60_chart_generic.rb +576 -0
  136. data/test/test_61_chart_subclasses.rb +97 -0
  137. data/test/test_62_chart_formats.rb +270 -0
  138. data/test/test_63_chart_area_formats.rb +647 -0
  139. data/test/test_chartex.rb +35 -0
  140. data/test/ts_all.rb +46 -34
  141. data/writeexcel.gemspec +18 -0
  142. data/writeexcel.rdoc +583 -0
  143. metadata +162 -108
@@ -1,260 +1,273 @@
1
- #
2
- # BIFFwriter - An abstract base class for Excel workbooks and worksheets.
3
- #
4
- #
5
- # Used in conjunction with Spreadsheet::WriteExcel
6
- #
7
- # Copyright 2000-2008, John McNamara, jmcnamara@cpan.org
8
- #
9
- # original written in Perl by John McNamara
10
- # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
11
- #
12
-
13
-
14
- require 'tempfile'
15
-
16
- class BIFFWriter
17
-
18
- BIFF_Version = 0x0600
19
- BigEndian = [1].pack("I") == [1].pack("N")
20
-
21
- attr_reader :byte_order, :data, :datasize
22
-
23
- ######################################################################
24
- # The args here aren't used by BIFFWriter, but they are needed by its
25
- # subclasses. I don't feel like creating multiple constructors.
26
- ######################################################################
27
-
28
- def initialize
29
- set_byte_order
30
- @data = ''
31
- @datasize = 0
32
- @limit = 8224
33
- @ignore_continue = 0
34
-
35
- # Open a tmp file to store the majority of the Worksheet data. If this fails,
36
- # for example due to write permissions, store the data in memory. This can be
37
- # slow for large files.
38
- @filehandle = Tempfile.new('spreadsheetwriteexcel')
39
- @filehandle.binmode
40
-
41
- # failed. store temporary data in memory.
42
- @using_tmpfile = @filehandle ? true : false
43
-
44
- end
45
-
46
- ###############################################################################
47
- #
48
- # _set_byte_order()
49
- #
50
- # Determine the byte order and store it as class data to avoid
51
- # recalculating it for each call to new().
52
- #
53
- def set_byte_order
54
- # Check if "pack" gives the required IEEE 64bit float
55
- teststr = [1.2345].pack("d")
56
- hexdata = [0x8D, 0x97, 0x6E, 0x12, 0x83, 0xC0, 0xF3, 0x3F]
57
- number = hexdata.pack("C8")
58
-
59
- if number == teststr
60
- @byte_order = 0 # Little Endian
61
- elsif number == teststr.reverse
62
- @byte_order = 1 # Big Endian
63
- else
64
- # Give up. I'll fix this in a later version.
65
- raise( "Required floating point format not supported " +
66
- "on this platform. See the portability section " +
67
- "of the documentation."
68
- )
69
- end
70
- end
71
-
72
- ###############################################################################
73
- #
74
- # _prepend($data)
75
- #
76
- # General storage function
77
- #
78
- def prepend(*args)
79
- d = args.join
80
- d = add_continue(d) if d.length > @limit
81
-
82
- @datasize += d.length
83
- @data = d + @data
84
-
85
- #print "prepend\n"
86
- #print d.unpack('C*').map! {|c| sprintf("%02X", c) }.join(' ') + "\n\n"
87
- return d
88
- end
89
-
90
- ###############################################################################
91
- #
92
- # _append($data)
93
- #
94
- # General storage function
95
- #
96
- def append(*args)
97
- d = args.join
98
- # Add CONTINUE records if necessary
99
- d = add_continue(d) if d.length > @limit
100
- if @using_tmpfile
101
- @filehandle.write d
102
- @datasize += d.length
103
- else
104
- @datasize += d.length
105
- @data = @data + d
106
- end
107
- #print "apend\n"
108
- #print d.unpack('C*').map! {|c| sprintf("%02X", c) }.join(' ') + "\n\n"
109
- return d
110
- end
111
-
112
- ###############################################################################
113
- #
114
- # get_data().
115
- #
116
- # Retrieves data from memory in one chunk, or from disk in $buffer
117
- # sized chunks.
118
- #
119
- def get_data
120
- buflen = 4096
121
-
122
- # Return data stored in memory
123
- unless @data.nil?
124
- tmp = @data
125
- @data = nil
126
- if @using_tmpfile
127
- @filehandle.open
128
- @filehandle.binmode
129
- end
130
- return tmp
131
- end
132
-
133
- # Return data stored on disk
134
- if @using_tmpfile
135
- return @filehandle.read(buflen)
136
- end
137
-
138
- # No data to return
139
- return nil
140
- end
141
-
142
- ###############################################################################
143
- #
144
- # _store_bof($type)
145
- #
146
- # $type = 0x0005, Workbook
147
- # $type = 0x0010, Worksheet
148
- #
149
- # Writes Excel BOF record to indicate the beginning of a stream or
150
- # sub-stream in the BIFF file.
151
- #
152
- def store_bof(type = 0x0005)
153
- record = 0x0809 # Record identifier
154
- length = 0x0010 # Number of bytes to follow
155
-
156
- # According to the SDK $build and $year should be set to zero.
157
- # However, this throws a warning in Excel 5. So, use these
158
- # magic numbers.
159
- build = 0x0DBB
160
- year = 0x07CC
161
-
162
- bfh = 0x00000041
163
- sfo = 0x00000006
164
-
165
- header = [record,length].pack("vv")
166
- data = [BIFF_Version,type,build,year,bfh,sfo].pack("vvvvVV")
167
-
168
- prepend(header, data)
169
- end
170
-
171
- ###############################################################################
172
- #
173
- # _store_eof()
174
- #
175
- # Writes Excel EOF record to indicate the end of a BIFF stream.
176
- #
177
- def store_eof
178
- record = 0x000A
179
- length = 0x0000
180
- header = [record,length].pack("vv")
181
-
182
- append(header)
183
- end
184
-
185
- ###############################################################################
186
- #
187
- # _add_continue()
188
- #
189
- # Excel limits the size of BIFF records. In Excel 5 the limit is 2084 bytes. In
190
- # Excel 97 the limit is 8228 bytes. Records that are longer than these limits
191
- # must be split up into CONTINUE blocks.
192
- #
193
- # This function take a long BIFF record and inserts CONTINUE records as
194
- # necessary.
195
- #
196
- # Some records have their own specialised Continue blocks so there is also an
197
- # option to bypass this function.
198
- #
199
- def add_continue(data)
200
- record = 0x003C # Record identifier
201
-
202
- # Skip this if another method handles the continue blocks.
203
- return data if @ignore_continue != 0
204
-
205
- # The first 2080/8224 bytes remain intact. However, we have to change
206
- # the length field of the record.
207
- #
208
-
209
- # in perl
210
- # $tmp = substr($data, 0, $limit, "");
211
- if data.length > @limit
212
- tmp = data[0, @limit]
213
- data[0, @limit] = ''
214
- else
215
- tmp = data.dup
216
- data = ''
217
- end
218
-
219
- tmp[2, 2] = [@limit-4].pack('v')
220
-
221
- # Strip out chunks of 2080/8224 bytes +4 for the header.
222
- while (data.length > @limit)
223
- header = [record, @limit].pack("vv")
224
- tmp = tmp + header + data[0, @limit]
225
- data[0, @limit] = ''
226
- end
227
-
228
- # Mop up the last of the data
229
- header = [record, data.length].pack("vv")
230
- tmp = tmp + header + data
231
-
232
- return tmp
233
- end
234
-
235
- ###############################################################################
236
- #
237
- # _add_mso_generic()
238
- # my $type = $_[0];
239
- # my $version = $_[1];
240
- # my $instance = $_[2];
241
- # my $data = $_[3];
242
- #
243
- # Create a mso structure that is part of an Escher drawing object. These are
244
- # are used for images, comments and filters. This generic method is used by
245
- # other methods to create specific mso records.
246
- #
247
- # Returns the packed record.
248
- #
249
- def add_mso_generic(type, version, instance, data, length = nil)
250
- length = length.nil? ? data.length : length
251
-
252
- # The header contains version and instance info packed into 2 bytes.
253
- header = version | (instance << 4)
254
-
255
- record = [header, type, length].pack('vvV') + data
256
-
257
- return record
258
- end
259
-
260
- end
1
+ #
2
+ # BIFFwriter - An abstract base class for Excel workbooks and worksheets.
3
+ #
4
+ #
5
+ # Used in conjunction with WriteExcel
6
+ #
7
+ # Copyright 2000-2010, John McNamara, jmcnamara@cpan.org
8
+ #
9
+ # original written in Perl by John McNamara
10
+ # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
11
+ #
12
+
13
+
14
+ require 'tempfile'
15
+
16
+ class BIFFWriter #:nodoc:
17
+
18
+ BIFF_Version = 0x0600
19
+ BigEndian = [1].pack("I") == [1].pack("N")
20
+
21
+ attr_reader :byte_order, :data, :datasize
22
+
23
+ ######################################################################
24
+ # The args here aren't used by BIFFWriter, but they are needed by its
25
+ # subclasses. I don't feel like creating multiple constructors.
26
+ ######################################################################
27
+
28
+ def initialize
29
+ set_byte_order
30
+ @data = ''
31
+ @datasize = 0
32
+ @limit = 8224
33
+ @ignore_continue = 0
34
+
35
+ # Open a tmp file to store the majority of the Worksheet data. If this fails,
36
+ # for example due to write permissions, store the data in memory. This can be
37
+ # slow for large files.
38
+ @filehandle = Tempfile.new('spreadsheetwriteexcel')
39
+ @filehandle.binmode
40
+
41
+ # failed. store temporary data in memory.
42
+ @using_tmpfile = @filehandle ? true : false
43
+
44
+ end
45
+
46
+ ###############################################################################
47
+ #
48
+ # _set_byte_order()
49
+ #
50
+ # Determine the byte order and store it as class data to avoid
51
+ # recalculating it for each call to new().
52
+ #
53
+ def set_byte_order
54
+ # Check if "pack" gives the required IEEE 64bit float
55
+ teststr = [1.2345].pack("d")
56
+ hexdata = [0x8D, 0x97, 0x6E, 0x12, 0x83, 0xC0, 0xF3, 0x3F]
57
+ number = hexdata.pack("C8")
58
+
59
+ if number == teststr
60
+ @byte_order = 0 # Little Endian
61
+ elsif number == teststr.reverse
62
+ @byte_order = 1 # Big Endian
63
+ else
64
+ # Give up. I'll fix this in a later version.
65
+ raise( "Required floating point format not supported " +
66
+ "on this platform. See the portability section " +
67
+ "of the documentation."
68
+ )
69
+ end
70
+ end
71
+
72
+ ###############################################################################
73
+ #
74
+ # _prepend($data)
75
+ #
76
+ # General storage function
77
+ #
78
+ def prepend(*args)
79
+ d = args.join
80
+ d = add_continue(d) if d.length > @limit
81
+
82
+ @datasize += d.length
83
+ @data = d + @data
84
+
85
+ print "prepend\n" if defined?($debug)
86
+ print d.unpack('C*').map! {|c| sprintf("%02X", c) }.join(' ') + "\n\n" if defined?($debug)
87
+ return d
88
+ end
89
+
90
+ ###############################################################################
91
+ #
92
+ # _append($data)
93
+ #
94
+ # General storage function
95
+ #
96
+ def append(*args)
97
+ d = args.join
98
+ # Add CONTINUE records if necessary
99
+ d = add_continue(d) if d.length > @limit
100
+ if @using_tmpfile
101
+ @filehandle.write d
102
+ @datasize += d.length
103
+ else
104
+ @datasize += d.length
105
+ @data = @data + d
106
+ end
107
+
108
+ print "append\n" if defined?($debug)
109
+ print d.unpack('C*').map! {|c| sprintf("%02X", c) }.join(' ') + "\n\n" if defined?($debug)
110
+ return d
111
+ end
112
+
113
+ ###############################################################################
114
+ #
115
+ # get_data().
116
+ #
117
+ # Retrieves data from memory in one chunk, or from disk in $buffer
118
+ # sized chunks.
119
+ #
120
+ def get_data
121
+ buflen = 4096
122
+
123
+ # Return data stored in memory
124
+ unless @data.nil?
125
+ tmp = @data
126
+ @data = nil
127
+ if @using_tmpfile
128
+ @filehandle.open
129
+ @filehandle.binmode
130
+ end
131
+ return tmp
132
+ end
133
+
134
+ # Return data stored on disk
135
+ if @using_tmpfile
136
+ return @filehandle.read(buflen)
137
+ end
138
+
139
+ # No data to return
140
+ return nil
141
+ end
142
+
143
+ ###############################################################################
144
+ #
145
+ # _store_bof($type)
146
+ #
147
+ # $type = 0x0005, Workbook
148
+ # $type = 0x0010, Worksheet
149
+ # $type = 0x0020, Chart
150
+ #
151
+ # Writes Excel BOF record to indicate the beginning of a stream or
152
+ # sub-stream in the BIFF file.
153
+ #
154
+ def store_bof(type = 0x0005)
155
+ record = 0x0809 # Record identifier
156
+ length = 0x0010 # Number of bytes to follow
157
+
158
+ # According to the SDK $build and $year should be set to zero.
159
+ # However, this throws a warning in Excel 5. So, use these
160
+ # magic numbers.
161
+ build = 0x0DBB
162
+ year = 0x07CC
163
+
164
+ bfh = 0x00000041
165
+ sfo = 0x00000006
166
+
167
+ header = [record,length].pack("vv")
168
+ data = [BIFF_Version,type,build,year,bfh,sfo].pack("vvvvVV")
169
+
170
+ print "store_bof in #{__FILE__}\n" if defined?($debug)
171
+ prepend(header, data)
172
+ end
173
+
174
+ ###############################################################################
175
+ #
176
+ # _store_eof()
177
+ #
178
+ # Writes Excel EOF record to indicate the end of a BIFF stream.
179
+ #
180
+ def store_eof
181
+ record = 0x000A
182
+ length = 0x0000
183
+ header = [record,length].pack("vv")
184
+
185
+ print "store_eof in #{__FILE__}\n" if defined?($debug)
186
+ append(header)
187
+ end
188
+
189
+ ###############################################################################
190
+ #
191
+ # _add_continue()
192
+ #
193
+ # Excel limits the size of BIFF records. In Excel 5 the limit is 2084 bytes. In
194
+ # Excel 97 the limit is 8228 bytes. Records that are longer than these limits
195
+ # must be split up into CONTINUE blocks.
196
+ #
197
+ # This function take a long BIFF record and inserts CONTINUE records as
198
+ # necessary.
199
+ #
200
+ # Some records have their own specialised Continue blocks so there is also an
201
+ # option to bypass this function.
202
+ #
203
+ def add_continue(data)
204
+ record = 0x003C # Record identifier
205
+
206
+ # Skip this if another method handles the continue blocks.
207
+ return data if @ignore_continue != 0
208
+
209
+ # The first 2080/8224 bytes remain intact. However, we have to change
210
+ # the length field of the record.
211
+ #
212
+
213
+ # in perl
214
+ # $tmp = substr($data, 0, $limit, "");
215
+ if data.length > @limit
216
+ tmp = data[0, @limit]
217
+ data[0, @limit] = ''
218
+ else
219
+ tmp = data.dup
220
+ data = ''
221
+ end
222
+
223
+ tmp[2, 2] = [@limit-4].pack('v')
224
+
225
+ # Strip out chunks of 2080/8224 bytes +4 for the header.
226
+ while (data.length > @limit)
227
+ header = [record, @limit].pack("vv")
228
+ tmp = tmp + header + data[0, @limit]
229
+ data[0, @limit] = ''
230
+ end
231
+
232
+ # Mop up the last of the data
233
+ header = [record, data.length].pack("vv")
234
+ tmp = tmp + header + data
235
+
236
+ return tmp
237
+ end
238
+
239
+ ###############################################################################
240
+ #
241
+ # _add_mso_generic()
242
+ # my $type = $_[0];
243
+ # my $version = $_[1];
244
+ # my $instance = $_[2];
245
+ # my $data = $_[3];
246
+ #
247
+ # Create a mso structure that is part of an Escher drawing object. These are
248
+ # are used for images, comments and filters. This generic method is used by
249
+ # other methods to create specific mso records.
250
+ #
251
+ # Returns the packed record.
252
+ #
253
+ def add_mso_generic(type, version, instance, data, length = nil)
254
+ length = length.nil? ? data.length : length
255
+
256
+ # The header contains version and instance info packed into 2 bytes.
257
+ header = version | (instance << 4)
258
+
259
+ record = [header, type, length].pack('vvV') + data
260
+
261
+ return record
262
+ end
263
+
264
+ def not_using_tmpfile
265
+ @filehandle.close(true) if @filehandle
266
+ @filehandle = nil
267
+ @using_tmpfile = nil
268
+ end
269
+
270
+ def clear_data_for_test # :nodoc:
271
+ @data = ''
272
+ end
273
+ end