method
each_codepoint
v1_9_2_180 -
Show latest stable
- Class:
StringIO
each_codepoint()public
See IO#each_codepoint.
static VALUE
strio_each_codepoint(VALUE self)
{
struct StringIO *ptr;
rb_encoding *enc;
unsigned int c;
int n;
RETURN_ENUMERATOR(self, 0, 0);
ptr = readable(StringIO(self));
enc = rb_enc_get(ptr->string);
for (;;) {
if (ptr->pos >= RSTRING_LEN(ptr->string)) {
return self;
}
c = rb_enc_codepoint_len(RSTRING_PTR(ptr->string)+ptr->pos,
RSTRING_END(ptr->string), &n, enc);
rb_yield(UINT2NUM(c));
ptr->pos += n;
}
return self;
} Related methods
- Instance methods
- <<
- binmode
- bytes
- chars
- close
- close_read
- close_write
- closed?
- closed_read?
- closed_write?
- codepoints
- each
- each_byte
- each_char
- each_codepoint
- each_line
- eof
- eof?
- external_encoding
- fcntl
- fileno
- flush
- fsync
- getbyte
- getc
- gets
- initialize_copy
- internal_encoding
- isatty
- length
- lineno
- lineno=
- lines
- pid
- pos
- pos=
- printf
- putc
- puts
- read
- read_nonblock
- readbyte
- readchar
- readline
- readlines
- readpartial
- reopen
- rewind
- seek
- set_encoding
- size
- string
- string=
- sync
- sync=
- sysread
- syswrite
- tell
- truncate
- tty?
- ungetbyte
- ungetc
- write
- write_nonblock
- Class methods
- new
- open