r509 0.8
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.
- data/README.md +447 -0
- data/Rakefile +38 -0
- data/bin/r509 +96 -0
- data/bin/r509-parse +35 -0
- data/doc/R509.html +154 -0
- data/doc/R509/Cert.html +3954 -0
- data/doc/R509/Cert/Extensions.html +360 -0
- data/doc/R509/Cert/Extensions/AuthorityInfoAccess.html +391 -0
- data/doc/R509/Cert/Extensions/AuthorityKeyIdentifier.html +148 -0
- data/doc/R509/Cert/Extensions/BasicConstraints.html +482 -0
- data/doc/R509/Cert/Extensions/CrlDistributionPoints.html +316 -0
- data/doc/R509/Cert/Extensions/ExtendedKeyUsage.html +780 -0
- data/doc/R509/Cert/Extensions/KeyUsage.html +1230 -0
- data/doc/R509/Cert/Extensions/SubjectAlternativeName.html +467 -0
- data/doc/R509/Cert/Extensions/SubjectKeyIdentifier.html +216 -0
- data/doc/R509/CertificateAuthority.html +126 -0
- data/doc/R509/CertificateAuthority/Signer.html +855 -0
- data/doc/R509/Config.html +127 -0
- data/doc/R509/Config/CaConfig.html +2144 -0
- data/doc/R509/Config/CaConfigPool.html +599 -0
- data/doc/R509/Config/CaProfile.html +656 -0
- data/doc/R509/Config/SubjectItemPolicy.html +578 -0
- data/doc/R509/Crl.html +126 -0
- data/doc/R509/Crl/Administrator.html +2077 -0
- data/doc/R509/Crl/Parser.html +1224 -0
- data/doc/R509/Csr.html +2248 -0
- data/doc/R509/IOHelpers.html +564 -0
- data/doc/R509/MessageDigest.html +396 -0
- data/doc/R509/NameSanitizer.html +319 -0
- data/doc/R509/Ocsp.html +128 -0
- data/doc/R509/Ocsp/Request.html +126 -0
- data/doc/R509/Ocsp/Request/Nonce.html +160 -0
- data/doc/R509/Ocsp/Response.html +837 -0
- data/doc/R509/OidMapper.html +393 -0
- data/doc/R509/PrivateKey.html +1647 -0
- data/doc/R509/R509Error.html +134 -0
- data/doc/R509/Spki.html +1424 -0
- data/doc/R509/Subject.html +836 -0
- data/doc/R509/Validity.html +160 -0
- data/doc/R509/Validity/Checker.html +320 -0
- data/doc/R509/Validity/DefaultChecker.html +283 -0
- data/doc/R509/Validity/DefaultWriter.html +330 -0
- data/doc/R509/Validity/Status.html +561 -0
- data/doc/R509/Validity/Writer.html +394 -0
- data/doc/_index.html +501 -0
- data/doc/class_list.html +53 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +328 -0
- data/doc/file.README.html +534 -0
- data/doc/file.r509.html +149 -0
- data/doc/file_list.html +58 -0
- data/doc/frames.html +28 -0
- data/doc/index.html +534 -0
- data/doc/js/app.js +208 -0
- data/doc/js/full_list.js +173 -0
- data/doc/js/jquery.js +4 -0
- data/doc/methods_list.html +1932 -0
- data/doc/top-level-namespace.html +112 -0
- data/lib/r509.rb +22 -0
- data/lib/r509/cert.rb +414 -0
- data/lib/r509/cert/extensions.rb +309 -0
- data/lib/r509/certificateauthority.rb +290 -0
- data/lib/r509/config.rb +407 -0
- data/lib/r509/crl.rb +379 -0
- data/lib/r509/csr.rb +324 -0
- data/lib/r509/exceptions.rb +5 -0
- data/lib/r509/io_helpers.rb +52 -0
- data/lib/r509/messagedigest.rb +49 -0
- data/lib/r509/ocsp.rb +85 -0
- data/lib/r509/oidmapper.rb +32 -0
- data/lib/r509/privatekey.rb +185 -0
- data/lib/r509/spki.rb +112 -0
- data/lib/r509/subject.rb +133 -0
- data/lib/r509/validity.rb +92 -0
- data/lib/r509/version.rb +4 -0
- data/r509.yaml +73 -0
- data/spec/cert/extensions_spec.rb +632 -0
- data/spec/cert_spec.rb +321 -0
- data/spec/certificate_authority_spec.rb +260 -0
- data/spec/config_spec.rb +349 -0
- data/spec/crl_spec.rb +215 -0
- data/spec/csr_spec.rb +302 -0
- data/spec/fixtures.rb +233 -0
- data/spec/fixtures/cert1.der +0 -0
- data/spec/fixtures/cert1.pem +24 -0
- data/spec/fixtures/cert1_public_key_modulus.txt +1 -0
- data/spec/fixtures/cert3.p12 +0 -0
- data/spec/fixtures/cert3.pem +28 -0
- data/spec/fixtures/cert3_key.pem +27 -0
- data/spec/fixtures/cert3_key_des3.pem +30 -0
- data/spec/fixtures/cert4.pem +14 -0
- data/spec/fixtures/cert5.pem +30 -0
- data/spec/fixtures/cert6.pem +26 -0
- data/spec/fixtures/cert_expired.pem +26 -0
- data/spec/fixtures/cert_not_yet_valid.pem +26 -0
- data/spec/fixtures/cert_san.pem +27 -0
- data/spec/fixtures/cert_san2.pem +22 -0
- data/spec/fixtures/config_pool_test_minimal.yaml +15 -0
- data/spec/fixtures/config_test.yaml +41 -0
- data/spec/fixtures/config_test_engine_key.yaml +7 -0
- data/spec/fixtures/config_test_engine_no_key_name.yaml +6 -0
- data/spec/fixtures/config_test_minimal.yaml +7 -0
- data/spec/fixtures/config_test_password.yaml +7 -0
- data/spec/fixtures/config_test_various.yaml +100 -0
- data/spec/fixtures/crl_list_file.txt +1 -0
- data/spec/fixtures/crl_with_reason.pem +17 -0
- data/spec/fixtures/csr1.der +0 -0
- data/spec/fixtures/csr1.pem +17 -0
- data/spec/fixtures/csr1_key.der +0 -0
- data/spec/fixtures/csr1_key.pem +27 -0
- data/spec/fixtures/csr1_key_encrypted_des3.pem +30 -0
- data/spec/fixtures/csr1_newlines.pem +32 -0
- data/spec/fixtures/csr1_no_begin_end.pem +15 -0
- data/spec/fixtures/csr1_public_key_modulus.txt +1 -0
- data/spec/fixtures/csr2.pem +15 -0
- data/spec/fixtures/csr2_key.pem +27 -0
- data/spec/fixtures/csr3.pem +16 -0
- data/spec/fixtures/csr4.pem +25 -0
- data/spec/fixtures/csr_dsa.pem +15 -0
- data/spec/fixtures/csr_invalid_signature.pem +13 -0
- data/spec/fixtures/dsa_key.pem +20 -0
- data/spec/fixtures/key4.pem +27 -0
- data/spec/fixtures/key4_encrypted_des3.pem +30 -0
- data/spec/fixtures/missing_key_identifier_ca.cer +21 -0
- data/spec/fixtures/missing_key_identifier_ca.key +27 -0
- data/spec/fixtures/ocsptest.r509.local.pem +27 -0
- data/spec/fixtures/ocsptest.r509.local_ocsp_request.der +0 -0
- data/spec/fixtures/ocsptest2.r509.local.pem +27 -0
- data/spec/fixtures/second_ca.cer +26 -0
- data/spec/fixtures/second_ca.key +27 -0
- data/spec/fixtures/spkac.der +0 -0
- data/spec/fixtures/spkac.txt +1 -0
- data/spec/fixtures/spkac_dsa.txt +1 -0
- data/spec/fixtures/stca.pem +22 -0
- data/spec/fixtures/stca_ocsp_request.der +0 -0
- data/spec/fixtures/stca_ocsp_response.der +0 -0
- data/spec/fixtures/test1.csr +17 -0
- data/spec/fixtures/test_ca.cer +22 -0
- data/spec/fixtures/test_ca.key +28 -0
- data/spec/fixtures/test_ca.p12 +0 -0
- data/spec/fixtures/test_ca_des3.key +30 -0
- data/spec/fixtures/test_ca_ocsp.cer +26 -0
- data/spec/fixtures/test_ca_ocsp.key +27 -0
- data/spec/fixtures/test_ca_ocsp.p12 +0 -0
- data/spec/fixtures/test_ca_ocsp_chain.txt +48 -0
- data/spec/fixtures/test_ca_ocsp_response.der +0 -0
- data/spec/fixtures/test_ca_subroot.cer +26 -0
- data/spec/fixtures/test_ca_subroot.key +27 -0
- data/spec/fixtures/test_ca_subroot_ocsp.cer +25 -0
- data/spec/fixtures/test_ca_subroot_ocsp.key +27 -0
- data/spec/fixtures/test_ca_subroot_ocsp_response.der +0 -0
- data/spec/fixtures/unknown_oid.csr +17 -0
- data/spec/message_digest_spec.rb +89 -0
- data/spec/ocsp_spec.rb +111 -0
- data/spec/oid_mapper_spec.rb +31 -0
- data/spec/privatekey_spec.rb +198 -0
- data/spec/spec_helper.rb +14 -0
- data/spec/spki_spec.rb +157 -0
- data/spec/subject_spec.rb +203 -0
- data/spec/validity_spec.rb +98 -0
- metadata +257 -0
|
@@ -0,0 +1,564 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
6
|
+
<title>
|
|
7
|
+
Module: R509::IOHelpers
|
|
8
|
+
|
|
9
|
+
— Documentation by YARD 0.8.0
|
|
10
|
+
|
|
11
|
+
</title>
|
|
12
|
+
|
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
|
14
|
+
|
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
|
16
|
+
|
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
|
19
|
+
relpath = '../';
|
|
20
|
+
framesUrl = "../frames.html#!" + escape(window.location.href);
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
|
25
|
+
|
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
</head>
|
|
30
|
+
<body>
|
|
31
|
+
<div id="header">
|
|
32
|
+
<div id="menu">
|
|
33
|
+
|
|
34
|
+
<a href="../_index.html">Index (I)</a> »
|
|
35
|
+
<span class='title'><span class='object_link'><a href="../R509.html" title="R509 (module)">R509</a></span></span>
|
|
36
|
+
»
|
|
37
|
+
<span class="title">IOHelpers</span>
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<div id="search">
|
|
44
|
+
|
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
|
46
|
+
href="../class_list.html">
|
|
47
|
+
Class List
|
|
48
|
+
</a>
|
|
49
|
+
|
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
|
51
|
+
href="../method_list.html">
|
|
52
|
+
Method List
|
|
53
|
+
</a>
|
|
54
|
+
|
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
|
56
|
+
href="../file_list.html">
|
|
57
|
+
File List
|
|
58
|
+
</a>
|
|
59
|
+
|
|
60
|
+
</div>
|
|
61
|
+
<div class="clear"></div>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<iframe id="search_frame"></iframe>
|
|
65
|
+
|
|
66
|
+
<div id="content"><h1>Module: R509::IOHelpers
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
</h1>
|
|
71
|
+
|
|
72
|
+
<dl class="box">
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
<dt class="r1">Included in:</dt>
|
|
81
|
+
<dd class="r1"><span class='object_link'><a href="Cert.html" title="R509::Cert (class)">Cert</a></span>, <span class='object_link'><a href="Config/CaConfig.html" title="R509::Config::CaConfig (class)">Config::CaConfig</a></span>, <span class='object_link'><a href="Config/CaConfig.html" title="R509::Config::CaConfig (class)">Config::CaConfig</a></span>, <span class='object_link'><a href="Crl/Administrator.html" title="R509::Crl::Administrator (class)">Crl::Administrator</a></span>, <span class='object_link'><a href="Csr.html" title="R509::Csr (class)">Csr</a></span>, <span class='object_link'><a href="PrivateKey.html" title="R509::PrivateKey (class)">PrivateKey</a></span>, <span class='object_link'><a href="Spki.html" title="R509::Spki (class)">Spki</a></span></dd>
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
<dt class="r2 last">Defined in:</dt>
|
|
86
|
+
<dd class="r2 last">lib/r509/io_helpers.rb</dd>
|
|
87
|
+
|
|
88
|
+
</dl>
|
|
89
|
+
<div class="clear"></div>
|
|
90
|
+
|
|
91
|
+
<h2>Overview</h2><div class="docstring">
|
|
92
|
+
<div class="discussion">
|
|
93
|
+
|
|
94
|
+
<p>helper methods for I/O</p>
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
<div class="tags">
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
<h2>
|
|
111
|
+
Class Method Summary
|
|
112
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
|
113
|
+
</h2>
|
|
114
|
+
|
|
115
|
+
<ul class="summary">
|
|
116
|
+
|
|
117
|
+
<li class="public ">
|
|
118
|
+
<span class="summary_signature">
|
|
119
|
+
|
|
120
|
+
<a href="#read_data-class_method" title="read_data (class method)">+ (Object) <strong>read_data</strong>(filename_or_io) </a>
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
</span>
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
<span class="summary_desc"><div class='inline'>
|
|
135
|
+
<p>Reads data from an IO or file.</p>
|
|
136
|
+
</div></span>
|
|
137
|
+
|
|
138
|
+
</li>
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
<li class="public ">
|
|
142
|
+
<span class="summary_signature">
|
|
143
|
+
|
|
144
|
+
<a href="#write_data-class_method" title="write_data (class method)">+ (Object) <strong>write_data</strong>(filename_or_io, data) </a>
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
</span>
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
<span class="summary_desc"><div class='inline'>
|
|
159
|
+
<p>Writes data into an IO or file.</p>
|
|
160
|
+
</div></span>
|
|
161
|
+
|
|
162
|
+
</li>
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
</ul>
|
|
166
|
+
|
|
167
|
+
<h2>
|
|
168
|
+
Instance Method Summary
|
|
169
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
|
170
|
+
</h2>
|
|
171
|
+
|
|
172
|
+
<ul class="summary">
|
|
173
|
+
|
|
174
|
+
<li class="public ">
|
|
175
|
+
<span class="summary_signature">
|
|
176
|
+
|
|
177
|
+
<a href="#read_data-instance_method" title="#read_data (instance method)">- (Object) <strong>read_data</strong>(filename_or_io) </a>
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
</span>
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
<span class="summary_desc"><div class='inline'>
|
|
192
|
+
<p>Reads data from an IO or file.</p>
|
|
193
|
+
</div></span>
|
|
194
|
+
|
|
195
|
+
</li>
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
<li class="public ">
|
|
199
|
+
<span class="summary_signature">
|
|
200
|
+
|
|
201
|
+
<a href="#write_data-instance_method" title="#write_data (instance method)">- (Object) <strong>write_data</strong>(filename_or_io, data) </a>
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
</span>
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
<span class="summary_desc"><div class='inline'>
|
|
216
|
+
<p>Writes data into an IO or file.</p>
|
|
217
|
+
</div></span>
|
|
218
|
+
|
|
219
|
+
</li>
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
</ul>
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
<div id="class_method_details" class="method_details_list">
|
|
228
|
+
<h2>Class Method Details</h2>
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
<div class="method_details first">
|
|
232
|
+
<h3 class="signature first" id="read_data-class_method">
|
|
233
|
+
|
|
234
|
+
+ (<tt>Object</tt>) <strong>read_data</strong>(filename_or_io)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
</h3><div class="docstring">
|
|
241
|
+
<div class="discussion">
|
|
242
|
+
|
|
243
|
+
<p>Reads data from an IO or file</p>
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
</div>
|
|
247
|
+
</div>
|
|
248
|
+
<div class="tags">
|
|
249
|
+
<p class="tag_title">Parameters:</p>
|
|
250
|
+
<ul class="param">
|
|
251
|
+
|
|
252
|
+
<li>
|
|
253
|
+
|
|
254
|
+
<span class='name'>filename_or_io</span>
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
<span class='type'>(<tt>String</tt>, <tt>#read</tt>)</span>
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
—
|
|
262
|
+
<div class='inline'>
|
|
263
|
+
<p>Either a string of the path for the file that you'd like to read, or an
|
|
264
|
+
IO-like object.</p>
|
|
265
|
+
</div>
|
|
266
|
+
|
|
267
|
+
</li>
|
|
268
|
+
|
|
269
|
+
</ul>
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
</div><table class="source_code">
|
|
273
|
+
<tr>
|
|
274
|
+
<td>
|
|
275
|
+
<pre class="lines">
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
24
|
|
279
|
+
25
|
|
280
|
+
26
|
|
281
|
+
27
|
|
282
|
+
28
|
|
283
|
+
29
|
|
284
|
+
30
|
|
285
|
+
31
|
|
286
|
+
32
|
|
287
|
+
33
|
|
288
|
+
34
|
|
289
|
+
35</pre>
|
|
290
|
+
</td>
|
|
291
|
+
<td>
|
|
292
|
+
<pre class="code"><span class="info file"># File 'lib/r509/io_helpers.rb', line 24</span>
|
|
293
|
+
|
|
294
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_read_data'>read_data</span><span class='lparen'>(</span><span class='id identifier rubyid_filename_or_io'>filename_or_io</span><span class='rparen'>)</span>
|
|
295
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_filename_or_io'>filename_or_io</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:read</span><span class='rparen'>)</span>
|
|
296
|
+
<span class='id identifier rubyid_filename_or_io'>filename_or_io</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='rparen'>)</span>
|
|
297
|
+
<span class='kw'>else</span>
|
|
298
|
+
<span class='kw'>begin</span>
|
|
299
|
+
<span class='id identifier rubyid_file'>file</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_filename_or_io'>filename_or_io</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>rb:ascii-8bit</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
|
300
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='rparen'>)</span>
|
|
301
|
+
<span class='kw'>ensure</span>
|
|
302
|
+
<span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
|
303
|
+
<span class='kw'>end</span>
|
|
304
|
+
<span class='kw'>end</span>
|
|
305
|
+
<span class='kw'>end</span></pre>
|
|
306
|
+
</td>
|
|
307
|
+
</tr>
|
|
308
|
+
</table>
|
|
309
|
+
</div>
|
|
310
|
+
|
|
311
|
+
<div class="method_details ">
|
|
312
|
+
<h3 class="signature " id="write_data-class_method">
|
|
313
|
+
|
|
314
|
+
+ (<tt>Object</tt>) <strong>write_data</strong>(filename_or_io, data)
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
</h3><div class="docstring">
|
|
321
|
+
<div class="discussion">
|
|
322
|
+
|
|
323
|
+
<p>Writes data into an IO or file</p>
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
</div>
|
|
327
|
+
</div>
|
|
328
|
+
<div class="tags">
|
|
329
|
+
<p class="tag_title">Parameters:</p>
|
|
330
|
+
<ul class="param">
|
|
331
|
+
|
|
332
|
+
<li>
|
|
333
|
+
|
|
334
|
+
<span class='name'>filename_or_io</span>
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
<span class='type'>(<tt>String</tt>, <tt>#write</tt>)</span>
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
—
|
|
342
|
+
<div class='inline'>
|
|
343
|
+
<p>Either a string of the path for the file that you'd like to write, or an
|
|
344
|
+
IO-like object.</p>
|
|
345
|
+
</div>
|
|
346
|
+
|
|
347
|
+
</li>
|
|
348
|
+
|
|
349
|
+
<li>
|
|
350
|
+
|
|
351
|
+
<span class='name'>data</span>
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
—
|
|
359
|
+
<div class='inline'>
|
|
360
|
+
<p>The data that we want to write</p>
|
|
361
|
+
</div>
|
|
362
|
+
|
|
363
|
+
</li>
|
|
364
|
+
|
|
365
|
+
</ul>
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
</div><table class="source_code">
|
|
369
|
+
<tr>
|
|
370
|
+
<td>
|
|
371
|
+
<pre class="lines">
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
8
|
|
375
|
+
9
|
|
376
|
+
10
|
|
377
|
+
11
|
|
378
|
+
12
|
|
379
|
+
13
|
|
380
|
+
14
|
|
381
|
+
15
|
|
382
|
+
16
|
|
383
|
+
17
|
|
384
|
+
18
|
|
385
|
+
19</pre>
|
|
386
|
+
</td>
|
|
387
|
+
<td>
|
|
388
|
+
<pre class="code"><span class="info file"># File 'lib/r509/io_helpers.rb', line 8</span>
|
|
389
|
+
|
|
390
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_write_data'>write_data</span><span class='lparen'>(</span><span class='id identifier rubyid_filename_or_io'>filename_or_io</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
|
391
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_filename_or_io'>filename_or_io</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:write</span><span class='rparen'>)</span>
|
|
392
|
+
<span class='id identifier rubyid_filename_or_io'>filename_or_io</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
|
393
|
+
<span class='kw'>else</span>
|
|
394
|
+
<span class='kw'>begin</span>
|
|
395
|
+
<span class='id identifier rubyid_file'>file</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_filename_or_io'>filename_or_io</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>wb:ascii-8bit</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
|
396
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
|
397
|
+
<span class='kw'>ensure</span>
|
|
398
|
+
<span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span><span class='lparen'>(</span><span class='rparen'>)</span>
|
|
399
|
+
<span class='kw'>end</span>
|
|
400
|
+
<span class='kw'>end</span>
|
|
401
|
+
<span class='kw'>end</span></pre>
|
|
402
|
+
</td>
|
|
403
|
+
</tr>
|
|
404
|
+
</table>
|
|
405
|
+
</div>
|
|
406
|
+
|
|
407
|
+
</div>
|
|
408
|
+
|
|
409
|
+
<div id="instance_method_details" class="method_details_list">
|
|
410
|
+
<h2>Instance Method Details</h2>
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
<div class="method_details first">
|
|
414
|
+
<h3 class="signature first" id="read_data-instance_method">
|
|
415
|
+
|
|
416
|
+
- (<tt>Object</tt>) <strong>read_data</strong>(filename_or_io)
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
</h3><div class="docstring">
|
|
423
|
+
<div class="discussion">
|
|
424
|
+
|
|
425
|
+
<p>Reads data from an IO or file</p>
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
</div>
|
|
429
|
+
</div>
|
|
430
|
+
<div class="tags">
|
|
431
|
+
<p class="tag_title">Parameters:</p>
|
|
432
|
+
<ul class="param">
|
|
433
|
+
|
|
434
|
+
<li>
|
|
435
|
+
|
|
436
|
+
<span class='name'>filename_or_io</span>
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
<span class='type'>(<tt>String</tt>, <tt>#read</tt>)</span>
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
—
|
|
444
|
+
<div class='inline'>
|
|
445
|
+
<p>Either a string of the path for the file that you'd like to read, or an
|
|
446
|
+
IO-like object.</p>
|
|
447
|
+
</div>
|
|
448
|
+
|
|
449
|
+
</li>
|
|
450
|
+
|
|
451
|
+
</ul>
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
</div><table class="source_code">
|
|
455
|
+
<tr>
|
|
456
|
+
<td>
|
|
457
|
+
<pre class="lines">
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
48
|
|
461
|
+
49
|
|
462
|
+
50</pre>
|
|
463
|
+
</td>
|
|
464
|
+
<td>
|
|
465
|
+
<pre class="code"><span class="info file"># File 'lib/r509/io_helpers.rb', line 48</span>
|
|
466
|
+
|
|
467
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_read_data'>read_data</span><span class='lparen'>(</span><span class='id identifier rubyid_filename_or_io'>filename_or_io</span><span class='rparen'>)</span>
|
|
468
|
+
<span class='const'>IOHelpers</span><span class='period'>.</span><span class='id identifier rubyid_read_data'>read_data</span><span class='lparen'>(</span><span class='id identifier rubyid_filename_or_io'>filename_or_io</span><span class='rparen'>)</span>
|
|
469
|
+
<span class='kw'>end</span></pre>
|
|
470
|
+
</td>
|
|
471
|
+
</tr>
|
|
472
|
+
</table>
|
|
473
|
+
</div>
|
|
474
|
+
|
|
475
|
+
<div class="method_details ">
|
|
476
|
+
<h3 class="signature " id="write_data-instance_method">
|
|
477
|
+
|
|
478
|
+
- (<tt>Object</tt>) <strong>write_data</strong>(filename_or_io, data)
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
</h3><div class="docstring">
|
|
485
|
+
<div class="discussion">
|
|
486
|
+
|
|
487
|
+
<p>Writes data into an IO or file</p>
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
</div>
|
|
491
|
+
</div>
|
|
492
|
+
<div class="tags">
|
|
493
|
+
<p class="tag_title">Parameters:</p>
|
|
494
|
+
<ul class="param">
|
|
495
|
+
|
|
496
|
+
<li>
|
|
497
|
+
|
|
498
|
+
<span class='name'>filename_or_io</span>
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
<span class='type'>(<tt>String</tt>, <tt>#write</tt>)</span>
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
—
|
|
506
|
+
<div class='inline'>
|
|
507
|
+
<p>Either a string of the path for the file that you'd like to write, or an
|
|
508
|
+
IO-like object.</p>
|
|
509
|
+
</div>
|
|
510
|
+
|
|
511
|
+
</li>
|
|
512
|
+
|
|
513
|
+
<li>
|
|
514
|
+
|
|
515
|
+
<span class='name'>data</span>
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
—
|
|
523
|
+
<div class='inline'>
|
|
524
|
+
<p>The data that we want to write</p>
|
|
525
|
+
</div>
|
|
526
|
+
|
|
527
|
+
</li>
|
|
528
|
+
|
|
529
|
+
</ul>
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
</div><table class="source_code">
|
|
533
|
+
<tr>
|
|
534
|
+
<td>
|
|
535
|
+
<pre class="lines">
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
41
|
|
539
|
+
42
|
|
540
|
+
43</pre>
|
|
541
|
+
</td>
|
|
542
|
+
<td>
|
|
543
|
+
<pre class="code"><span class="info file"># File 'lib/r509/io_helpers.rb', line 41</span>
|
|
544
|
+
|
|
545
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_write_data'>write_data</span><span class='lparen'>(</span><span class='id identifier rubyid_filename_or_io'>filename_or_io</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
|
546
|
+
<span class='const'>IOHelpers</span><span class='period'>.</span><span class='id identifier rubyid_write_data'>write_data</span><span class='lparen'>(</span><span class='id identifier rubyid_filename_or_io'>filename_or_io</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
|
547
|
+
<span class='kw'>end</span></pre>
|
|
548
|
+
</td>
|
|
549
|
+
</tr>
|
|
550
|
+
</table>
|
|
551
|
+
</div>
|
|
552
|
+
|
|
553
|
+
</div>
|
|
554
|
+
|
|
555
|
+
</div>
|
|
556
|
+
|
|
557
|
+
<div id="footer">
|
|
558
|
+
Generated on Tue Oct 23 22:48:01 2012 by
|
|
559
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
560
|
+
0.8.0 (ruby-1.9.3).
|
|
561
|
+
</div>
|
|
562
|
+
|
|
563
|
+
</body>
|
|
564
|
+
</html>
|