crypt 1.1.4 → 2.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.
- checksums.yaml +7 -0
- data/crypt/blowfish.rb +25 -23
- data/crypt/cbc.rb +26 -28
- data/crypt/idea.rb +30 -31
- data/crypt/noise.rb +10 -10
- data/crypt/rijndael.rb +55 -50
- data/crypt/stringxor.rb +6 -6
- data/test/test-blowfish.rb +14 -13
- data/test/test-gost.rb +13 -11
- data/test/test-idea.rb +22 -19
- data/test/test-rijndael.rb +29 -27
- metadata +56 -49
- data/crypt/purerubystringio.rb +0 -378
data/test/test-rijndael.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# updated 11-Feb-2014 for ruby 2.0 - convert test strings into byte arrays, expected value representation
|
2
|
+
|
1
3
|
require 'test/unit'
|
2
4
|
require 'crypt/rijndael'
|
3
5
|
require 'fileutils'
|
@@ -9,36 +11,36 @@ class TestRijndael < Test::Unit::TestCase
|
|
9
11
|
|
10
12
|
def teardown
|
11
13
|
end
|
12
|
-
|
13
|
-
|
14
|
-
|
14
|
+
|
15
|
+
def test_init
|
16
|
+
assert_raise(RuntimeError) {
|
15
17
|
rijndael = Crypt::Rijndael.new("Who is this John Galt guy, anyway?", 64)
|
16
18
|
}
|
17
|
-
|
19
|
+
assert_raise(RuntimeError) {
|
18
20
|
rijndael = Crypt::Rijndael.new("Who is this John Galt guy, anyway?", 128, 64)
|
19
21
|
}
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_block_size
|
25
|
+
rijndael = Crypt::Rijndael.new("Who is this John Galt guy, anyway?", 128, 256)
|
26
|
+
assert_equal(32, rijndael.block_size)
|
27
|
+
rijndael = Crypt::Rijndael.new("Who is this John Galt guy, anyway?", 256, 128)
|
28
|
+
assert_equal(16, rijndael.block_size)
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_block
|
32
|
+
rijndael = Crypt::Rijndael.new("Who is this John Galt guy, anyway?", 128, 128)
|
33
|
+
block = "This block \u00cd 16" # unicode string of 16 bytes
|
34
|
+
encryptedBlock = rijndael.encrypt_block(block)
|
35
|
+
assert_equal("\x8E\x88\x03\xB8> PnwR)\x93\x1A\xC9:\xC4".force_encoding("ASCII-8BIT"), encryptedBlock)
|
36
|
+
decryptedBlock = rijndael.decrypt_block(encryptedBlock)
|
37
|
+
assert_equal(block.force_encoding("ASCII-8BIT"), decryptedBlock)
|
38
|
+
rijndael = Crypt::Rijndael.new("Who is this John Galt guy, anyway?", 128, 256)
|
39
|
+
assert_raise(RuntimeError) {
|
32
40
|
encryptedBlock = rijndael.encrypt_block(block)
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
rijndael = Crypt::Rijndael.new("Who is this John Galt guy, anyway?", 128, 256)
|
37
|
-
assert_raise(RuntimeError) {
|
38
|
-
encryptedBlock = rijndael.encrypt_block(block)
|
39
|
-
}
|
40
|
-
end
|
41
|
-
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
42
44
|
def test_string
|
43
45
|
rijndael = Crypt::Rijndael.new("Who is this John Galt guy, anyway?")
|
44
46
|
string = "This is a string which is not a multiple of 8 characters long"
|
@@ -46,7 +48,7 @@ class TestRijndael < Test::Unit::TestCase
|
|
46
48
|
decryptedString = rijndael.decrypt_string(encryptedString)
|
47
49
|
assert_equal(string, decryptedString)
|
48
50
|
end
|
49
|
-
|
51
|
+
|
50
52
|
def test_file
|
51
53
|
plainText = "This is a multi-line string\nwhich is not a multiple of 8 \ncharacters long."
|
52
54
|
plainFile = File.new('plain.txt', 'wb+')
|
@@ -64,4 +66,4 @@ class TestRijndael < Test::Unit::TestCase
|
|
64
66
|
FileUtils.rm('decrypt.txt')
|
65
67
|
end
|
66
68
|
|
67
|
-
end
|
69
|
+
end
|
metadata
CHANGED
@@ -1,55 +1,62 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.8.10
|
3
|
-
specification_version: 1
|
1
|
+
--- !ruby/object:Gem::Specification
|
4
2
|
name: crypt
|
5
|
-
version: !ruby/object:Gem::Version
|
6
|
-
version:
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
Rijndael (AES). Cypher Block Chaining (CBC) has been implemented. Twofish,
|
11
|
-
Serpent, and CAST256 are planned for release soon."
|
12
|
-
require_paths:
|
13
|
-
- "."
|
14
|
-
email: kernighan_rich@rubyforge.org
|
15
|
-
homepage: http://crypt.rubyforge.org/
|
16
|
-
rubyforge_project: crypt
|
17
|
-
description:
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '2.0'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Richard Kernahan
|
18
8
|
autorequire:
|
19
|
-
default_executable:
|
20
9
|
bindir: bin
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
platform: ruby
|
30
|
-
authors:
|
31
|
-
- Richard Kernahan
|
32
|
-
files:
|
33
|
-
- crypt/blowfish-tables.rb
|
34
|
-
- crypt/blowfish.rb
|
35
|
-
- crypt/cbc.rb
|
36
|
-
- crypt/gost.rb
|
37
|
-
- crypt/idea.rb
|
38
|
-
- crypt/noise.rb
|
39
|
-
- crypt/purerubystringio.rb
|
40
|
-
- crypt/rijndael-tables.rb
|
41
|
-
- crypt/rijndael.rb
|
42
|
-
- crypt/stringxor.rb
|
43
|
-
- test/break-idea.rb
|
44
|
-
- test/devServer.rb
|
45
|
-
- test/test-blowfish.rb
|
46
|
-
- test/test-gost.rb
|
47
|
-
- test/test-idea.rb
|
48
|
-
- test/test-rijndael.rb
|
49
|
-
test_files: []
|
50
|
-
rdoc_options: []
|
51
|
-
extra_rdoc_files: []
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-02-11 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: The Crypt library is a pure-ruby implementation of a number of popular
|
14
|
+
encryption algorithms. Block cyphers currently include Blowfish, GOST, IDEA, and
|
15
|
+
Rijndael (AES). Cypher Block Chaining (CBC) has been implemented, and unicode is
|
16
|
+
supported.
|
17
|
+
email: kernighan_rich@rubyforge.org
|
52
18
|
executables: []
|
53
19
|
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- crypt/blowfish-tables.rb
|
23
|
+
- crypt/blowfish.rb
|
24
|
+
- crypt/cbc.rb
|
25
|
+
- crypt/gost.rb
|
26
|
+
- crypt/idea.rb
|
27
|
+
- crypt/noise.rb
|
28
|
+
- crypt/rijndael-tables.rb
|
29
|
+
- crypt/rijndael.rb
|
30
|
+
- crypt/stringxor.rb
|
31
|
+
- test/break-idea.rb
|
32
|
+
- test/devServer.rb
|
33
|
+
- test/test-blowfish.rb
|
34
|
+
- test/test-gost.rb
|
35
|
+
- test/test-idea.rb
|
36
|
+
- test/test-rijndael.rb
|
37
|
+
homepage: http://crypt.rubyforge.org/
|
38
|
+
licenses:
|
39
|
+
- MIT
|
40
|
+
metadata: {}
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options: []
|
43
|
+
require_paths:
|
44
|
+
- .
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
54
55
|
requirements: []
|
55
|
-
|
56
|
+
rubyforge_project: crypt
|
57
|
+
rubygems_version: 2.1.10
|
58
|
+
signing_key:
|
59
|
+
specification_version: 4
|
60
|
+
summary: Pure-ruby cryptographic library including Blowfish, GOST, IDEA, and Rijndael
|
61
|
+
(AES).
|
62
|
+
test_files: []
|
data/crypt/purerubystringio.rb
DELETED
@@ -1,378 +0,0 @@
|
|
1
|
-
# Thanks to Binky DaClown who wrote this pure-ruby implementation
|
2
|
-
# http://rubyforge.org/projects/prstringio/
|
3
|
-
# Apparently CBC does not work well with the C-based stringio
|
4
|
-
|
5
|
-
module Crypt
|
6
|
-
class PureRubyStringIO
|
7
|
-
|
8
|
-
include Enumerable
|
9
|
-
|
10
|
-
SEEK_CUR = IO::SEEK_CUR
|
11
|
-
SEEK_END = IO::SEEK_END
|
12
|
-
SEEK_SET = IO::SEEK_SET
|
13
|
-
|
14
|
-
@@relayMethods = [:<<, :all?, :any?, :binmode, :close, :close_read, :close_write, :closed?, :closed_read?,
|
15
|
-
:closed_write?, :collect, :detect, :each, :each_byte, :each_line, :each_with_index,
|
16
|
-
:entries, :eof, :eof?, :fcntl, :fileno, :find, :find_all, :flush, :fsync, :getc, :gets,
|
17
|
-
:grep, :include?, :inject, :isatty, :length, :lineno, :lineno=, :map, :max, :member?,
|
18
|
-
:min, :partition, :path, :pid, :pos, :pos=, :print, :printf, :putc, :puts, :read,
|
19
|
-
:readchar, :readline, :readlines, :reject, :rewind, :seek, :select, :size, :sort,
|
20
|
-
:sort_by, :string, :string=, :sync, :sync=, :sysread, :syswrite, :tell, :truncate, :tty?,
|
21
|
-
:ungetc, :write, :zip]
|
22
|
-
|
23
|
-
def self.open(string="", mode="r+")
|
24
|
-
if block_given? then
|
25
|
-
sio = new(string, mode)
|
26
|
-
rc = yield(sio)
|
27
|
-
sio.close
|
28
|
-
rc
|
29
|
-
else
|
30
|
-
new(string, mode)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def <<(obj)
|
35
|
-
requireWritable
|
36
|
-
write obj
|
37
|
-
self
|
38
|
-
end
|
39
|
-
|
40
|
-
def binmode
|
41
|
-
self
|
42
|
-
end
|
43
|
-
|
44
|
-
def close
|
45
|
-
requireOpen
|
46
|
-
@sio_closed_read = true
|
47
|
-
@sio_closed_write = true
|
48
|
-
self
|
49
|
-
end
|
50
|
-
|
51
|
-
def close_read
|
52
|
-
raise IOError, "closing non-duplex IO for reading", caller if closed_read?
|
53
|
-
@sio_closed_read = true
|
54
|
-
self
|
55
|
-
end
|
56
|
-
|
57
|
-
def close_write
|
58
|
-
raise IOError, "closing non-duplex IO for writing", caller if closed_write?
|
59
|
-
@sio_closed_read = true
|
60
|
-
self
|
61
|
-
end
|
62
|
-
|
63
|
-
def closed?
|
64
|
-
closed_read? && closed_write?
|
65
|
-
end
|
66
|
-
|
67
|
-
def closed_read?
|
68
|
-
@sio_closed_read
|
69
|
-
end
|
70
|
-
|
71
|
-
def closed_write?
|
72
|
-
@sio_closed_write
|
73
|
-
end
|
74
|
-
|
75
|
-
def each(sep_string=$/, &block)
|
76
|
-
requireReadable
|
77
|
-
@sio_string.each(sep_string, &block)
|
78
|
-
@sio_pos = @sio_string.length
|
79
|
-
end
|
80
|
-
|
81
|
-
def each_byte(&block)
|
82
|
-
requireReadable
|
83
|
-
@sio_string.each_byte(&block)
|
84
|
-
@sio_pos = @sio_string.length
|
85
|
-
end
|
86
|
-
|
87
|
-
def eof
|
88
|
-
requireReadable { @sio_pos >= @sio_string.length }
|
89
|
-
end
|
90
|
-
|
91
|
-
def fcntl(integer_cmd, arg)
|
92
|
-
raise NotImplementedError, "The fcntl() function is unimplemented on this machine", caller
|
93
|
-
end
|
94
|
-
|
95
|
-
def fileno
|
96
|
-
nil
|
97
|
-
end
|
98
|
-
|
99
|
-
def flush
|
100
|
-
self
|
101
|
-
end
|
102
|
-
|
103
|
-
def fsync
|
104
|
-
0
|
105
|
-
end
|
106
|
-
|
107
|
-
def getc
|
108
|
-
requireReadable
|
109
|
-
char = @sio_string[@sio_pos]
|
110
|
-
@sio_pos += 1 unless char.nil?
|
111
|
-
char
|
112
|
-
end
|
113
|
-
|
114
|
-
def gets(sep_string=$/)
|
115
|
-
requireReadable
|
116
|
-
@sio_lineno += 1
|
117
|
-
pstart = @sio_pos
|
118
|
-
@sio_pos = @sio_string.index(sep_string, @sio_pos) || [@sio_string.length, @sio_pos].max
|
119
|
-
@sio_string[pstart..@sio_pos]
|
120
|
-
end
|
121
|
-
|
122
|
-
def initialize(string="", mode="r+")
|
123
|
-
@sio_string = string.to_s
|
124
|
-
@sio_lineno = 0
|
125
|
-
@mode = mode
|
126
|
-
@relay = nil
|
127
|
-
case mode.delete("b")
|
128
|
-
when "r"
|
129
|
-
@sio_closed_read = false
|
130
|
-
@sio_closed_write = true
|
131
|
-
@sio_pos = 0
|
132
|
-
when "r+"
|
133
|
-
@sio_closed_read = false
|
134
|
-
@sio_closed_write = false
|
135
|
-
@sio_pos = 0
|
136
|
-
when "w"
|
137
|
-
@sio_closed_read = true
|
138
|
-
@sio_closed_write = false
|
139
|
-
@sio_pos = 0
|
140
|
-
@sio_string.replace("")
|
141
|
-
when "w+"
|
142
|
-
@sio_closed_read = false
|
143
|
-
@sio_closed_write = false
|
144
|
-
@sio_pos = 0
|
145
|
-
@sio_string.replace("")
|
146
|
-
when "a"
|
147
|
-
@sio_closed_read = true
|
148
|
-
@sio_closed_write = false
|
149
|
-
@sio_pos = @sio_string.length
|
150
|
-
when "a+"
|
151
|
-
@sio_closed_read = false
|
152
|
-
@sio_closed_write = false
|
153
|
-
@sio_pos = @sio_string.length
|
154
|
-
else
|
155
|
-
raise ArgumentError, "illegal access mode #{mode}", caller
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
def isatty
|
160
|
-
flase
|
161
|
-
end
|
162
|
-
|
163
|
-
def length
|
164
|
-
@sio_string.length
|
165
|
-
end
|
166
|
-
|
167
|
-
def lineno
|
168
|
-
@sio_lineno
|
169
|
-
end
|
170
|
-
|
171
|
-
def lineno=(integer)
|
172
|
-
@sio_lineno = integer
|
173
|
-
end
|
174
|
-
|
175
|
-
def path
|
176
|
-
nil
|
177
|
-
end
|
178
|
-
|
179
|
-
def pid
|
180
|
-
nil
|
181
|
-
end
|
182
|
-
|
183
|
-
def pos
|
184
|
-
@sio_pos
|
185
|
-
end
|
186
|
-
|
187
|
-
def pos=(integer)
|
188
|
-
raise Errno::EINVAL, "Invalid argument", caller if integer < 0
|
189
|
-
@sio_pos = integer
|
190
|
-
end
|
191
|
-
|
192
|
-
def print(*args)
|
193
|
-
requireWritable
|
194
|
-
args.unshift($_) if args.empty
|
195
|
-
args.each { |obj| write(obj) }
|
196
|
-
write($\) unless $\.nil?
|
197
|
-
nil
|
198
|
-
end
|
199
|
-
|
200
|
-
def printf(format_string, *args)
|
201
|
-
requireWritable
|
202
|
-
write format(format_string, *args)
|
203
|
-
nil
|
204
|
-
end
|
205
|
-
|
206
|
-
def putc(obj)
|
207
|
-
requireWritable
|
208
|
-
write(obj.is_a?(Numeric) ? sprintf("%c", obj) : obj.to_s[0..0])
|
209
|
-
obj
|
210
|
-
end
|
211
|
-
|
212
|
-
def puts(*args)
|
213
|
-
requireWritable
|
214
|
-
args.unshift("") if args.empty?
|
215
|
-
args.each { |obj|
|
216
|
-
write obj
|
217
|
-
write $/
|
218
|
-
}
|
219
|
-
nil
|
220
|
-
end
|
221
|
-
|
222
|
-
def read(length=nil, buffer=nil)
|
223
|
-
requireReadable
|
224
|
-
len = length || [@sio_string.length - @sio_pos, 0].max
|
225
|
-
raise ArgumentError, "negative length #{len} given", caller if len < 0
|
226
|
-
buffer ||= ""
|
227
|
-
pstart = @sio_pos
|
228
|
-
@sio_pos += len
|
229
|
-
buffer.replace(@sio_string[pstart..@sio_pos])
|
230
|
-
buffer.empty? && !length.nil? ? nil : buffer
|
231
|
-
end
|
232
|
-
|
233
|
-
def readchar
|
234
|
-
requireReadable
|
235
|
-
raise EOFError, "End of file reached", caller if eof?
|
236
|
-
getc
|
237
|
-
end
|
238
|
-
|
239
|
-
def readline
|
240
|
-
requireReadable
|
241
|
-
raise EOFError, "End of file reached", caller if eof?
|
242
|
-
gets
|
243
|
-
end
|
244
|
-
|
245
|
-
def readlines(sep_string=$/)
|
246
|
-
requireReadable
|
247
|
-
raise EOFError, "End of file reached", caller if eof?
|
248
|
-
rc = []
|
249
|
-
until eof
|
250
|
-
rc << gets(sep_string)
|
251
|
-
end
|
252
|
-
rc
|
253
|
-
end
|
254
|
-
|
255
|
-
def reopen(string, mode=nil)
|
256
|
-
if string.is_a?(self.class) then
|
257
|
-
raise ArgumentError, "wrong number of arguments (2 for 1)", caller if !mode.nil?
|
258
|
-
@relay = string
|
259
|
-
instance_eval(%Q{
|
260
|
-
class << self
|
261
|
-
@@relayMethods.each { |name|
|
262
|
-
define_method(name, ObjectSpace._id2ref(#{@relay.object_id}).method(("original_" + name.to_s).to_sym).to_proc)
|
263
|
-
}
|
264
|
-
end
|
265
|
-
})
|
266
|
-
else
|
267
|
-
raise ArgumentError, "wrong number of arguments (1 for 2)", caller if mode.nil?
|
268
|
-
class << self
|
269
|
-
@@relayMethods.each { |name|
|
270
|
-
alias_method(name, "original_#{name}".to_sym)
|
271
|
-
public name
|
272
|
-
}
|
273
|
-
@relay = nil
|
274
|
-
end unless @relay.nil?
|
275
|
-
@sio_string = string.to_s
|
276
|
-
@mode = mode
|
277
|
-
end
|
278
|
-
end
|
279
|
-
|
280
|
-
def rewind
|
281
|
-
@sio_pos = 0
|
282
|
-
@sio_lineno = 0
|
283
|
-
end
|
284
|
-
|
285
|
-
def seek(amount, whence=SEEK_SET)
|
286
|
-
if whence == SEEK_CUR then
|
287
|
-
offset += @sio_pos
|
288
|
-
elsif whence == SEEK_END then
|
289
|
-
offset += size
|
290
|
-
end
|
291
|
-
@sio_pos = offset
|
292
|
-
end
|
293
|
-
|
294
|
-
def string
|
295
|
-
@sio_string
|
296
|
-
end
|
297
|
-
|
298
|
-
def string=(newstring)
|
299
|
-
@sio_string = newstring
|
300
|
-
end
|
301
|
-
|
302
|
-
def sync
|
303
|
-
true
|
304
|
-
end
|
305
|
-
|
306
|
-
def sync=(boolean)
|
307
|
-
boolean
|
308
|
-
end
|
309
|
-
|
310
|
-
def sysread(length=nil, buffer=nil)
|
311
|
-
requireReadable
|
312
|
-
raise EOFError, "End of file reached", caller if eof?
|
313
|
-
read(length, buffer)
|
314
|
-
end
|
315
|
-
|
316
|
-
def syswrite(string)
|
317
|
-
requireWritable
|
318
|
-
addition = "\000" * (@sio_string.length - @sio_pos) + string.to_s
|
319
|
-
@sio_string[@sio_pos..(addition.length - 1)] = addition
|
320
|
-
@sio_pos += addition.size
|
321
|
-
addition.size
|
322
|
-
end
|
323
|
-
|
324
|
-
#In ruby 1.8.4 truncate differs from the docs in two ways.
|
325
|
-
#First, if an integer greater that the length is given then the string is expanded to the new integer
|
326
|
-
#length. As this expansion seems to contain junk characters instead of nulls I suspect this may be a
|
327
|
-
#flaw in the C code which could cause a core dump if abused/used.
|
328
|
-
#Second, the documentation states that truncate returns 0. It returns the integer instead.
|
329
|
-
#This implementation follows the documentation in the first instance as I suspect this will be fixed
|
330
|
-
#in the C code. In the second instance, it follows the actions of the C code instead of the docs.
|
331
|
-
#This was decided as it causes no immedeate harm and this ruby implentation is to be as compatable
|
332
|
-
#as possible with the C version. Should the C version change to match the docs the ruby version
|
333
|
-
#will be simple to update as well.
|
334
|
-
def truncate(integer)
|
335
|
-
requireWritable
|
336
|
-
raise Errno::EINVAL, "Invalid argument - negative length", caller if integer < 0
|
337
|
-
@sio_string[[integer, @sio_string.length].max..-1] = ""
|
338
|
-
integer
|
339
|
-
end
|
340
|
-
|
341
|
-
def ungetc(integer)
|
342
|
-
requireWritable
|
343
|
-
if @sio_pos > 0 then
|
344
|
-
@sio_pos -= 1
|
345
|
-
putc(integer)
|
346
|
-
@sio_pos -= 1
|
347
|
-
end
|
348
|
-
end
|
349
|
-
|
350
|
-
alias :each_line :each
|
351
|
-
alias :eof? :eof
|
352
|
-
alias :size :length
|
353
|
-
alias :tty? :isatty
|
354
|
-
alias :tell :pos
|
355
|
-
alias :write :syswrite
|
356
|
-
|
357
|
-
protected
|
358
|
-
@@relayMethods.each { |name|
|
359
|
-
alias_method("original_#{name}".to_sym, name)
|
360
|
-
protected "original_#{name}".to_sym
|
361
|
-
}
|
362
|
-
|
363
|
-
private
|
364
|
-
|
365
|
-
def requireReadable
|
366
|
-
raise IOError, "not opened for reading", caller[1..-1] if @sio_closed_read
|
367
|
-
end
|
368
|
-
|
369
|
-
def requireWritable
|
370
|
-
raise IOError, "not opened for writing", caller[1..-1] if @sio_closed_write
|
371
|
-
end
|
372
|
-
|
373
|
-
def requireOpen
|
374
|
-
raise IOError, "closed stream", caller[1..-1] if @sio_closed_read && @sio_closed_write
|
375
|
-
end
|
376
|
-
|
377
|
-
end
|
378
|
-
end
|