@@ -349,9 +349,6 @@ def inspect # :nodoc:
349
349
end
350
350
351
351
attr_accessor :descriptor
352
- attr_accessor :external
353
- attr_accessor :internal
354
- attr_accessor :mode
355
352
356
353
def mode_read_only?
357
354
@mode & ACCMODE == RDONLY
@@ -964,7 +961,9 @@ def self.select(readables=nil, writables=nil, errorables=nil, timeout=nil)
964
961
Truffle ::Type . coerce_to ( readables , Array , :to_ary ) . map do |obj |
965
962
if obj . kind_of? IO
966
963
raise IOError , 'closed stream' if obj . closed?
967
- return [ [ obj ] , [ ] , [ ] ] unless obj . buffer_empty?
964
+ unless obj . __send__ ( :buffer_empty? )
965
+ return [ [ obj ] , [ ] , [ ] ]
966
+ end
968
967
obj
969
968
else
970
969
io = Truffle ::Type . coerce_to ( obj , IO , :to_io )
@@ -1131,7 +1130,7 @@ def self.setup(io, fd, mode=nil, sync=false)
1131
1130
io . close if io . descriptor != -1
1132
1131
1133
1132
io . descriptor = fd
1134
- io . mode = mode || cur_mode
1133
+ io . instance_variable_set ( :@ mode, mode || cur_mode )
1135
1134
io . sync = !!sync
1136
1135
io . autoclose = true
1137
1136
io . instance_variable_set :@ibuffer , IO ::InternalBuffer . new
@@ -1248,8 +1247,9 @@ def binmode
1248
1247
def binmode?
1249
1248
!@binmode . nil?
1250
1249
end
1250
+
1251
1251
# Used to find out if there is buffered data available.
1252
- def buffer_empty?
1252
+ private def buffer_empty?
1253
1253
@ibuffer . empty?
1254
1254
end
1255
1255
@@ -1391,7 +1391,7 @@ def read_to_separator
1391
1391
s = IO . read_encode ( @io , s )
1392
1392
s . taint
1393
1393
1394
- $. = @io . increment_lineno
1394
+ $. = @io . __send__ ( : increment_lineno)
1395
1395
@buffer . discard @skip if @skip
1396
1396
1397
1397
yield s
@@ -1422,7 +1422,7 @@ def read_to_separator_with_limit
1422
1422
str = IO . read_encode ( @io , str )
1423
1423
str . taint
1424
1424
1425
- $. = @io . increment_lineno
1425
+ $. = @io . __send__ ( : increment_lineno)
1426
1426
@buffer . discard @skip if @skip
1427
1427
1428
1428
yield str
@@ -1436,7 +1436,7 @@ def read_to_separator_with_limit
1436
1436
str = @buffer . read_to_char_boundary ( @io , str )
1437
1437
str . taint
1438
1438
1439
- $. = @io . increment_lineno
1439
+ $. = @io . __send__ ( : increment_lineno)
1440
1440
@buffer . discard @skip if @skip
1441
1441
1442
1442
yield str
@@ -1477,7 +1477,7 @@ def read_to_limit
1477
1477
str = @buffer . read_to_char_boundary ( @io , str )
1478
1478
str . taint
1479
1479
1480
- $. = @io . increment_lineno
1480
+ $. = @io . __send__ ( : increment_lineno)
1481
1481
yield str
1482
1482
1483
1483
str = +''
@@ -1495,13 +1495,13 @@ def yield_string(str)
1495
1495
unless str . empty?
1496
1496
str = IO . read_encode ( @io , str )
1497
1497
str . taint
1498
- $. = @io . increment_lineno
1498
+ $. = @io . __send__ ( : increment_lineno)
1499
1499
yield str
1500
1500
end
1501
1501
end
1502
1502
end
1503
1503
1504
- def increment_lineno
1504
+ private def increment_lineno
1505
1505
@lineno += 1
1506
1506
end
1507
1507
0 commit comments