mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
delete deprecated IO-like methods
This commit deletes
{IO,ARGF,StringIO,Zib::GZipReader}#{bytes,chars,lines,codepoints}, which
have been deprecated since c47c095b97
.
Note that String also has those methods. They are neither depreacted
nor deleted because they are not aliases of counterpart each_something.
This commit is contained in:
parent
84eb2bfab9
commit
43b95bafd5
20 changed files with 196 additions and 360 deletions
|
@ -832,18 +832,6 @@ strio_each_byte(VALUE self)
|
|||
return self;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is a deprecated alias for #each_byte.
|
||||
*/
|
||||
static VALUE
|
||||
strio_bytes(VALUE self)
|
||||
{
|
||||
rb_warn("StringIO#bytes is deprecated; use #each_byte instead");
|
||||
if (!rb_block_given_p())
|
||||
return rb_enumeratorize(self, ID2SYM(rb_intern("each_byte")), 0, 0);
|
||||
return strio_each_byte(self);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* strio.getc -> string or nil
|
||||
|
@ -1057,18 +1045,6 @@ strio_each_char(VALUE self)
|
|||
return self;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is a deprecated alias for #each_char.
|
||||
*/
|
||||
static VALUE
|
||||
strio_chars(VALUE self)
|
||||
{
|
||||
rb_warn("StringIO#chars is deprecated; use #each_char instead");
|
||||
if (!rb_block_given_p())
|
||||
return rb_enumeratorize(self, ID2SYM(rb_intern("each_char")), 0, 0);
|
||||
return strio_each_char(self);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* strio.each_codepoint {|c| block } -> strio
|
||||
|
@ -1101,18 +1077,6 @@ strio_each_codepoint(VALUE self)
|
|||
return self;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is a deprecated alias for #each_codepoint.
|
||||
*/
|
||||
static VALUE
|
||||
strio_codepoints(VALUE self)
|
||||
{
|
||||
rb_warn("StringIO#codepoints is deprecated; use #each_codepoint instead");
|
||||
if (!rb_block_given_p())
|
||||
return rb_enumeratorize(self, ID2SYM(rb_intern("each_codepoint")), 0, 0);
|
||||
return strio_each_codepoint(self);
|
||||
}
|
||||
|
||||
/* Boyer-Moore search: copied from regex.c */
|
||||
static void
|
||||
bm_init_skip(long *skip, const char *pat, long m)
|
||||
|
@ -1363,18 +1327,6 @@ strio_each(int argc, VALUE *argv, VALUE self)
|
|||
return self;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is a deprecated alias for #each_line.
|
||||
*/
|
||||
static VALUE
|
||||
strio_lines(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
rb_warn("StringIO#lines is deprecated; use #each_line instead");
|
||||
if (!rb_block_given_p())
|
||||
return rb_enumeratorize(self, ID2SYM(rb_intern("each_line")), argc, argv);
|
||||
return strio_each(argc, argv, self);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* strio.readlines(sep=$/, chomp: false) -> array
|
||||
|
@ -1843,13 +1795,9 @@ Init_stringio(void)
|
|||
|
||||
rb_define_method(StringIO, "each", strio_each, -1);
|
||||
rb_define_method(StringIO, "each_line", strio_each, -1);
|
||||
rb_define_method(StringIO, "lines", strio_lines, -1);
|
||||
rb_define_method(StringIO, "each_byte", strio_each_byte, 0);
|
||||
rb_define_method(StringIO, "bytes", strio_bytes, 0);
|
||||
rb_define_method(StringIO, "each_char", strio_each_char, 0);
|
||||
rb_define_method(StringIO, "chars", strio_chars, 0);
|
||||
rb_define_method(StringIO, "each_codepoint", strio_each_codepoint, 0);
|
||||
rb_define_method(StringIO, "codepoints", strio_codepoints, 0);
|
||||
rb_define_method(StringIO, "getc", strio_getc, 0);
|
||||
rb_define_method(StringIO, "ungetc", strio_ungetc, 1);
|
||||
rb_define_method(StringIO, "ungetbyte", strio_ungetbyte, 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue