1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>mmap.rd</TITLE>
</HEAD>
<BODY>
<H1><A NAME="label:0">Mmap
</A></H1><!-- RDLabel: "Mmap" -->
<P>
<A HREF="ftp://moulon.inra.fr/pub/ruby/">Download</A>
</P>
<P>
The Mmap class implement memory-mapped file objects
</P>
<H3><A NAME="label:1">WARNING
</A></H3><!-- RDLabel: "WARNING" -->
<P>
<EM>The variables $' and $` are not available with gsub! and sub!</EM>
</P>
<H2><A NAME="label:2">SuperClass
</A></H2><!-- RDLabel: "SuperClass" -->
<P>
Object
</P>
<H2><A NAME="label:3">Included Modules
</A></H2><!-- RDLabel: "Included Modules" -->
<UL>
<LI>Comparable
<LI>Enumerable
</UL>
<H2><A NAME="label:4">Class Methods
</A></H2><!-- RDLabel: "Class Methods" -->
<DL>
<DT><A NAME="new"><CODE>new(<var>file</var>, [<var>mode</var> [, <var>protection</var> [, <var>options</var>]]])</CODE></A><!-- RDLabel: "new" -->
<DD>
<P>
create a new object
</P>
<DL>
<DT><A NAME="label:7"><VAR>file</VAR>
</A><!-- RDLabel: "file" -->
<DD>
<P>
Pathname of the file
</P>
</DD>
<DT><A NAME="label:8"><VAR>mode</VAR>
</A><!-- RDLabel: "mode" -->
<DD>
<P>
Mode to open the file, it can be "r", "w" or "rw"
</P>
</DD>
<DT><A NAME="label:9"><VAR>protection</VAR>
</A><!-- RDLabel: "protection" -->
<DD>
<P>
specify the nature of the mapping
</P>
<DL>
<DT><A NAME="label:11"><VAR>Mmap::MAP_SHARED</VAR>
</A><!-- RDLabel: "Mmap::MAP_SHARED" -->
<DD>
<P>
Creates a mapping that's shared with all other processes
mapping the same areas of the file.
The default value is <VAR>Mmap::MAP_SHARED</VAR>
</P>
</DD>
<DT><A NAME="label:12"><VAR>Mmap::MAP_PRIVATE</VAR>
</A><!-- RDLabel: "Mmap::MAP_PRIVATE" -->
<DD>
<P>
Creates a private copy-on-write mapping, so changes to the
contents of the mmap object will be private to this process
</P>
</DD>
</DL>
</DD>
<DT><A NAME="label:10"><VAR>options</VAR>
</A><!-- RDLabel: "options" -->
<DD>
<P>
Hash. If one of the options <VAR>length</VAR> or <VAR>offset</VAR>
is specified it will not possible to modify the size of
the mapped file.
</P>
<DL>
<DT><A NAME="label:13"><VAR>length</VAR>
</A><!-- RDLabel: "length" -->
<DD>
<P>
Maps <VAR>length</VAR> bytes from the file
</P>
</DD>
<DT><A NAME="label:14"><VAR>offset</VAR>
</A><!-- RDLabel: "offset" -->
<DD>
<P>
The mapping begin at <VAR>offset</VAR>
</P>
</DD>
<DT><A NAME="label:15"><VAR>advice</VAR>
</A><!-- RDLabel: "advice" -->
<DD>
<P>
The type of the access (see #madvise)
</P>
</DD>
</DL>
</DD>
</DL>
</DD>
</DL>
<H2><A NAME="label:5">Methods
</A></H2><!-- RDLabel: "Methods" -->
<DL>
<DT><A NAME="extend"><CODE>extend(<var>count</var>)</CODE></A><!-- RDLabel: "extend" -->
<DD>
<P>
add <VAR>count</VAR> bytes to the file (i.e. pre-extend the file)
</P>
</DD>
<DT><A NAME="madvise"><CODE>madvise(<var>advice</var>)</CODE></A><!-- RDLabel: "madvise" -->
<DD>
<P>
<VAR>advice</VAR> can have the value <VAR>Mmap::MADV_NORMAL</VAR>,
<VAR>Mmap::MADV_RANDOM</VAR>, <VAR>Mmap::MADV_SEQUENTIAL</VAR>,
<VAR>Mmap::MADV_WILLNEED</VAR>, <VAR>Mmap::MADV_DONTNEED</VAR>
</P>
</DD>
<DT><A NAME="mprotect"><CODE>mprotect(<var>mode</var>)</CODE></A><!-- RDLabel: "mprotect" -->
<DD>
<P>
change the mode, value must be "r", "w" or "rw"
</P>
</DD>
<DT><A NAME="msync"><CODE>msync</CODE></A><!-- RDLabel: "msync" -->
<DT><A NAME="flush"><CODE>flush</CODE></A><!-- RDLabel: "flush" -->
<DD>
<P>
flush the file
</P>
</DD>
<DT><A NAME="munmap"><CODE>munmap</CODE></A><!-- RDLabel: "munmap" -->
<DD>
<P>
terminate the association
</P>
</DD>
</DL>
<H3><A NAME="label:6">Other methods with the same syntax than the methods of <VAR>String</VAR>
</A></H3><!-- RDLabel: "Other methods with the same syntax than the methods ofString" -->
<P>
self == other
</P>
<P>
self > other
</P>
<P>
self >= other
</P>
<P>
self < other
</P>
<P>
self <= other
</P>
<P>
self === other
</P>
<P>
self << other
</P>
<P>
self =~ other
</P>
<P>
self[nth]
</P>
<P>
self[start..last]
</P>
<P>
self[start, length]
</P>
<P>
self[nth] = val
</P>
<P>
self[start..last] = val
</P>
<P>
self[start, len] = val
</P>
<P>
self <=> other
</P>
<P>
<<(other)
</P>
<P>
concat(other)
</P>
<P>
capitalize!
</P>
<P>
chop!
</P>
<P>
chomp!([rs])
</P>
<P>
crypt(salt)
</P>
<P>
delete!(str)
</P>
<P>
downcase!
</P>
<P>
each_byte {|char|...}
</P>
<P>
each([rs]) {|line|...}
</P>
<P>
each_line([rs]) {|line|...}
</P>
<P>
empty?
</P>
<P>
freeze
</P>
<P>
frozen
</P>
<P>
gsub!(pattern, replace)
</P>
<P>
gsub!(pattern) {...}
</P>
<P>
include?(other)
</P>
<P>
index(substr[, pos])
</P>
<P>
length
</P>
<P>
reverse!
</P>
<P>
rindex(substr[, pos])
</P>
<P>
scan(pattern)
</P>
<P>
scan(pattern) {...}
</P>
<P>
size
</P>
<P>
split([sep[, limit]])
</P>
<P>
squeeze!([str])
</P>
<P>
strip!
</P>
<P>
sub!(pattern, replace)
</P>
<P>
sub!(pattern) {...}
</P>
<P>
sum([bits])
</P>
<P>
swapcase!
</P>
<P>
tr!(search, replace)
</P>
<P>
tr_s!(search, replace)
</P>
<P>
upcase!
</P>
</BODY>
</HTML>
|