Skip to content

Commit a397970

Browse files
committed
Remove extra public methods on IO
1 parent e69ad48 commit a397970

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

spec/tags/truffle/methods_tags.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,13 @@ fails:Public methods on Hash should not include sort
2323
fails:Public methods on IO should include fdatasync
2424
fails:Public methods on IO should include pread
2525
fails:Public methods on IO should include pwrite
26-
fails:Public methods on IO should not include buffer_empty?
2726
fails:Public methods on IO should not include descriptor
2827
fails:Public methods on IO should not include descriptor=
2928
fails:Public methods on IO should not include dup
3029
fails:Public methods on IO should not include encode_with
3130
fails:Public methods on IO should not include eof!
32-
fails:Public methods on IO should not include external
33-
fails:Public methods on IO should not include external=
3431
fails:Public methods on IO should not include force_read_only
3532
fails:Public methods on IO should not include force_write_only
36-
fails:Public methods on IO should not include increment_lineno
37-
fails:Public methods on IO should not include internal
38-
fails:Public methods on IO should not include internal=
39-
fails:Public methods on IO should not include mode
40-
fails:Public methods on IO should not include mode=
4133
fails:Public methods on IO should not include mode_read_only?
4234
fails:Public methods on IO should not include mode_write_only?
4335
fails:Public methods on IO should not include nonblock

src/main/ruby/truffleruby/core/io.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,6 @@ def inspect # :nodoc:
349349
end
350350

351351
attr_accessor :descriptor
352-
attr_accessor :external
353-
attr_accessor :internal
354-
attr_accessor :mode
355352

356353
def mode_read_only?
357354
@mode & ACCMODE == RDONLY
@@ -964,7 +961,9 @@ def self.select(readables=nil, writables=nil, errorables=nil, timeout=nil)
964961
Truffle::Type.coerce_to(readables, Array, :to_ary).map do |obj|
965962
if obj.kind_of? IO
966963
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
968967
obj
969968
else
970969
io = Truffle::Type.coerce_to(obj, IO, :to_io)
@@ -1131,7 +1130,7 @@ def self.setup(io, fd, mode=nil, sync=false)
11311130
io.close if io.descriptor != -1
11321131

11331132
io.descriptor = fd
1134-
io.mode = mode || cur_mode
1133+
io.instance_variable_set(:@mode, mode || cur_mode)
11351134
io.sync = !!sync
11361135
io.autoclose = true
11371136
io.instance_variable_set :@ibuffer, IO::InternalBuffer.new
@@ -1248,8 +1247,9 @@ def binmode
12481247
def binmode?
12491248
!@binmode.nil?
12501249
end
1250+
12511251
# Used to find out if there is buffered data available.
1252-
def buffer_empty?
1252+
private def buffer_empty?
12531253
@ibuffer.empty?
12541254
end
12551255

@@ -1391,7 +1391,7 @@ def read_to_separator
13911391
s = IO.read_encode(@io, s)
13921392
s.taint
13931393

1394-
$. = @io.increment_lineno
1394+
$. = @io.__send__(:increment_lineno)
13951395
@buffer.discard @skip if @skip
13961396

13971397
yield s
@@ -1422,7 +1422,7 @@ def read_to_separator_with_limit
14221422
str = IO.read_encode(@io, str)
14231423
str.taint
14241424

1425-
$. = @io.increment_lineno
1425+
$. = @io.__send__(:increment_lineno)
14261426
@buffer.discard @skip if @skip
14271427

14281428
yield str
@@ -1436,7 +1436,7 @@ def read_to_separator_with_limit
14361436
str = @buffer.read_to_char_boundary(@io, str)
14371437
str.taint
14381438

1439-
$. = @io.increment_lineno
1439+
$. = @io.__send__(:increment_lineno)
14401440
@buffer.discard @skip if @skip
14411441

14421442
yield str
@@ -1477,7 +1477,7 @@ def read_to_limit
14771477
str = @buffer.read_to_char_boundary(@io, str)
14781478
str.taint
14791479

1480-
$. = @io.increment_lineno
1480+
$. = @io.__send__(:increment_lineno)
14811481
yield str
14821482

14831483
str = +''
@@ -1495,13 +1495,13 @@ def yield_string(str)
14951495
unless str.empty?
14961496
str = IO.read_encode(@io, str)
14971497
str.taint
1498-
$. = @io.increment_lineno
1498+
$. = @io.__send__(:increment_lineno)
14991499
yield str
15001500
end
15011501
end
15021502
end
15031503

1504-
def increment_lineno
1504+
private def increment_lineno
15051505
@lineno += 1
15061506
end
15071507

0 commit comments

Comments
 (0)