r509 0.9.2 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +2 -0
- data/CONTRIBUTING.mdown +21 -0
- data/LICENSE +13 -0
- data/README.mdown +548 -0
- data/Rakefile +5 -0
- data/bin/r509 +16 -17
- data/doc/R509.html +42 -26
- data/doc/R509/ASN1.html +22 -16
- data/doc/R509/ASN1/GeneralName.html +180 -173
- data/doc/R509/ASN1/GeneralNames.html +390 -62
- data/doc/R509/CRL.html +9 -7
- data/doc/R509/CRL/Administrator.html +208 -623
- data/doc/R509/CRL/FileReaderWriter.html +856 -0
- data/doc/R509/CRL/ReaderWriter.html +524 -0
- data/doc/R509/CRL/SignedList.html +29 -42
- data/doc/R509/CSR.html +248 -333
- data/doc/R509/Cert.html +364 -491
- data/doc/R509/Cert/Extensions.html +134 -43
- data/doc/R509/Cert/Extensions/AuthorityInfoAccess.html +335 -65
- data/doc/R509/Cert/Extensions/AuthorityKeyIdentifier.html +201 -102
- data/doc/R509/Cert/Extensions/BasicConstraints.html +297 -68
- data/doc/R509/Cert/Extensions/CRLDistributionPoints.html +690 -77
- data/doc/R509/Cert/Extensions/CertificatePolicies.html +293 -43
- data/doc/R509/Cert/Extensions/ExtendedKeyUsage.html +321 -173
- data/doc/R509/Cert/Extensions/GeneralNamesMixin.html +656 -0
- data/doc/R509/Cert/Extensions/InhibitAnyPolicy.html +270 -42
- data/doc/R509/Cert/Extensions/KeyUsage.html +334 -184
- data/doc/R509/Cert/Extensions/NameConstraints.html +363 -93
- data/doc/R509/{ASN1 → Cert/Extensions}/NoticeReference.html +209 -48
- data/doc/R509/Cert/Extensions/OCSPNoCheck.html +244 -17
- data/doc/R509/Cert/Extensions/PolicyConstraints.html +322 -71
- data/doc/R509/{ASN1 → Cert/Extensions}/PolicyInformation.html +204 -43
- data/doc/R509/{ASN1 → Cert/Extensions}/PolicyQualifiers.html +205 -48
- data/doc/R509/Cert/Extensions/SubjectAlternativeName.html +348 -143
- data/doc/R509/Cert/Extensions/SubjectKeyIdentifier.html +165 -13
- data/doc/R509/{ASN1 → Cert/Extensions}/UserNotice.html +204 -43
- data/doc/R509/Cert/Extensions/ValidationMixin.html +120 -0
- data/doc/R509/CertificateAuthority.html +9 -7
- data/doc/R509/CertificateAuthority/OptionsBuilder.html +475 -0
- data/doc/R509/CertificateAuthority/Signer.html +149 -198
- data/doc/R509/Config.html +10 -8
- data/doc/R509/Config/CAConfig.html +708 -625
- data/doc/R509/Config/CAConfigPool.html +179 -31
- data/doc/R509/Config/CertProfile.html +1544 -0
- data/doc/R509/Config/SubjectItemPolicy.html +437 -99
- data/doc/R509/Engine.html +14 -28
- data/doc/R509/Helpers.html +1014 -0
- data/doc/R509/MessageDigest.html +73 -25
- data/doc/R509/NameSanitizer.html +39 -39
- data/doc/R509/OCSP.html +5 -5
- data/doc/R509/OCSP/Request.html +5 -5
- data/doc/R509/OCSP/Request/Nonce.html +5 -5
- data/doc/R509/OCSP/Response.html +7 -7
- data/doc/R509/OIDMapper.html +121 -6
- data/doc/R509/PrivateKey.html +226 -227
- data/doc/R509/R509Error.html +5 -5
- data/doc/R509/SPKI.html +244 -342
- data/doc/R509/Subject.html +241 -70
- data/doc/R509/Validity.html +5 -5
- data/doc/R509/Validity/Checker.html +5 -5
- data/doc/R509/Validity/DefaultChecker.html +5 -9
- data/doc/R509/Validity/DefaultWriter.html +5 -9
- data/doc/R509/Validity/Status.html +5 -5
- data/doc/R509/Validity/Writer.html +5 -5
- data/doc/_index.html +92 -30
- data/doc/class_list.html +2 -2
- data/doc/file.CONTRIBUTING.html +96 -0
- data/doc/file.LICENSE.html +87 -0
- data/doc/file.README.html +279 -389
- data/doc/file.YAML.html +243 -0
- data/doc/file.r509.html +298 -105
- data/doc/file_list.html +11 -2
- data/doc/frames.html +1 -1
- data/doc/index.html +279 -389
- data/doc/js/full_list.js +6 -1
- data/doc/method_list.html +869 -1139
- data/doc/top-level-namespace.html +103 -5
- data/lib/r509.rb +7 -2
- data/lib/r509/asn1.rb +97 -135
- data/lib/r509/cert.rb +17 -106
- data/lib/r509/cert/extensions.rb +13 -676
- data/lib/r509/cert/extensions/authority_info_access.rb +128 -0
- data/lib/r509/cert/extensions/authority_key_identifier.rb +100 -0
- data/lib/r509/cert/extensions/base.rb +142 -0
- data/lib/r509/cert/extensions/basic_constraints.rb +119 -0
- data/lib/r509/cert/extensions/certificate_policies.rb +262 -0
- data/lib/r509/cert/extensions/crl_distribution_points.rb +98 -0
- data/lib/r509/cert/extensions/extended_key_usage.rb +189 -0
- data/lib/r509/cert/extensions/inhibit_any_policy.rb +70 -0
- data/lib/r509/cert/extensions/key_usage.rb +209 -0
- data/lib/r509/cert/extensions/name_constraints.rb +179 -0
- data/lib/r509/cert/extensions/ocsp_no_check.rb +56 -0
- data/lib/r509/cert/extensions/policy_constraints.rb +122 -0
- data/lib/r509/cert/extensions/subject_alternative_name.rb +88 -0
- data/lib/r509/cert/extensions/subject_key_identifier.rb +56 -0
- data/lib/r509/cert/extensions/validation_mixin.rb +42 -0
- data/lib/r509/certificate_authority/options_builder.rb +142 -0
- data/lib/r509/certificate_authority/signer.rb +189 -0
- data/lib/r509/config.rb +3 -600
- data/lib/r509/config/ca_config.rb +414 -0
- data/lib/r509/config/cert_profile.rb +110 -0
- data/lib/r509/config/subject_item_policy.rb +118 -0
- data/lib/r509/crl/administrator.rb +169 -0
- data/lib/r509/crl/reader_writer.rb +109 -0
- data/lib/r509/crl/signed_list.rb +135 -0
- data/lib/r509/csr.rb +35 -116
- data/lib/r509/engine.rb +21 -11
- data/lib/r509/helpers.rb +110 -0
- data/lib/r509/io_helpers.rb +18 -13
- data/lib/r509/message_digest.rb +13 -3
- data/lib/r509/oid_mapper.rb +14 -0
- data/lib/r509/private_key.rb +74 -50
- data/lib/r509/spki.rb +50 -113
- data/lib/r509/subject.rb +24 -2
- data/lib/r509/trollop.rb +788 -0
- data/lib/r509/version.rb +1 -1
- data/r509.yaml +289 -96
- data/spec/asn1_spec.rb +171 -98
- data/spec/cert/extensions/authority_info_access_spec.rb +247 -0
- data/spec/cert/extensions/authority_key_identifier_spec.rb +85 -0
- data/spec/cert/extensions/base_spec.rb +172 -0
- data/spec/cert/extensions/basic_constraints_spec.rb +185 -0
- data/spec/cert/extensions/certificate_policies_spec.rb +288 -0
- data/spec/cert/extensions/crl_distribution_points_spec.rb +149 -0
- data/spec/cert/extensions/extended_key_usage_spec.rb +174 -0
- data/spec/cert/extensions/inhibit_any_policy_spec.rb +92 -0
- data/spec/cert/extensions/key_usage_spec.rb +172 -0
- data/spec/cert/extensions/name_constraints_spec.rb +335 -0
- data/spec/cert/extensions/ocsp_no_check_spec.rb +76 -0
- data/spec/cert/extensions/policy_constraints_spec.rb +155 -0
- data/spec/cert/extensions/subject_alternative_name_spec.rb +354 -0
- data/spec/cert/extensions/subject_key_identifier_spec.rb +64 -0
- data/spec/cert_spec.rb +11 -9
- data/spec/certificate_authority/options_builder_spec.rb +307 -0
- data/spec/certificate_authority/signer_spec.rb +278 -0
- data/spec/config/ca_config_spec.rb +405 -0
- data/spec/config/cert_profile_spec.rb +88 -0
- data/spec/config/subject_item_policy_spec.rb +81 -0
- data/spec/crl/administrator_spec.rb +199 -0
- data/spec/crl/reader_writer_spec.rb +97 -0
- data/spec/crl/signed_list_spec.rb +84 -0
- data/spec/csr_spec.rb +43 -36
- data/spec/engine_spec.rb +51 -0
- data/spec/fixtures.rb +40 -40
- data/spec/fixtures/cert1.pem +1 -1
- data/spec/fixtures/config_pool_test_minimal.yaml +11 -15
- data/spec/fixtures/config_test.yaml +96 -59
- data/spec/fixtures/config_test_dsa.yaml +29 -35
- data/spec/fixtures/config_test_ec.yaml +29 -35
- data/spec/fixtures/config_test_engine_key.yaml +7 -7
- data/spec/fixtures/config_test_engine_no_key_name.yaml +6 -6
- data/spec/fixtures/config_test_minimal.yaml +3 -5
- data/spec/fixtures/config_test_password.yaml +4 -6
- data/spec/fixtures/config_test_various.yaml +147 -137
- data/spec/fixtures/crl_list_file.txt +1 -1
- data/spec/fixtures/test_ca_crl.cer +20 -0
- data/spec/fixtures/test_ca_crl.key +28 -0
- data/spec/fixtures/test_ca_crl.p12 +0 -0
- data/spec/message_digest_spec.rb +6 -0
- data/spec/oid_mapper_spec.rb +11 -0
- data/spec/private_key_spec.rb +19 -18
- data/spec/spec_helper.rb +10 -6
- data/spec/spki_spec.rb +38 -19
- data/spec/subject_spec.rb +16 -0
- metadata +108 -59
- metadata.gz.sig +0 -0
- data/README.md +0 -638
- data/doc/R509/Config/CAProfile.html +0 -1015
- data/doc/R509/IOHelpers.html +0 -564
- data/lib/r509/certificate_authority.rb +0 -407
- data/lib/r509/crl.rb +0 -351
- data/spec/cert/extensions_spec.rb +0 -1095
- data/spec/certificate_authority_spec.rb +0 -681
- data/spec/config_spec.rb +0 -562
- data/spec/crl_spec.rb +0 -226
data/doc/R509/IOHelpers.html
DELETED
@@ -1,564 +0,0 @@
|
|
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.5
|
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="CRL/Administrator.html" title="R509::CRL::Administrator (class)">CRL::Administrator</a></span>, <span class='object_link'><a href="CRL/SignedList.html" title="R509::CRL::SignedList (class)">CRL::SignedList</a></span>, <span class='object_link'><a href="CSR.html" title="R509::CSR (class)">CSR</a></span>, <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="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 Apr 23 10:46:04 2013 by
|
559
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
560
|
-
0.8.5 (ruby-1.9.3).
|
561
|
-
</div>
|
562
|
-
|
563
|
-
</body>
|
564
|
-
</html>
|