/********************************************************************** string.c - $Author$ created at: Mon Aug 9 17:12:58 JST 1993 Copyright (C) 1993-2007 Yukihiro Matsumoto Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Information-technology Promotion Agency, Japan **********************************************************************/ #include "ruby/encoding.h" #include "ruby/re.h" #include "internal.h" #include "encindex.h" #include "probes.h" #include "gc.h" #include "ruby_assert.h" #include "id.h" #include "debug_counter.h" #include "ruby/util.h" #define BEG(no) (regs->beg[(no)]) #define END(no) (regs->end[(no)]) #include #include #include #ifdef HAVE_UNISTD_H #include #endif #if defined HAVE_CRYPT_R # if defined HAVE_CRYPT_H # include # endif #elif !defined HAVE_CRYPT # include "missing/crypt.h" # define HAVE_CRYPT_R 1 #endif #undef rb_str_new #undef rb_usascii_str_new #undef rb_utf8_str_new #undef rb_enc_str_new #undef rb_str_new_cstr #undef rb_tainted_str_new_cstr #undef rb_usascii_str_new_cstr #undef rb_utf8_str_new_cstr #undef rb_enc_str_new_cstr #undef rb_external_str_new_cstr #undef rb_locale_str_new_cstr #undef rb_str_dup_frozen #undef rb_str_buf_new_cstr #undef rb_str_buf_cat #undef rb_str_buf_cat2 #undef rb_str_cat2 #undef rb_str_cat_cstr #undef rb_fstring_cstr #undef rb_fstring_enc_cstr static VALUE rb_str_clear(VALUE str); VALUE rb_cString; VALUE rb_cSymbol; /* FLAGS of RString * * 1: RSTRING_NOEMBED * 2: STR_SHARED (== ELTS_SHARED) * 2-6: RSTRING_EMBED_LEN (5 bits == 32) * 5: STR_SHARED_ROOT (RSTRING_NOEMBED==1 && STR_SHARED == 0, there may be * other strings that rely on this string's buffer) * 6: STR_BORROWED (when RSTRING_NOEMBED==1 && klass==0, unsafe to recycle * early, specific to rb_str_tmp_frozen_{acquire,release}) * 7: STR_TMPLOCK * 8-9: ENC_CODERANGE (2 bits) * 10-16: ENCODING (7 bits == 128) * 17: RSTRING_FSTR * 18: STR_NOFREE * 19: STR_FAKESTR */ #define RUBY_MAX_CHAR_LEN 16 #define STR_SHARED_ROOT FL_USER5 #define STR_BORROWED FL_USER6 #define STR_TMPLOCK FL_USER7 #define STR_NOFREE FL_USER18 #define STR_FAKESTR FL_USER19 #define STR_SET_NOEMBED(str) do {\ FL_SET((str), STR_NOEMBED);\ STR_SET_EMBED_LEN((str), 0);\ } while (0) #define STR_SET_EMBED(str) FL_UNSET((str), (STR_NOEMBED|STR_NOFREE)) #define STR_SET_EMBED_LEN(str, n) do { \ long tmp_n = (n);\ RBASIC(str)->flags &= ~RSTRING_EMBED_LEN_MASK;\ RBASIC(str)->flags |= (tmp_n) << RSTRING_EMBED_LEN_SHIFT;\ } while (0) #define STR_SET_LEN(str, n) do { \ if (STR_EMBED_P(str)) {\ STR_SET_EMBED_LEN((str), (n));\ }\ else {\ RSTRING(str)->as.heap.len = (n);\ }\ } while (0) #define STR_DEC_LEN(str) do {\ if (STR_EMBED_P(str)) {\ long n = RSTRING_LEN(str);\ n--;\ STR_SET_EMBED_LEN((str), n);\ }\ else {\ RSTRING(str)->as.heap.len--;\ }\ } while (0) #define TERM_LEN(str) rb_enc_mbminlen(rb_enc_get(str)) #define TERM_FILL(ptr, termlen) do {\ char *const term_fill_ptr = (ptr);\ const int term_fill_len = (termlen);\ *term_fill_ptr = '\0';\ if (UNLIKELY(term_fill_len > 1))\ memset(term_fill_ptr, 0, term_fill_len);\ } while (0) #define RESIZE_CAPA(str,capacity) do {\ const int termlen = TERM_LEN(str);\ RESIZE_CAPA_TERM(str,capacity,termlen);\ } while (0) #define RESIZE_CAPA_TERM(str,capacity,termlen) do {\ if (STR_EMBED_P(str)) {\ if (!STR_EMBEDDABLE_P(capacity, termlen)) {\ char *const tmp = ALLOC_N(char, (size_t)(capacity) + (termlen));\ const long tlen = RSTRING_LEN(str);\ memcpy(tmp, RSTRING_PTR(str), tlen);\ RSTRING(str)->as.heap.ptr = tmp;\ RSTRING(str)->as.heap.len = tlen;\ STR_SET_NOEMBED(str);\ RSTRING(str)->as.heap.aux.capa = (capacity);\ }\ }\ else {\ assert(!FL_TEST((str), STR_SHARED)); \ SIZED_REALLOC_N(RSTRING(str)->as.heap.ptr, char, \ (size_t)(capacity) + (termlen), STR_HEAP_SIZE(str)); \ RSTRING(str)->as.heap.aux.capa = (capacity);\ }\ } while (0) #define STR_SET_SHARED(str, shared_str) do { \ if (!FL_TEST(str, STR_FAKESTR)) { \ RB_OBJ_WRITE((str), &RSTRING(str)->as.heap.aux.shared, (shared_str)); \ FL_SET((str), STR_SHARED); \ FL_SET((shared_str), STR_SHARED_ROOT); \ if (RBASIC_CLASS((shared_str)) == 0) /* for CoW-friendliness */ \ FL_SET_RAW((shared_str), STR_BORROWED); \ } \ } while (0) #define STR_HEAP_PTR(str) (RSTRING(str)->as.heap.ptr) #define STR_HEAP_SIZE(str) ((size_t)RSTRING(str)->as.heap.aux.capa + TERM_LEN(str)) #define STR_ENC_GET(str) get_encoding(str) #if !defined SHARABLE_MIDDLE_SUBSTRING # define SHARABLE_MIDDLE_SUBSTRING 0 #endif #if !SHARABLE_MIDDLE_SUBSTRING #define SHARABLE_SUBSTRING_P(beg, len, end) ((beg) + (len) == (end)) #else #define SHARABLE_SUBSTRING_P(beg, len, end) 1 #endif #define STR_EMBEDDABLE_P(len, termlen) \ ((len) <= RSTRING_EMBED_LEN_MAX + 1 - (termlen)) static VALUE str_replace_shared_without_enc(VALUE str2, VALUE str); static VALUE str_new_shared(VALUE klass, VALUE str); static VALUE str_new_frozen(VALUE klass, VALUE orig); static VALUE str_new_static(VALUE klass, const char *ptr, long len, int encindex); static void str_make_independent_expand(VALUE str, long len, long expand, const int termlen); static inline void str_modifiable(VALUE str); static VALUE rb_str_downcase(int argc, VALUE *argv, VALUE str); static inline void str_make_independent(VALUE str) { long len = RSTRING_LEN(str); int termlen = TERM_LEN(str); str_make_independent_expand((str), len, 0L, termlen); } /* symbols for [up|down|swap]case/capitalize options */ static VALUE sym_ascii, sym_turkic, sym_lithuanian, sym_fold; static rb_encoding * get_actual_encoding(const int encidx, VALUE str) { const unsigned char *q; switch (encidx) { case ENCINDEX_UTF_16: if (RSTRING_LEN(str) < 2) break; q = (const unsigned char *)RSTRING_PTR(str); if (q[0] == 0xFE && q[1] == 0xFF) { return rb_enc_get_from_index(ENCINDEX_UTF_16BE); } if (q[0] == 0xFF && q[1] == 0xFE) { return rb_enc_get_from_index(ENCINDEX_UTF_16LE); } return rb_ascii8bit_encoding(); case ENCINDEX_UTF_32: if (RSTRING_LEN(str) < 4) break; q = (const unsigned char *)RSTRING_PTR(str); if (q[0] == 0 && q[1] == 0 && q[2] == 0xFE && q[3] == 0xFF) { return rb_enc_get_from_index(ENCINDEX_UTF_32BE); } if (q[3] == 0 && q[2] == 0 && q[1] == 0xFE && q[0] == 0xFF) { return rb_enc_get_from_index(ENCINDEX_UTF_32LE); } return rb_ascii8bit_encoding(); } return rb_enc_from_index(encidx); } static rb_encoding * get_encoding(VALUE str) { return get_actual_encoding(ENCODING_GET(str), str); } static void mustnot_broken(VALUE str) { if (is_broken_string(str)) { rb_raise(rb_eArgError, "invalid byte sequence in %s", rb_enc_name(STR_ENC_GET(str))); } } static void mustnot_wchar(VALUE str) { rb_encoding *enc = STR_ENC_GET(str); if (rb_enc_mbminlen(enc) > 1) { rb_raise(rb_eArgError, "wide char encoding: %s", rb_enc_name(enc)); } } static int fstring_cmp(VALUE a, VALUE b); static VALUE register_fstring(VALUE str); const struct st_hash_type rb_fstring_hash_type = { fstring_cmp, rb_str_hash, }; #define BARE_STRING_P(str) (!FL_ANY_RAW(str, FL_TAINT|FL_EXIVAR) && RBASIC_CLASS(str) == rb_cString) static int fstr_update_callback(st_data_t *key, st_data_t *value, st_data_t arg, int existing) { VALUE *fstr = (VALUE *)arg; VALUE str = (VALUE)*key; if (existing) { /* because of lazy sweep, str may be unmarked already and swept * at next time */ if (rb_objspace_garbage_object_p(str)) { *fstr = Qundef; return ST_DELETE; } *fstr = str; return ST_STOP; } else { if (FL_TEST_RAW(str, STR_FAKESTR)) { str = str_new_static(rb_cString, RSTRING(str)->as.heap.ptr, RSTRING(str)->as.heap.len, ENCODING_GET(str)); OBJ_FREEZE_RAW(str); } else { str = str_new_frozen(rb_cString, str); if (STR_SHARED_P(str)) { /* str should not be shared */ /* shared substring */ str_make_independent(str); assert(OBJ_FROZEN(str)); } if (!BARE_STRING_P(str)) { str = str_new_frozen(rb_cString, str); } } RBASIC(str)->flags |= RSTRING_FSTR; *key = *value = *fstr = str; return ST_CONTINUE; } } RUBY_FUNC_EXPORTED VALUE rb_fstring(VALUE str) { VALUE fstr; int bare; Check_Type(str, T_STRING); if (FL_TEST(str, RSTRING_FSTR)) return str; bare = BARE_STRING_P(str); if (!bare) { if (STR_EMBED_P(str)) { OBJ_FREEZE_RAW(str); return str; } if (FL_TEST_RAW(str, STR_NOEMBED|STR_SHARED_ROOT|STR_SHARED) == (STR_NOEMBED|STR_SHARED_ROOT)) { assert(OBJ_FROZEN(str)); return str; } } if (!OBJ_FROZEN(str)) rb_str_resize(str, RSTRING_LEN(str)); fstr = register_fstring(str); if (!bare) { str_replace_shared_without_enc(str, fstr); OBJ_FREEZE_RAW(str); return str; } return fstr; } static VALUE register_fstring(VALUE str) { VALUE ret; st_table *frozen_strings = rb_vm_fstring_table(); do { ret = str; st_update(frozen_strings, (st_data_t)str, fstr_update_callback, (st_data_t)&ret); } while (ret == Qundef); assert(OBJ_FROZEN(ret)); assert(!FL_TEST_RAW(ret, STR_FAKESTR)); assert(!FL_TEST_RAW(ret, FL_EXIVAR)); assert(!FL_TEST_RAW(ret, FL_TAINT)); assert(RBASIC_CLASS(ret) == rb_cString); return ret; } static VALUE setup_fake_str(struct RString *fake_str, const char *name, long len, int encidx) { fake_str->basic.flags = T_STRING|RSTRING_NOEMBED|STR_NOFREE|STR_FAKESTR; /* SHARED to be allocated by the callback */ ENCODING_SET_INLINED((VALUE)fake_str, encidx); RBASIC_SET_CLASS_RAW((VALUE)fake_str, rb_cString); fake_str->as.heap.len = len; fake_str->as.heap.ptr = (char *)name; fake_str->as.heap.aux.capa = len; return (VALUE)fake_str; } /* * set up a fake string which refers a static string literal. */ VALUE rb_setup_fake_str(struct RString *fake_str, const char *name, long len, rb_encoding *enc) { return setup_fake_str(fake_str, name, len, rb_enc_to_index(enc)); } /* * rb_fstring_new and rb_fstring_cstr family create or lookup a frozen * shared string which refers a static string literal. `ptr` must * point a constant string. */ MJIT_FUNC_EXPORTED VALUE rb_fstring_new(const char *ptr, long len) { struct RString fake_str; return register_fstring(setup_fake_str(&fake_str, ptr, len, ENCINDEX_US_ASCII)); } VALUE rb_fstring_enc_new(const char *ptr, long len, rb_encoding *enc) { struct RString fake_str; return register_fstring(rb_setup_fake_str(&fake_str, ptr, len, enc)); } VALUE rb_fstring_cstr(const char *ptr) { return rb_fstring_new(ptr, strlen(ptr)); } VALUE rb_fstring_enc_cstr(const char *ptr, rb_encoding *enc) { return rb_fstring_enc_new(ptr, strlen(ptr), enc); } static int fstring_set_class_i(st_data_t key, st_data_t val, st_data_t arg) { RBASIC_SET_CLASS((VALUE)key, (VALUE)arg); return ST_CONTINUE; } static int fstring_cmp(VALUE a, VALUE b) { long alen, blen; const char *aptr, *bptr; RSTRING_GETMEM(a, aptr, alen); RSTRING_GETMEM(b, bptr, blen); return (alen != blen || ENCODING_GET(a) != ENCODING_GET(b) || memcmp(aptr, bptr, alen) != 0); } static inline int single_byte_optimizable(VALUE str) { rb_encoding *enc; /* Conservative. It may be ENC_CODERANGE_UNKNOWN. */ if (ENC_CODERANGE(str) == ENC_CODERANGE_7BIT) return 1; enc = STR_ENC_GET(str); if (rb_enc_mbmaxlen(enc) == 1) return 1; /* Conservative. Possibly single byte. * "\xa1" in Shift_JIS for example. */ return 0; } VALUE rb_fs; static inline const char * search_nonascii(const char *p, const char *e) { const uintptr_t *s, *t; #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) # if SIZEOF_UINTPTR_T == 8 # define NONASCII_MASK UINT64_C(0x8080808080808080) # elif SIZEOF_UINTPTR_T == 4 # define NONASCII_MASK UINT32_C(0x80808080) # else # error "don't know what to do." # endif #else # if SIZEOF_UINTPTR_T == 8 # define NONASCII_MASK ((uintptr_t)0x80808080UL << 32 | (uintptr_t)0x80808080UL) # elif SIZEOF_UINTPTR_T == 4 # define NONASCII_MASK 0x80808080UL /* or...? */ # else # error "don't know what to do." # endif #endif if (UNALIGNED_WORD_ACCESS || e - p >= SIZEOF_VOIDP) { #if !UNALIGNED_WORD_ACCESS if ((uintptr_t)p % SIZEOF_VOIDP) { int l = SIZEOF_VOIDP - (uintptr_t)p % SIZEOF_VOIDP; p += l; switch (l) { default: UNREACHABLE; #if SIZEOF_VOIDP > 4 case 7: if (p[-7]&0x80) return p-7; case 6: if (p[-6]&0x80) return p-6; case 5: if (p[-5]&0x80) return p-5; case 4: if (p[-4]&0x80) return p-4; #endif case 3: if (p[-3]&0x80) return p-3; case 2: if (p[-2]&0x80) return p-2; case 1: if (p[-1]&0x80) return p-1; case 0: break; } } #endif #if defined(HAVE_BUILTIN___BUILTIN_ASSUME_ALIGNED) &&! UNALIGNED_WORD_ACCESS #define aligned_ptr(value) \ __builtin_assume_aligned((value), sizeof(uintptr_t)) #else #define aligned_ptr(value) (uintptr_t *)(value) #endif s = aligned_ptr(p); t = (uintptr_t *)(e - (SIZEOF_VOIDP-1)); #undef aligned_ptr for (;s < t; s++) { if (*s & NONASCII_MASK) { #ifdef WORDS_BIGENDIAN return (const char *)s + (nlz_intptr(*s&NONASCII_MASK)>>3); #else return (const char *)s + (ntz_intptr(*s&NONASCII_MASK)>>3); #endif } } p = (const char *)s; } switch (e - p) { default: UNREACHABLE; #if SIZEOF_VOIDP > 4 case 7: if (e[-7]&0x80) return e-7; case 6: if (e[-6]&0x80) return e-6; case 5: if (e[-5]&0x80) return e-5; case 4: if (e[-4]&0x80) return e-4; #endif case 3: if (e[-3]&0x80) return e-3; case 2: if (e[-2]&0x80) return e-2; case 1: if (e[-1]&0x80) return e-1; case 0: return NULL; } } static int coderange_scan(const char *p, long len, rb_encoding *enc) { const char *e = p + len; if (rb_enc_to_index(enc) == rb_ascii8bit_encindex()) { /* enc is ASCII-8BIT. ASCII-8BIT string never be broken. */ p = search_nonascii(p, e); return p ? ENC_CODERANGE_VALID : ENC_CODERANGE_7BIT; } if (rb_enc_asciicompat(enc)) { p = search_nonascii(p, e); if (!p) return ENC_CODERANGE_7BIT; for (;;) { int ret = rb_enc_precise_mbclen(p, e, enc); if (!MBCLEN_CHARFOUND_P(ret)) return ENC_CODERANGE_BROKEN; p += MBCLEN_CHARFOUND_LEN(ret); if (p == e) break; p = search_nonascii(p, e); if (!p) break; } } else { while (p < e) { int ret = rb_enc_precise_mbclen(p, e, enc); if (!MBCLEN_CHARFOUND_P(ret)) return ENC_CODERANGE_BROKEN; p += MBCLEN_CHARFOUND_LEN(ret); } } return ENC_CODERANGE_VALID; } long rb_str_coderange_scan_restartable(const char *s, const char *e, rb_encoding *enc, int *cr) { const char *p = s; if (*cr == ENC_CODERANGE_BROKEN) return e - s; if (rb_enc_to_index(enc) == rb_ascii8bit_encindex()) { /* enc is ASCII-8BIT. ASCII-8BIT string never be broken. */ if (*cr == ENC_CODERANGE_VALID) return e - s; p = search_nonascii(p, e); *cr = p ? ENC_CODERANGE_VALID : ENC_CODERANGE_7BIT; return e - s; } else if (rb_enc_asciicompat(enc)) { p = search_nonascii(p, e); if (!p) { if (*cr != ENC_CODERANGE_VALID) *cr = ENC_CODERANGE_7BIT; return e - s; } for (;;) { int ret = rb_enc_precise_mbclen(p, e, enc); if (!MBCLEN_CHARFOUND_P(ret)) { *cr = MBCLEN_INVALID_P(ret) ? ENC_CODERANGE_BROKEN: ENC_CODERANGE_UNKNOWN; return p - s; } p += MBCLEN_CHARFOUND_LEN(ret); if (p == e) break; p = search_nonascii(p, e); if (!p) break; } } else { while (p < e) { int ret = rb_enc_precise_mbclen(p, e, enc); if (!MBCLEN_CHARFOUND_P(ret)) { *cr = MBCLEN_INVALID_P(ret) ? ENC_CODERANGE_BROKEN: ENC_CODERANGE_UNKNOWN; return p - s; } p += MBCLEN_CHARFOUND_LEN(ret); } } *cr = ENC_CODERANGE_VALID; return e - s; } static inline void str_enc_copy(VALUE str1, VALUE str2) { rb_enc_set_index(str1, ENCODING_GET(str2)); } static void rb_enc_cr_str_copy_for_substr(VALUE dest, VALUE src) { /* this function is designed for copying encoding and coderange * from src to new string "dest" which is made from the part of src. */ str_enc_copy(dest, src); if (RSTRING_LEN(dest) == 0) { if (!rb_enc_asciicompat(STR_ENC_GET(src))) ENC_CODERANGE_SET(dest, ENC_CODERANGE_VALID); else ENC_CODERANGE_SET(dest, ENC_CODERANGE_7BIT); return; } switch (ENC_CODERANGE(src)) { case ENC_CODERANGE_7BIT: ENC_CODERANGE_SET(dest, ENC_CODERANGE_7BIT); break; case ENC_CODERANGE_VALID: if (!rb_enc_asciicompat(STR_ENC_GET(src)) || search_nonascii(RSTRING_PTR(dest), RSTRING_END(dest))) ENC_CODERANGE_SET(dest, ENC_CODERANGE_VALID); else ENC_CODERANGE_SET(dest, ENC_CODERANGE_7BIT); break; default: break; } } static void rb_enc_cr_str_exact_copy(VALUE dest, VALUE src) { str_enc_copy(dest, src); ENC_CODERANGE_SET(dest, ENC_CODERANGE(src)); } int rb_enc_str_coderange(VALUE str) { int cr = ENC_CODERANGE(str); if (cr == ENC_CODERANGE_UNKNOWN) { int encidx = ENCODING_GET(str); rb_encoding *enc = rb_enc_from_index(encidx); if (rb_enc_mbminlen(enc) > 1 && rb_enc_dummy_p(enc) && rb_enc_mbminlen(enc = get_actual_encoding(encidx, str)) == 1) { cr = ENC_CODERANGE_BROKEN; } else { cr = coderange_scan(RSTRING_PTR(str), RSTRING_LEN(str), enc); } ENC_CODERANGE_SET(str, cr); } return cr; } int rb_enc_str_asciionly_p(VALUE str) { rb_encoding *enc = STR_ENC_GET(str); if (!rb_enc_asciicompat(enc)) return FALSE; else if (rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT) return TRUE; return FALSE; } static inline void str_mod_check(VALUE s, const char *p, long len) { if (RSTRING_PTR(s) != p || RSTRING_LEN(s) != len){ rb_raise(rb_eRuntimeError, "string modified"); } } static size_t str_capacity(VALUE str, const int termlen) { if (STR_EMBED_P(str)) { return (RSTRING_EMBED_LEN_MAX + 1 - termlen); } else if (FL_TEST(str, STR_SHARED|STR_NOFREE)) { return RSTRING(str)->as.heap.len; } else { return RSTRING(str)->as.heap.aux.capa; } } size_t rb_str_capacity(VALUE str) { return str_capacity(str, TERM_LEN(str)); } static inline void must_not_null(const char *ptr) { if (!ptr) { rb_raise(rb_eArgError, "NULL pointer given"); } } static inline VALUE str_alloc(VALUE klass) { NEWOBJ_OF(str, struct RString, klass, T_STRING | (RGENGC_WB_PROTECTED_STRING ? FL_WB_PROTECTED : 0)); return (VALUE)str; } static inline VALUE empty_str_alloc(VALUE klass) { RUBY_DTRACE_CREATE_HOOK(STRING, 0); return str_alloc(klass); } static VALUE str_new0(VALUE klass, const char *ptr, long len, int termlen) { VALUE str; if (len < 0) { rb_raise(rb_eArgError, "negative string size (or size too big)"); } RUBY_DTRACE_CREATE_HOOK(STRING, len); str = str_alloc(klass); if (!STR_EMBEDDABLE_P(len, termlen)) { RSTRING(str)->as.heap.aux.capa = len; RSTRING(str)->as.heap.ptr = ALLOC_N(char, (size_t)len + termlen); STR_SET_NOEMBED(str); } else if (len == 0) { ENC_CODERANGE_SET(str, ENC_CODERANGE_7BIT); } if (ptr) { memcpy(RSTRING_PTR(str), ptr, len); } STR_SET_LEN(str, len); TERM_FILL(RSTRING_PTR(str) + len, termlen); return str; } static VALUE str_new(VALUE klass, const char *ptr, long len) { return str_new0(klass, ptr, len, 1); } VALUE rb_str_new(const char *ptr, long len) { return str_new(rb_cString, ptr, len); } VALUE rb_usascii_str_new(const char *ptr, long len) { VALUE str = rb_str_new(ptr, len); ENCODING_CODERANGE_SET(str, rb_usascii_encindex(), ENC_CODERANGE_7BIT); return str; } VALUE rb_utf8_str_new(const char *ptr, long len) { VALUE str = str_new(rb_cString, ptr, len); rb_enc_associate_index(str, rb_utf8_encindex()); return str; } VALUE rb_enc_str_new(const char *ptr, long len, rb_encoding *enc) { VALUE str; if (!enc) return rb_str_new(ptr, len); str = str_new0(rb_cString, ptr, len, rb_enc_mbminlen(enc)); rb_enc_associate(str, enc); return str; } VALUE rb_str_new_cstr(const char *ptr) { must_not_null(ptr); /* rb_str_new_cstr() can take pointer from non-malloc-generated * memory regions, and that cannot be detected by the MSAN. Just * trust the programmer that the argument passed here is a sane C * string. */ __msan_unpoison_string(ptr); return rb_str_new(ptr, strlen(ptr)); } VALUE rb_usascii_str_new_cstr(const char *ptr) { VALUE str = rb_str_new_cstr(ptr); ENCODING_CODERANGE_SET(str, rb_usascii_encindex(), ENC_CODERANGE_7BIT); return str; } VALUE rb_utf8_str_new_cstr(const char *ptr) { VALUE str = rb_str_new_cstr(ptr); rb_enc_associate_index(str, rb_utf8_encindex()); return str; } VALUE rb_enc_str_new_cstr(const char *ptr, rb_encoding *enc) { must_not_null(ptr); if (rb_enc_mbminlen(enc) != 1) { rb_raise(rb_eArgError, "wchar encoding given"); } return rb_enc_str_new(ptr, strlen(ptr), enc); } static VALUE str_new_static(VALUE klass, const char *ptr, long len, int encindex) { VALUE str; if (len < 0) { rb_raise(rb_eArgError, "negative string size (or size too big)"); } if (!ptr) { rb_encoding *enc = rb_enc_get_from_index(encindex); str = str_new0(klass, ptr, len, rb_enc_mbminlen(enc)); } else { RUBY_DTRACE_CREATE_HOOK(STRING, len); str = str_alloc(klass); RSTRING(str)->as.heap.len = len; RSTRING(str)->as.heap.ptr = (char *)ptr; RSTRING(str)->as.heap.aux.capa = len; STR_SET_NOEMBED(str); RBASIC(str)->flags |= STR_NOFREE; } rb_enc_associate_index(str, encindex); return str; } VALUE rb_str_new_static(const char *ptr, long len) { return str_new_static(rb_cString, ptr, len, 0); } VALUE rb_usascii_str_new_static(const char *ptr, long len) { return str_new_static(rb_cString, ptr, len, ENCINDEX_US_ASCII); } VALUE rb_utf8_str_new_static(const char *ptr, long len) { return str_new_static(rb_cString, ptr, len, ENCINDEX_UTF_8); } VALUE rb_enc_str_new_static(const char *ptr, long len, rb_encoding *enc) { return str_new_static(rb_cString, ptr, len, rb_enc_to_index(enc)); } VALUE rb_tainted_str_new(const char *ptr, long len) { VALUE str = rb_str_new(ptr, len); OBJ_TAINT(str); return str; } static VALUE rb_tainted_str_new_with_enc(const char *ptr, long len, rb_encoding *enc) { VALUE str = rb_enc_str_new(ptr, len, enc); OBJ_TAINT(str); return str; } VALUE rb_tainted_str_new_cstr(const char *ptr) { VALUE str = rb_str_new_cstr(ptr); OBJ_TAINT(str); return str; } static VALUE str_cat_conv_enc_opts(VALUE newstr, long ofs, const char *ptr, long len, rb_encoding *from, rb_encoding *to, int ecflags, VALUE ecopts); VALUE rb_str_conv_enc_opts(VALUE str, rb_encoding *from, rb_encoding *to, int ecflags, VALUE ecopts) { long len; const char *ptr; VALUE newstr; if (!to) return str; if (!from) from = rb_enc_get(str); if (from == to) return str; if ((rb_enc_asciicompat(to) && is_ascii_string(str)) || to == rb_ascii8bit_encoding()) { if (STR_ENC_GET(str) != to) { str = rb_str_dup(str); rb_enc_associate(str, to); } return str; } RSTRING_GETMEM(str, ptr, len); newstr = str_cat_conv_enc_opts(rb_str_buf_new(len), 0, ptr, len, from, to, ecflags, ecopts); if (NIL_P(newstr)) { /* some error, return original */ return str; } OBJ_INFECT(newstr, str); return newstr; } VALUE rb_str_cat_conv_enc_opts(VALUE newstr, long ofs, const char *ptr, long len, rb_encoding *from, int ecflags, VALUE ecopts) { long olen; olen = RSTRING_LEN(newstr); if (ofs < -olen || olen < ofs) rb_raise(rb_eIndexError, "index %ld out of string", ofs); if (ofs < 0) ofs += olen; if (!from) { STR_SET_LEN(newstr, ofs); return rb_str_cat(newstr, ptr, len); } rb_str_modify(newstr); return str_cat_conv_enc_opts(newstr, ofs, ptr, len, from, rb_enc_get(newstr), ecflags, ecopts); } VALUE rb_str_initialize(VALUE str, const char *ptr, long len, rb_encoding *enc) { STR_SET_LEN(str, 0); rb_enc_associate(str, enc); rb_str_cat(str, ptr, len); return str; } static VALUE str_cat_conv_enc_opts(VALUE newstr, long ofs, const char *ptr, long len, rb_encoding *from, rb_encoding *to, int ecflags, VALUE ecopts) { rb_econv_t *ec; rb_econv_result_t ret; long olen; VALUE econv_wrapper; const unsigned char *start, *sp; unsigned char *dest, *dp; size_t converted_output = (size_t)ofs; olen = rb_str_capacity(newstr); econv_wrapper = rb_obj_alloc(rb_cEncodingConverter); RBASIC_CLEAR_CLASS(econv_wrapper); ec = rb_econv_open_opts(from->name, to->name, ecflags, ecopts); if (!ec) return Qnil; DATA_PTR(econv_wrapper) = ec; sp = (unsigned char*)ptr; start = sp; while ((dest = (unsigned char*)RSTRING_PTR(newstr)), (dp = dest + converted_output), (ret = rb_econv_convert(ec, &sp, start + len, &dp, dest + olen, 0)), ret == econv_destination_buffer_full) { /* destination buffer short */ size_t converted_input = sp - start; size_t rest = len - converted_input; converted_output = dp - dest; rb_str_set_len(newstr, converted_output); if (converted_input && converted_output && rest < (LONG_MAX / converted_output)) { rest = (rest * converted_output) / converted_input; } else { rest = olen; } olen += rest < 2 ? 2 : rest; rb_str_resize(newstr, olen); } DATA_PTR(econv_wrapper) = 0; rb_econv_close(ec); rb_gc_force_recycle(econv_wrapper); switch (ret) { case econv_finished: len = dp - (unsigned char*)RSTRING_PTR(newstr); rb_str_set_len(newstr, len); rb_enc_associate(newstr, to); return newstr; default: return Qnil; } } VALUE rb_str_conv_enc(VALUE str, rb_encoding *from, rb_encoding *to) { return rb_str_conv_enc_opts(str, from, to, 0, Qnil); } VALUE rb_external_str_new_with_enc(const char *ptr, long len, rb_encoding *eenc) { rb_encoding *ienc; VALUE str; const int eidx = rb_enc_to_index(eenc); if (!ptr) { return rb_tainted_str_new_with_enc(ptr, len, eenc); } /* ASCII-8BIT case, no conversion */ if ((eidx == rb_ascii8bit_encindex()) || (eidx == rb_usascii_encindex() && search_nonascii(ptr, ptr + len))) { return rb_tainted_str_new(ptr, len); } /* no default_internal or same encoding, no conversion */ ienc = rb_default_internal_encoding(); if (!ienc || eenc == ienc) { return rb_tainted_str_new_with_enc(ptr, len, eenc); } /* ASCII compatible, and ASCII only string, no conversion in * default_internal */ if ((eidx == rb_ascii8bit_encindex()) || (eidx == rb_usascii_encindex()) || (rb_enc_asciicompat(eenc) && !search_nonascii(ptr, ptr + len))) { return rb_tainted_str_new_with_enc(ptr, len, ienc); } /* convert from the given encoding to default_internal */ str = rb_tainted_str_new_with_enc(NULL, 0, ienc); /* when the conversion failed for some reason, just ignore the * default_internal and result in the given encoding as-is. */ if (NIL_P(rb_str_cat_conv_enc_opts(str, 0, ptr, len, eenc, 0, Qnil))) { rb_str_initialize(str, ptr, len, eenc); } return str; } VALUE rb_external_str_with_enc(VALUE str, rb_encoding *eenc) { int eidx = rb_enc_to_index(eenc); if (eidx == rb_usascii_encindex() && rb_enc_str_coderange(str) != ENC_CODERANGE_7BIT) { rb_enc_associate_index(str, rb_ascii8bit_encindex()); return str; } rb_enc_associate_index(str, eidx); return rb_str_conv_enc(str, eenc, rb_default_internal_encoding()); } VALUE rb_external_str_new(const char *ptr, long len) { return rb_external_str_new_with_enc(ptr, len, rb_default_external_encoding()); } VALUE rb_external_str_new_cstr(const char *ptr) { return rb_external_str_new_with_enc(ptr, strlen(ptr), rb_default_external_encoding()); } VALUE rb_locale_str_new(const char *ptr, long len) { return rb_external_str_new_with_enc(ptr, len, rb_locale_encoding()); } VALUE rb_locale_str_new_cstr(const char *ptr) { return rb_external_str_new_with_enc(ptr, strlen(ptr), rb_locale_encoding()); } VALUE rb_filesystem_str_new(const char *ptr, long len) { return rb_external_str_new_with_enc(ptr, len, rb_filesystem_encoding()); } VALUE rb_filesystem_str_new_cstr(const char *ptr) { return rb_external_str_new_with_enc(ptr, strlen(ptr), rb_filesystem_encoding()); } VALUE rb_str_export(VALUE str) { return rb_str_conv_enc(str, STR_ENC_GET(str), rb_default_external_encoding()); } VALUE rb_str_export_locale(VALUE str) { return rb_str_conv_enc(str, STR_ENC_GET(str), rb_locale_encoding()); } VALUE rb_str_export_to_enc(VALUE str, rb_encoding *enc) { return rb_str_conv_enc(str, STR_ENC_GET(str), enc); } static VALUE str_replace_shared_without_enc(VALUE str2, VALUE str) { const int termlen = TERM_LEN(str); char *ptr; long len; RSTRING_GETMEM(str, ptr, len); if (STR_EMBEDDABLE_P(len, termlen)) { char *ptr2 = RSTRING(str2)->as.ary; STR_SET_EMBED(str2); memcpy(ptr2, RSTRING_PTR(str), len); STR_SET_EMBED_LEN(str2, len); TERM_FILL(ptr2+len, termlen); } else { VALUE root; if (STR_SHARED_P(str)) { root = RSTRING(str)->as.heap.aux.shared; RSTRING_GETMEM(str, ptr, len); } else { root = rb_str_new_frozen(str); RSTRING_GETMEM(root, ptr, len); } if (!STR_EMBED_P(str2) && !FL_TEST_RAW(str2, STR_SHARED|STR_NOFREE)) { if (FL_TEST_RAW(str2, STR_SHARED_ROOT)) { rb_fatal("about to free a possible shared root"); } char *ptr2 = STR_HEAP_PTR(str2); if (ptr2 != ptr) { ruby_sized_xfree(ptr2, STR_HEAP_SIZE(str2)); } } FL_SET(str2, STR_NOEMBED); RSTRING(str2)->as.heap.len = len; RSTRING(str2)->as.heap.ptr = ptr; STR_SET_SHARED(str2, root); } return str2; } static VALUE str_replace_shared(VALUE str2, VALUE str) { str_replace_shared_without_enc(str2, str); rb_enc_cr_str_exact_copy(str2, str); return str2; } static VALUE str_new_shared(VALUE klass, VALUE str) { return str_replace_shared(str_alloc(klass), str); } VALUE rb_str_new_shared(VALUE str) { VALUE str2 = str_new_shared(rb_obj_class(str), str); OBJ_INFECT(str2, str); return str2; } VALUE rb_str_new_frozen(VALUE orig) { VALUE str; if (OBJ_FROZEN(orig)) return orig; str = str_new_frozen(rb_obj_class(orig), orig); OBJ_INFECT(str, orig); return str; } VALUE rb_str_tmp_frozen_acquire(VALUE orig) { VALUE tmp; if (OBJ_FROZEN_RAW(orig)) return orig; tmp = str_new_frozen(0, orig); OBJ_INFECT(tmp, orig); return tmp; } void rb_str_tmp_frozen_release(VALUE orig, VALUE tmp) { if (RBASIC_CLASS(tmp) != 0) return; if (STR_EMBED_P(tmp)) { assert(OBJ_FROZEN_RAW(tmp)); rb_gc_force_recycle(tmp); } else if (FL_TEST_RAW(orig, STR_SHARED) && !FL_TEST_RAW(orig, STR_TMPLOCK|RUBY_FL_FREEZE)) { VALUE shared = RSTRING(orig)->as.heap.aux.shared; if (shared == tmp && !FL_TEST_RAW(tmp, STR_BORROWED)) { FL_UNSET_RAW(orig, STR_SHARED); assert(RSTRING(orig)->as.heap.ptr == RSTRING(tmp)->as.heap.ptr); assert(RSTRING(orig)->as.heap.len == RSTRING(tmp)->as.heap.len); RSTRING(orig)->as.heap.aux.capa = RSTRING(tmp)->as.heap.aux.capa; RBASIC(orig)->flags |= RBASIC(tmp)->flags & STR_NOFREE; assert(OBJ_FROZEN_RAW(tmp)); rb_gc_force_recycle(tmp); } } } static VALUE str_new_frozen(VALUE klass, VALUE orig) { VALUE str; if (STR_EMBED_P(orig)) { str = str_new(klass, RSTRING_PTR(orig), RSTRING_LEN(orig)); } else { if (FL_TEST_RAW(orig, STR_SHARED)) { VALUE shared = RSTRING(orig)->as.heap.aux.shared; long ofs = RSTRING(orig)->as.heap.ptr - RSTRING(shared)->as.heap.ptr; long rest = RSTRING(shared)->as.heap.len - ofs - RSTRING(orig)->as.heap.len; assert(!STR_EMBED_P(shared)); assert(OBJ_FROZEN(shared)); if ((ofs > 0) || (rest > 0) || (klass != RBASIC(shared)->klass) || ((RBASIC(shared)->flags ^ RBASIC(orig)->flags) & FL_TAINT) || ENCODING_GET(shared) != ENCODING_GET(orig)) { str = str_new_shared(klass, shared); RSTRING(str)->as.heap.ptr += ofs; RSTRING(str)->as.heap.len -= ofs + rest; } else { if (RBASIC_CLASS(shared) == 0) FL_SET_RAW(shared, STR_BORROWED); return shared; } } else if (STR_EMBEDDABLE_P(RSTRING_LEN(orig), TERM_LEN(orig))) { str = str_alloc(klass); STR_SET_EMBED(str); memcpy(RSTRING_PTR(str), RSTRING_PTR(orig), RSTRING_LEN(orig)); STR_SET_EMBED_LEN(str, RSTRING_LEN(orig)); TERM_FILL(RSTRING_END(str), TERM_LEN(orig)); } else { str = str_alloc(klass); STR_SET_NOEMBED(str); RSTRING(str)->as.heap.len = RSTRING_LEN(orig); RSTRING(str)->as.heap.ptr = RSTRING_PTR(orig); RSTRING(str)->as.heap.aux.capa = RSTRING(orig)->as.heap.aux.capa; RBASIC(str)->flags |= RBASIC(orig)->flags & STR_NOFREE; RBASIC(orig)->flags &= ~STR_NOFREE; STR_SET_SHARED(orig, str); if (klass == 0) FL_UNSET_RAW(str, STR_BORROWED); } } rb_enc_cr_str_exact_copy(str, orig); OBJ_FREEZE(str); return str; } VALUE rb_str_new_with_class(VALUE obj, const char *ptr, long len) { return str_new0(rb_obj_class(obj), ptr, len, TERM_LEN(obj)); } static VALUE str_new_empty(VALUE str) { VALUE v = rb_str_new_with_class(str, 0, 0); rb_enc_copy(v, str); OBJ_INFECT(v, str); return v; } #define STR_BUF_MIN_SIZE 63 STATIC_ASSERT(STR_BUF_MIN_SIZE, STR_BUF_MIN_SIZE > RSTRING_EMBED_LEN_MAX); VALUE rb_str_buf_new(long capa) { VALUE str = str_alloc(rb_cString); if (capa < STR_BUF_MIN_SIZE) { capa = STR_BUF_MIN_SIZE; } FL_SET(str, STR_NOEMBED); RSTRING(str)->as.heap.aux.capa = capa; RSTRING(str)->as.heap.ptr = ALLOC_N(char, (size_t)capa + 1); RSTRING(str)->as.heap.ptr[0] = '\0'; return str; } VALUE rb_str_buf_new_cstr(const char *ptr) { VALUE str; long len = strlen(ptr); str = rb_str_buf_new(len); rb_str_buf_cat(str, ptr, len); return str; } VALUE rb_str_tmp_new(long len) { return str_new(0, 0, len); } void rb_str_free(VALUE str) { if (FL_TEST(str, RSTRING_FSTR)) { st_data_t fstr = (st_data_t)str; st_delete(rb_vm_fstring_table(), &fstr, NULL); RB_DEBUG_COUNTER_INC(obj_str_fstr); } if (STR_EMBED_P(str)) { RB_DEBUG_COUNTER_INC(obj_str_embed); } else if (FL_TEST(str, STR_SHARED | STR_NOFREE)) { (void)RB_DEBUG_COUNTER_INC_IF(obj_str_shared, FL_TEST(str, STR_SHARED)); (void)RB_DEBUG_COUNTER_INC_IF(obj_str_shared, FL_TEST(str, STR_NOFREE)); } else { RB_DEBUG_COUNTER_INC(obj_str_ptr); ruby_sized_xfree(STR_HEAP_PTR(str), STR_HEAP_SIZE(str)); } } RUBY_FUNC_EXPORTED size_t rb_str_memsize(VALUE str) { if (FL_TEST(str, STR_NOEMBED|STR_SHARED|STR_NOFREE) == STR_NOEMBED) { return STR_HEAP_SIZE(str); } else { return 0; } } VALUE rb_str_to_str(VALUE str) { return rb_convert_type_with_id(str, T_STRING, "String", idTo_str); } static inline void str_discard(VALUE str); static void str_shared_replace(VALUE str, VALUE str2); void rb_str_shared_replace(VALUE str, VALUE str2) { if (str != str2) str_shared_replace(str, str2); } static void str_shared_replace(VALUE str, VALUE str2) { rb_encoding *enc; int cr; int termlen; RUBY_ASSERT(str2 != str); enc = STR_ENC_GET(str2); cr = ENC_CODERANGE(str2); str_discard(str); OBJ_INFECT(str, str2); termlen = rb_enc_mbminlen(enc); if (STR_EMBEDDABLE_P(RSTRING_LEN(str2), termlen)) { STR_SET_EMBED(str); memcpy(RSTRING_PTR(str), RSTRING_PTR(str2), (size_t)RSTRING_LEN(str2) + termlen); STR_SET_EMBED_LEN(str, RSTRING_LEN(str2)); rb_enc_associate(str, enc); ENC_CODERANGE_SET(str, cr); } else { STR_SET_NOEMBED(str); FL_UNSET(str, STR_SHARED); RSTRING(str)->as.heap.ptr = RSTRING_PTR(str2); RSTRING(str)->as.heap.len = RSTRING_LEN(str2); if (FL_TEST(str2, STR_SHARED)) { VALUE shared = RSTRING(str2)->as.heap.aux.shared; STR_SET_SHARED(str, shared); } else { RSTRING(str)->as.heap.aux.capa = RSTRING(str2)->as.heap.aux.capa; } /* abandon str2 */ STR_SET_EMBED(str2); RSTRING_PTR(str2)[0] = 0; STR_SET_EMBED_LEN(str2, 0); rb_enc_associate(str, enc); ENC_CODERANGE_SET(str, cr); } } VALUE rb_obj_as_string(VALUE obj) { VALUE str; if (RB_TYPE_P(obj, T_STRING)) { return obj; } str = rb_funcall(obj, idTo_s, 0); return rb_obj_as_string_result(str, obj); } MJIT_FUNC_EXPORTED VALUE rb_obj_as_string_result(VALUE str, VALUE obj) { if (!RB_TYPE_P(str, T_STRING)) return rb_any_to_s(obj); if (!FL_TEST_RAW(str, RSTRING_FSTR) && FL_ABLE(obj)) /* fstring must not be tainted, at least */ OBJ_INFECT_RAW(str, obj); return str; } static VALUE str_replace(VALUE str, VALUE str2) { long len; len = RSTRING_LEN(str2); if (STR_SHARED_P(str2)) { VALUE shared = RSTRING(str2)->as.heap.aux.shared; assert(OBJ_FROZEN(shared)); STR_SET_NOEMBED(str); RSTRING(str)->as.heap.len = len; RSTRING(str)->as.heap.ptr = RSTRING_PTR(str2); STR_SET_SHARED(str, shared); rb_enc_cr_str_exact_copy(str, str2); } else { str_replace_shared(str, str2); } OBJ_INFECT(str, str2); return str; } static inline VALUE str_duplicate(VALUE klass, VALUE str) { enum {embed_size = RSTRING_EMBED_LEN_MAX + 1}; const VALUE flag_mask = RSTRING_NOEMBED | RSTRING_EMBED_LEN_MASK | ENC_CODERANGE_MASK | ENCODING_MASK | FL_TAINT | FL_FREEZE ; VALUE flags = FL_TEST_RAW(str, flag_mask); VALUE dup = str_alloc(klass); MEMCPY(RSTRING(dup)->as.ary, RSTRING(str)->as.ary, char, embed_size); if (flags & STR_NOEMBED) { if (FL_TEST_RAW(str, STR_SHARED)) { str = RSTRING(str)->as.heap.aux.shared; } else if (UNLIKELY(!(flags & FL_FREEZE))) { str = str_new_frozen(klass, str); FL_SET_RAW(str, flags & FL_TAINT); flags = FL_TEST_RAW(str, flag_mask); } if (flags & STR_NOEMBED) { RB_OBJ_WRITE(dup, &RSTRING(dup)->as.heap.aux.shared, str); flags |= STR_SHARED; } else { MEMCPY(RSTRING(dup)->as.ary, RSTRING(str)->as.ary, char, embed_size); } } FL_SET_RAW(dup, flags & ~FL_FREEZE); return dup; } VALUE rb_str_dup(VALUE str) { return str_duplicate(rb_obj_class(str), str); } VALUE rb_str_resurrect(VALUE str) { RUBY_DTRACE_CREATE_HOOK(STRING, RSTRING_LEN(str)); return str_duplicate(rb_cString, str); } /* * call-seq: * String.new(str="") -> new_str * String.new(str="", encoding: enc) -> new_str * String.new(str="", capacity: size) -> new_str * * Returns a new string object containing a copy of str. * * The optional encoding keyword argument specifies the encoding * of the new string. * If not specified, the encoding of str is used * (or ASCII-8BIT, if str is not specified). * * The optional capacity keyword argument specifies the size * of the internal buffer. * This may improve performance, when the string will be concatenated many * times (causing many realloc calls). */ static VALUE rb_str_init(int argc, VALUE *argv, VALUE str) { static ID keyword_ids[2]; VALUE orig, opt, venc, vcapa; VALUE kwargs[2]; rb_encoding *enc = 0; int n; if (!keyword_ids[0]) { keyword_ids[0] = rb_id_encoding(); CONST_ID(keyword_ids[1], "capacity"); } n = rb_scan_args(argc, argv, "01:", &orig, &opt); if (!NIL_P(opt)) { rb_get_kwargs(opt, keyword_ids, 0, 2, kwargs); venc = kwargs[0]; vcapa = kwargs[1]; if (venc != Qundef && !NIL_P(venc)) { enc = rb_to_encoding(venc); } if (vcapa != Qundef && !NIL_P(vcapa)) { long capa = NUM2LONG(vcapa); long len = 0; int termlen = enc ? rb_enc_mbminlen(enc) : 1; if (capa < STR_BUF_MIN_SIZE) { capa = STR_BUF_MIN_SIZE; } if (n == 1) { StringValue(orig); len = RSTRING_LEN(orig); if (capa < len) { capa = len; } if (orig == str) n = 0; } str_modifiable(str); if (STR_EMBED_P(str)) { /* make noembed always */ char *new_ptr = ALLOC_N(char, (size_t)capa + termlen); memcpy(new_ptr, RSTRING(str)->as.ary, RSTRING_EMBED_LEN_MAX + 1); RSTRING(str)->as.heap.ptr = new_ptr; } else if (FL_TEST(str, STR_SHARED|STR_NOFREE)) { const size_t size = (size_t)capa + termlen; const char *const old_ptr = RSTRING_PTR(str); const size_t osize = RSTRING(str)->as.heap.len + TERM_LEN(str); char *new_ptr = ALLOC_N(char, (size_t)capa + termlen); memcpy(new_ptr, old_ptr, osize < size ? osize : size); FL_UNSET_RAW(str, STR_SHARED); RSTRING(str)->as.heap.ptr = new_ptr; } else if (STR_HEAP_SIZE(str) != (size_t)capa + termlen) { SIZED_REALLOC_N(RSTRING(str)->as.heap.ptr, char, (size_t)capa + termlen, STR_HEAP_SIZE(str)); } RSTRING(str)->as.heap.len = len; TERM_FILL(&RSTRING(str)->as.heap.ptr[len], termlen); if (n == 1) { memcpy(RSTRING(str)->as.heap.ptr, RSTRING_PTR(orig), len); rb_enc_cr_str_exact_copy(str, orig); } FL_SET(str, STR_NOEMBED); RSTRING(str)->as.heap.aux.capa = capa; } else if (n == 1) { rb_str_replace(str, orig); } if (enc) { rb_enc_associate(str, enc); ENC_CODERANGE_CLEAR(str); } } else if (n == 1) { rb_str_replace(str, orig); } return str; } #ifdef NONASCII_MASK #define is_utf8_lead_byte(c) (((c)&0xC0) != 0x80) /* * UTF-8 leading bytes have either 0xxxxxxx or 11xxxxxx * bit representation. (see http://en.wikipedia.org/wiki/UTF-8) * Therefore, the following pseudocode can detect UTF-8 leading bytes. * * if (!(byte & 0x80)) * byte |= 0x40; // turn on bit6 * return ((byte>>6) & 1); // bit6 represent whether this byte is leading or not. * * This function calculates whether a byte is leading or not for all bytes * in the argument word by concurrently using the above logic, and then * adds up the number of leading bytes in the word. */ static inline uintptr_t count_utf8_lead_bytes_with_word(const uintptr_t *s) { uintptr_t d = *s; /* Transform so that bit0 indicates whether we have a UTF-8 leading byte or not. */ d = (d>>6) | (~d>>7); d &= NONASCII_MASK >> 7; /* Gather all bytes. */ #if defined(HAVE_BUILTIN___BUILTIN_POPCOUNT) && defined(__POPCNT__) /* use only if it can use POPCNT */ return rb_popcount_intptr(d); #else d += (d>>8); d += (d>>16); # if SIZEOF_VOIDP == 8 d += (d>>32); # endif return (d&0xF); #endif } #endif static inline long enc_strlen(const char *p, const char *e, rb_encoding *enc, int cr) { long c; const char *q; if (rb_enc_mbmaxlen(enc) == rb_enc_mbminlen(enc)) { long diff = (long)(e - p); return diff / rb_enc_mbminlen(enc) + !!(diff % rb_enc_mbminlen(enc)); } #ifdef NONASCII_MASK else if (cr == ENC_CODERANGE_VALID && enc == rb_utf8_encoding()) { uintptr_t len = 0; if ((int)sizeof(uintptr_t) * 2 < e - p) { const uintptr_t *s, *t; const uintptr_t lowbits = sizeof(uintptr_t) - 1; s = (const uintptr_t*)(~lowbits & ((uintptr_t)p + lowbits)); t = (const uintptr_t*)(~lowbits & (uintptr_t)e); while (p < (const char *)s) { if (is_utf8_lead_byte(*p)) len++; p++; } while (s < t) { len += count_utf8_lead_bytes_with_word(s); s++; } p = (const char *)s; } while (p < e) { if (is_utf8_lead_byte(*p)) len++; p++; } return (long)len; } #endif else if (rb_enc_asciicompat(enc)) { c = 0; if (ENC_CODERANGE_CLEAN_P(cr)) { while (p < e) { if (ISASCII(*p)) { q = search_nonascii(p, e); if (!q) return c + (e - p); c += q - p; p = q; } p += rb_enc_fast_mbclen(p, e, enc); c++; } } else { while (p < e) { if (ISASCII(*p)) { q = search_nonascii(p, e); if (!q) return c + (e - p); c += q - p; p = q; } p += rb_enc_mbclen(p, e, enc); c++; } } return c; } for (c=0; p integer * str.size -> integer * * Returns the character length of str. */ VALUE rb_str_length(VALUE str) { return LONG2NUM(str_strlen(str, NULL)); } /* * call-seq: * str.bytesize -> integer * * Returns the length of +str+ in bytes. * * "\x80\u3042".bytesize #=> 4 * "hello".bytesize #=> 5 */ static VALUE rb_str_bytesize(VALUE str) { return LONG2NUM(RSTRING_LEN(str)); } /* * call-seq: * str.empty? -> true or false * * Returns true if str has a length of zero. * * "hello".empty? #=> false * " ".empty? #=> false * "".empty? #=> true */ static VALUE rb_str_empty(VALUE str) { if (RSTRING_LEN(str) == 0) return Qtrue; return Qfalse; } /* * call-seq: * str + other_str -> new_str * * Concatenation---Returns a new String containing * other_str concatenated to str. * * "Hello from " + self.to_s #=> "Hello from main" */ VALUE rb_str_plus(VALUE str1, VALUE str2) { VALUE str3; rb_encoding *enc; char *ptr1, *ptr2, *ptr3; long len1, len2; int termlen; StringValue(str2); enc = rb_enc_check_str(str1, str2); RSTRING_GETMEM(str1, ptr1, len1); RSTRING_GETMEM(str2, ptr2, len2); termlen = rb_enc_mbminlen(enc); if (len1 > LONG_MAX - len2) { rb_raise(rb_eArgError, "string size too big"); } str3 = str_new0(rb_cString, 0, len1+len2, termlen); ptr3 = RSTRING_PTR(str3); memcpy(ptr3, ptr1, len1); memcpy(ptr3+len1, ptr2, len2); TERM_FILL(&ptr3[len1+len2], termlen); FL_SET_RAW(str3, OBJ_TAINTED_RAW(str1) | OBJ_TAINTED_RAW(str2)); ENCODING_CODERANGE_SET(str3, rb_enc_to_index(enc), ENC_CODERANGE_AND(ENC_CODERANGE(str1), ENC_CODERANGE(str2))); RB_GC_GUARD(str1); RB_GC_GUARD(str2); return str3; } /* A variant of rb_str_plus that does not raise but return Qundef instead. */ MJIT_FUNC_EXPORTED VALUE rb_str_opt_plus(VALUE str1, VALUE str2) { assert(RBASIC_CLASS(str1) == rb_cString); assert(RBASIC_CLASS(str2) == rb_cString); long len1, len2; MAYBE_UNUSED(char) *ptr1, *ptr2; RSTRING_GETMEM(str1, ptr1, len1); RSTRING_GETMEM(str2, ptr2, len2); int enc1 = rb_enc_get_index(str1); int enc2 = rb_enc_get_index(str2); if (enc1 < 0) { return Qundef; } else if (enc2 < 0) { return Qundef; } else if (enc1 != enc2) { return Qundef; } else if (len1 > LONG_MAX - len2) { return Qundef; } else { return rb_str_plus(str1, str2); } } /* * call-seq: * str * integer -> new_str * * Copy --- Returns a new String containing +integer+ copies of the receiver. * +integer+ must be greater than or equal to 0. * * "Ho! " * 3 #=> "Ho! Ho! Ho! " * "Ho! " * 0 #=> "" */ VALUE rb_str_times(VALUE str, VALUE times) { VALUE str2; long n, len; char *ptr2; int termlen; if (times == INT2FIX(1)) { return rb_str_dup(str); } if (times == INT2FIX(0)) { str2 = str_alloc(rb_obj_class(str)); rb_enc_copy(str2, str); OBJ_INFECT(str2, str); return str2; } len = NUM2LONG(times); if (len < 0) { rb_raise(rb_eArgError, "negative argument"); } if (RSTRING_LEN(str) == 1 && RSTRING_PTR(str)[0] == 0) { str2 = str_alloc(rb_obj_class(str)); if (!STR_EMBEDDABLE_P(len, 1)) { RSTRING(str2)->as.heap.aux.capa = len; RSTRING(str2)->as.heap.ptr = ZALLOC_N(char, (size_t)len + 1); STR_SET_NOEMBED(str2); } STR_SET_LEN(str2, len); rb_enc_copy(str2, str); OBJ_INFECT(str2, str); return str2; } if (len && LONG_MAX/len < RSTRING_LEN(str)) { rb_raise(rb_eArgError, "argument too big"); } len *= RSTRING_LEN(str); termlen = TERM_LEN(str); str2 = str_new0(rb_obj_class(str), 0, len, termlen); ptr2 = RSTRING_PTR(str2); if (len) { n = RSTRING_LEN(str); memcpy(ptr2, RSTRING_PTR(str), n); while (n <= len/2) { memcpy(ptr2 + n, ptr2, n); n *= 2; } memcpy(ptr2 + n, ptr2, len-n); } STR_SET_LEN(str2, len); TERM_FILL(&ptr2[len], termlen); OBJ_INFECT(str2, str); rb_enc_cr_str_copy_for_substr(str2, str); return str2; } /* * call-seq: * str % arg -> new_str * * Format---Uses str as a format specification, and returns * the result of applying it to arg. If the format * specification contains more than one substitution, then arg * must be an Array or Hash containing the values to be * substituted. See Kernel#sprintf for details of the format string. * * "%05d" % 123 #=> "00123" * "%-5s: %016x" % [ "ID", self.object_id ] #=> "ID : 00002b054ec93168" * "foo = %{foo}" % { :foo => 'bar' } #=> "foo = bar" */ static VALUE rb_str_format_m(VALUE str, VALUE arg) { VALUE tmp = rb_check_array_type(arg); if (!NIL_P(tmp)) { return rb_str_format(RARRAY_LENINT(tmp), RARRAY_CONST_PTR(tmp), str); } return rb_str_format(1, &arg, str); } static inline void rb_check_lockedtmp(VALUE str) { if (FL_TEST(str, STR_TMPLOCK)) { rb_raise(rb_eRuntimeError, "can't modify string; temporarily locked"); } } static inline void str_modifiable(VALUE str) { rb_check_lockedtmp(str); rb_check_frozen(str); } static inline int str_dependent_p(VALUE str) { if (STR_EMBED_P(str) || !FL_TEST(str, STR_SHARED|STR_NOFREE)) { return 0; } else { return 1; } } static inline int str_independent(VALUE str) { str_modifiable(str); return !str_dependent_p(str); } static void str_make_independent_expand(VALUE str, long len, long expand, const int termlen) { char *ptr; char *oldptr; long capa = len + expand; if (len > capa) len = capa; if (!STR_EMBED_P(str) && STR_EMBEDDABLE_P(capa, termlen)) { ptr = RSTRING(str)->as.heap.ptr; STR_SET_EMBED(str); memcpy(RSTRING(str)->as.ary, ptr, len); TERM_FILL(RSTRING(str)->as.ary + len, termlen); STR_SET_EMBED_LEN(str, len); return; } ptr = ALLOC_N(char, (size_t)capa + termlen); oldptr = RSTRING_PTR(str); if (oldptr) { memcpy(ptr, oldptr, len); } if (FL_TEST_RAW(str, STR_NOEMBED|STR_NOFREE|STR_SHARED) == STR_NOEMBED) { xfree(oldptr); } STR_SET_NOEMBED(str); FL_UNSET(str, STR_SHARED|STR_NOFREE); TERM_FILL(ptr + len, termlen); RSTRING(str)->as.heap.ptr = ptr; RSTRING(str)->as.heap.len = len; RSTRING(str)->as.heap.aux.capa = capa; } void rb_str_modify(VALUE str) { if (!str_independent(str)) str_make_independent(str); ENC_CODERANGE_CLEAR(str); } void rb_str_modify_expand(VALUE str, long expand) { int termlen = TERM_LEN(str); long len = RSTRING_LEN(str); if (expand < 0) { rb_raise(rb_eArgError, "negative expanding string size"); } if (expand >= LONG_MAX - len) { rb_raise(rb_eArgError, "string size too big"); } if (!str_independent(str)) { str_make_independent_expand(str, len, expand, termlen); } else if (expand > 0) { RESIZE_CAPA_TERM(str, len + expand, termlen); } ENC_CODERANGE_CLEAR(str); } /* As rb_str_modify(), but don't clear coderange */ static void str_modify_keep_cr(VALUE str) { if (!str_independent(str)) str_make_independent(str); if (ENC_CODERANGE(str) == ENC_CODERANGE_BROKEN) /* Force re-scan later */ ENC_CODERANGE_CLEAR(str); } static inline void str_discard(VALUE str) { str_modifiable(str); if (!STR_EMBED_P(str) && !FL_TEST(str, STR_SHARED|STR_NOFREE)) { ruby_sized_xfree(STR_HEAP_PTR(str), STR_HEAP_SIZE(str)); RSTRING(str)->as.heap.ptr = 0; RSTRING(str)->as.heap.len = 0; } } void rb_must_asciicompat(VALUE str) { rb_encoding *enc = rb_enc_get(str); if (!rb_enc_asciicompat(enc)) { rb_raise(rb_eEncCompatError, "ASCII incompatible encoding: %s", rb_enc_name(enc)); } } VALUE rb_string_value(volatile VALUE *ptr) { VALUE s = *ptr; if (!RB_TYPE_P(s, T_STRING)) { s = rb_str_to_str(s); *ptr = s; } return s; } char * rb_string_value_ptr(volatile VALUE *ptr) { VALUE str = rb_string_value(ptr); return RSTRING_PTR(str); } static int zero_filled(const char *s, int n) { for (; n > 0; --n) { if (*s++) return 0; } return 1; } static const char * str_null_char(const char *s, long len, const int minlen, rb_encoding *enc) { const char *e = s + len; for (; s + minlen <= e; s += rb_enc_mbclen(s, e, enc)) { if (zero_filled(s, minlen)) return s; } return 0; } static char * str_fill_term(VALUE str, char *s, long len, int termlen) { /* This function assumes that (capa + termlen) bytes of memory * is allocated, like many other functions in this file. */ if (str_dependent_p(str)) { if (!zero_filled(s + len, termlen)) str_make_independent_expand(str, len, 0L, termlen); } else { TERM_FILL(s + len, termlen); return s; } return RSTRING_PTR(str); } void rb_str_change_terminator_length(VALUE str, const int oldtermlen, const int termlen) { long capa = str_capacity(str, oldtermlen) + oldtermlen; long len = RSTRING_LEN(str); assert(capa >= len); if (capa - len < termlen) { rb_check_lockedtmp(str); str_make_independent_expand(str, len, 0L, termlen); } else if (str_dependent_p(str)) { if (termlen > oldtermlen) str_make_independent_expand(str, len, 0L, termlen); } else { if (!STR_EMBED_P(str)) { /* modify capa instead of realloc */ assert(!FL_TEST((str), STR_SHARED)); RSTRING(str)->as.heap.aux.capa = capa - termlen; } if (termlen > oldtermlen) { TERM_FILL(RSTRING_PTR(str) + len, termlen); } } return; } static char * str_null_check(VALUE str, int *w) { char *s = RSTRING_PTR(str); long len = RSTRING_LEN(str); rb_encoding *enc = rb_enc_get(str); const int minlen = rb_enc_mbminlen(enc); if (minlen > 1) { *w = 1; if (str_null_char(s, len, minlen, enc)) { return NULL; } return str_fill_term(str, s, len, minlen); } *w = 0; if (!s || memchr(s, 0, len)) { return NULL; } if (s[len]) { s = str_fill_term(str, s, len, minlen); } return s; } char * rb_str_to_cstr(VALUE str) { int w; return str_null_check(str, &w); } char * rb_string_value_cstr(volatile VALUE *ptr) { VALUE str = rb_string_value(ptr); int w; char *s = str_null_check(str, &w); if (!s) { if (w) { rb_raise(rb_eArgError, "string contains null char"); } rb_raise(rb_eArgError, "string contains null byte"); } return s; } char * rb_str_fill_terminator(VALUE str, const int newminlen) { char *s = RSTRING_PTR(str); long len = RSTRING_LEN(str); return str_fill_term(str, s, len, newminlen); } VALUE rb_check_string_type(VALUE str) { str = rb_check_convert_type_with_id(str, T_STRING, "String", idTo_str); return str; } /* * call-seq: * String.try_convert(obj) -> string or nil * * Try to convert obj into a String, using to_str method. * Returns converted string or nil if obj cannot be converted * for any reason. * * String.try_convert("str") #=> "str" * String.try_convert(/re/) #=> nil */ static VALUE rb_str_s_try_convert(VALUE dummy, VALUE str) { return rb_check_string_type(str); } static char* str_nth_len(const char *p, const char *e, long *nthp, rb_encoding *enc) { long nth = *nthp; if (rb_enc_mbmaxlen(enc) == 1) { p += nth; } else if (rb_enc_mbmaxlen(enc) == rb_enc_mbminlen(enc)) { p += nth * rb_enc_mbmaxlen(enc); } else if (rb_enc_asciicompat(enc)) { const char *p2, *e2; int n; while (p < e && 0 < nth) { e2 = p + nth; if (e < e2) { *nthp = nth; return (char *)e; } if (ISASCII(*p)) { p2 = search_nonascii(p, e2); if (!p2) { nth -= e2 - p; *nthp = nth; return (char *)e2; } nth -= p2 - p; p = p2; } n = rb_enc_mbclen(p, e, enc); p += n; nth--; } *nthp = nth; if (nth != 0) { return (char *)e; } return (char *)p; } else { while (p < e && nth--) { p += rb_enc_mbclen(p, e, enc); } } if (p > e) p = e; *nthp = nth; return (char*)p; } char* rb_enc_nth(const char *p, const char *e, long nth, rb_encoding *enc) { return str_nth_len(p, e, &nth, enc); } static char* str_nth(const char *p, const char *e, long nth, rb_encoding *enc, int singlebyte) { if (singlebyte) p += nth; else { p = str_nth_len(p, e, &nth, enc); } if (!p) return 0; if (p > e) p = e; return (char *)p; } /* char offset to byte offset */ static long str_offset(const char *p, const char *e, long nth, rb_encoding *enc, int singlebyte) { const char *pp = str_nth(p, e, nth, enc, singlebyte); if (!pp) return e - p; return pp - p; } long rb_str_offset(VALUE str, long pos) { return str_offset(RSTRING_PTR(str), RSTRING_END(str), pos, STR_ENC_GET(str), single_byte_optimizable(str)); } #ifdef NONASCII_MASK static char * str_utf8_nth(const char *p, const char *e, long *nthp) { long nth = *nthp; if ((int)SIZEOF_VOIDP * 2 < e - p && (int)SIZEOF_VOIDP * 2 < nth) { const uintptr_t *s, *t; const uintptr_t lowbits = SIZEOF_VOIDP - 1; s = (const uintptr_t*)(~lowbits & ((uintptr_t)p + lowbits)); t = (const uintptr_t*)(~lowbits & (uintptr_t)e); while (p < (const char *)s) { if (is_utf8_lead_byte(*p)) nth--; p++; } do { nth -= count_utf8_lead_bytes_with_word(s); s++; } while (s < t && (int)SIZEOF_VOIDP <= nth); p = (char *)s; } while (p < e) { if (is_utf8_lead_byte(*p)) { if (nth == 0) break; nth--; } p++; } *nthp = nth; return (char *)p; } static long str_utf8_offset(const char *p, const char *e, long nth) { const char *pp = str_utf8_nth(p, e, &nth); return pp - p; } #endif /* byte offset to char offset */ long rb_str_sublen(VALUE str, long pos) { if (single_byte_optimizable(str) || pos < 0) return pos; else { char *p = RSTRING_PTR(str); return enc_strlen(p, p + pos, STR_ENC_GET(str), ENC_CODERANGE(str)); } } VALUE rb_str_subseq(VALUE str, long beg, long len) { VALUE str2; if (!STR_EMBEDDABLE_P(len, TERM_LEN(str)) && SHARABLE_SUBSTRING_P(beg, len, RSTRING_LEN(str))) { long olen; str2 = rb_str_new_shared(rb_str_new_frozen(str)); RSTRING(str2)->as.heap.ptr += beg; olen = RSTRING(str2)->as.heap.len; if (olen > len) RSTRING(str2)->as.heap.len = len; } else { str2 = rb_str_new_with_class(str, RSTRING_PTR(str)+beg, len); RB_GC_GUARD(str); } rb_enc_cr_str_copy_for_substr(str2, str); OBJ_INFECT(str2, str); return str2; } char * rb_str_subpos(VALUE str, long beg, long *lenp) { long len = *lenp; long slen = -1L; long blen = RSTRING_LEN(str); rb_encoding *enc = STR_ENC_GET(str); char *p, *s = RSTRING_PTR(str), *e = s + blen; if (len < 0) return 0; if (!blen) { len = 0; } if (single_byte_optimizable(str)) { if (beg > blen) return 0; if (beg < 0) { beg += blen; if (beg < 0) return 0; } if (len > blen - beg) len = blen - beg; if (len < 0) return 0; p = s + beg; goto end; } if (beg < 0) { if (len > -beg) len = -beg; if (-beg * rb_enc_mbmaxlen(enc) < RSTRING_LEN(str) / 8) { beg = -beg; while (beg-- > len && (e = rb_enc_prev_char(s, e, e, enc)) != 0); p = e; if (!p) return 0; while (len-- > 0 && (p = rb_enc_prev_char(s, p, e, enc)) != 0); if (!p) return 0; len = e - p; goto end; } else { slen = str_strlen(str, enc); beg += slen; if (beg < 0) return 0; p = s + beg; if (len == 0) goto end; } } else if (beg > 0 && beg > RSTRING_LEN(str)) { return 0; } if (len == 0) { if (beg > str_strlen(str, enc)) return 0; /* str's enc */ p = s + beg; } #ifdef NONASCII_MASK else if (ENC_CODERANGE(str) == ENC_CODERANGE_VALID && enc == rb_utf8_encoding()) { p = str_utf8_nth(s, e, &beg); if (beg > 0) return 0; len = str_utf8_offset(p, e, len); } #endif else if (rb_enc_mbmaxlen(enc) == rb_enc_mbminlen(enc)) { int char_sz = rb_enc_mbmaxlen(enc); p = s + beg * char_sz; if (p > e) { return 0; } else if (len * char_sz > e - p) len = e - p; else len *= char_sz; } else if ((p = str_nth_len(s, e, &beg, enc)) == e) { if (beg > 0) return 0; len = 0; } else { len = str_offset(p, e, len, enc, 0); } end: *lenp = len; RB_GC_GUARD(str); return p; } static VALUE str_substr(VALUE str, long beg, long len, int empty); VALUE rb_str_substr(VALUE str, long beg, long len) { return str_substr(str, beg, len, TRUE); } static VALUE str_substr(VALUE str, long beg, long len, int empty) { VALUE str2; char *p = rb_str_subpos(str, beg, &len); if (!p) return Qnil; if (!STR_EMBEDDABLE_P(len, TERM_LEN(str)) && SHARABLE_SUBSTRING_P(p, len, RSTRING_END(str))) { long ofs = p - RSTRING_PTR(str); str2 = rb_str_new_frozen(str); str2 = str_new_shared(rb_obj_class(str2), str2); RSTRING(str2)->as.heap.ptr += ofs; RSTRING(str2)->as.heap.len = len; ENC_CODERANGE_CLEAR(str2); } else { if (!len && !empty) return Qnil; str2 = rb_str_new_with_class(str, p, len); OBJ_INFECT(str2, str); RB_GC_GUARD(str); } rb_enc_cr_str_copy_for_substr(str2, str); return str2; } VALUE rb_str_freeze(VALUE str) { if (OBJ_FROZEN(str)) return str; rb_str_resize(str, RSTRING_LEN(str)); return rb_obj_freeze(str); } /* * call-seq: * +str -> str (mutable) * * If the string is frozen, then return duplicated mutable string. * * If the string is not frozen, then return the string itself. */ static VALUE str_uplus(VALUE str) { if (OBJ_FROZEN(str)) { return rb_str_dup(str); } else { return str; } } /* * call-seq: * -str -> str (frozen) * * Returns a frozen, possibly pre-existing copy of the string. * * The string will be deduplicated as long as it is not tainted, * or has any instance variables set on it. */ static VALUE str_uminus(VALUE str) { if (!BARE_STRING_P(str) && !rb_obj_frozen_p(str)) { str = rb_str_dup(str); } return rb_fstring(str); } RUBY_ALIAS_FUNCTION(rb_str_dup_frozen(VALUE str), rb_str_new_frozen, (str)) #define rb_str_dup_frozen rb_str_new_frozen VALUE rb_str_locktmp(VALUE str) { if (FL_TEST(str, STR_TMPLOCK)) { rb_raise(rb_eRuntimeError, "temporal locking already locked string"); } FL_SET(str, STR_TMPLOCK); return str; } VALUE rb_str_unlocktmp(VALUE str) { if (!FL_TEST(str, STR_TMPLOCK)) { rb_raise(rb_eRuntimeError, "temporal unlocking already unlocked string"); } FL_UNSET(str, STR_TMPLOCK); return str; } RUBY_FUNC_EXPORTED VALUE rb_str_locktmp_ensure(VALUE str, VALUE (*func)(VALUE), VALUE arg) { rb_str_locktmp(str); return rb_ensure(func, arg, rb_str_unlocktmp, str); } void rb_str_set_len(VALUE str, long len) { long capa; const int termlen = TERM_LEN(str); str_modifiable(str); if (STR_SHARED_P(str)) { rb_raise(rb_eRuntimeError, "can't set length of shared string"); } if (len > (capa = (long)str_capacity(str, termlen)) || len < 0) { rb_bug("probable buffer overflow: %ld for %ld", len, capa); } STR_SET_LEN(str, len); TERM_FILL(&RSTRING_PTR(str)[len], termlen); } VALUE rb_str_resize(VALUE str, long len) { long slen; int independent; if (len < 0) { rb_raise(rb_eArgError, "negative string size (or size too big)"); } independent = str_independent(str); ENC_CODERANGE_CLEAR(str); slen = RSTRING_LEN(str); { long capa; const int termlen = TERM_LEN(str); if (STR_EMBED_P(str)) { if (len == slen) return str; if (STR_EMBEDDABLE_P(len, termlen)) { STR_SET_EMBED_LEN(str, len); TERM_FILL(RSTRING(str)->as.ary + len, termlen); return str; } str_make_independent_expand(str, slen, len - slen, termlen); } else if (STR_EMBEDDABLE_P(len, termlen)) { char *ptr = STR_HEAP_PTR(str); STR_SET_EMBED(str); if (slen > len) slen = len; if (slen > 0) MEMCPY(RSTRING(str)->as.ary, ptr, char, slen); TERM_FILL(RSTRING(str)->as.ary + len, termlen); STR_SET_EMBED_LEN(str, len); if (independent) ruby_xfree(ptr); return str; } else if (!independent) { if (len == slen) return str; str_make_independent_expand(str, slen, len - slen, termlen); } else if ((capa = RSTRING(str)->as.heap.aux.capa) < len || (capa - len) > (len < 1024 ? len : 1024)) { SIZED_REALLOC_N(RSTRING(str)->as.heap.ptr, char, (size_t)len + termlen, STR_HEAP_SIZE(str)); RSTRING(str)->as.heap.aux.capa = len; } else if (len == slen) return str; RSTRING(str)->as.heap.len = len; TERM_FILL(RSTRING(str)->as.heap.ptr + len, termlen); /* sentinel */ } return str; } static VALUE str_buf_cat(VALUE str, const char *ptr, long len) { long capa, total, olen, off = -1; char *sptr; const int termlen = TERM_LEN(str); assert(termlen < RSTRING_EMBED_LEN_MAX + 1); /* < (LONG_MAX/2) */ RSTRING_GETMEM(str, sptr, olen); if (ptr >= sptr && ptr <= sptr + olen) { off = ptr - sptr; } rb_str_modify(str); if (len == 0) return 0; if (STR_EMBED_P(str)) { capa = RSTRING_EMBED_LEN_MAX + 1 - termlen; sptr = RSTRING(str)->as.ary; olen = RSTRING_EMBED_LEN(str); } else { capa = RSTRING(str)->as.heap.aux.capa; sptr = RSTRING(str)->as.heap.ptr; olen = RSTRING(str)->as.heap.len; } if (olen > LONG_MAX - len) { rb_raise(rb_eArgError, "string sizes too big"); } total = olen + len; if (capa < total) { if (total >= LONG_MAX / 2) { capa = total; } while (total > capa) { capa = 2 * capa + termlen; /* == 2*(capa+termlen)-termlen */ } RESIZE_CAPA_TERM(str, capa, termlen); sptr = RSTRING_PTR(str); } if (off != -1) { ptr = sptr + off; } memcpy(sptr + olen, ptr, len); STR_SET_LEN(str, total); TERM_FILL(sptr + total, termlen); /* sentinel */ return str; } #define str_buf_cat2(str, ptr) str_buf_cat((str), (ptr), strlen(ptr)) VALUE rb_str_cat(VALUE str, const char *ptr, long len) { if (len == 0) return str; if (len < 0) { rb_raise(rb_eArgError, "negative string size (or size too big)"); } return str_buf_cat(str, ptr, len); } VALUE rb_str_cat_cstr(VALUE str, const char *ptr) { must_not_null(ptr); return rb_str_buf_cat(str, ptr, strlen(ptr)); } RUBY_ALIAS_FUNCTION(rb_str_buf_cat(VALUE str, const char *ptr, long len), rb_str_cat, (str, ptr, len)) RUBY_ALIAS_FUNCTION(rb_str_buf_cat2(VALUE str, const char *ptr), rb_str_cat_cstr, (str, ptr)) RUBY_ALIAS_FUNCTION(rb_str_cat2(VALUE str, const char *ptr), rb_str_cat_cstr, (str, ptr)) static VALUE rb_enc_cr_str_buf_cat(VALUE str, const char *ptr, long len, int ptr_encindex, int ptr_cr, int *ptr_cr_ret) { int str_encindex = ENCODING_GET(str); int res_encindex; int str_cr, res_cr; rb_encoding *str_enc, *ptr_enc; str_cr = RSTRING_LEN(str) ? ENC_CODERANGE(str) : ENC_CODERANGE_7BIT; if (str_encindex == ptr_encindex) { if (str_cr != ENC_CODERANGE_UNKNOWN && ptr_cr == ENC_CODERANGE_UNKNOWN) { ptr_cr = coderange_scan(ptr, len, rb_enc_from_index(ptr_encindex)); } } else { str_enc = rb_enc_from_index(str_encindex); ptr_enc = rb_enc_from_index(ptr_encindex); if (!rb_enc_asciicompat(str_enc) || !rb_enc_asciicompat(ptr_enc)) { if (len == 0) return str; if (RSTRING_LEN(str) == 0) { rb_str_buf_cat(str, ptr, len); ENCODING_CODERANGE_SET(str, ptr_encindex, ptr_cr); return str; } goto incompatible; } if (ptr_cr == ENC_CODERANGE_UNKNOWN) { ptr_cr = coderange_scan(ptr, len, ptr_enc); } if (str_cr == ENC_CODERANGE_UNKNOWN) { if (ENCODING_IS_ASCII8BIT(str) || ptr_cr != ENC_CODERANGE_7BIT) { str_cr = rb_enc_str_coderange(str); } } } if (ptr_cr_ret) *ptr_cr_ret = ptr_cr; if (str_encindex != ptr_encindex && str_cr != ENC_CODERANGE_7BIT && ptr_cr != ENC_CODERANGE_7BIT) { str_enc = rb_enc_from_index(str_encindex); ptr_enc = rb_enc_from_index(ptr_encindex); incompatible: rb_raise(rb_eEncCompatError, "incompatible character encodings: %s and %s", rb_enc_name(str_enc), rb_enc_name(ptr_enc)); } if (str_cr == ENC_CODERANGE_UNKNOWN) { res_encindex = str_encindex; res_cr = ENC_CODERANGE_UNKNOWN; } else if (str_cr == ENC_CODERANGE_7BIT) { if (ptr_cr == ENC_CODERANGE_7BIT) { res_encindex = str_encindex; res_cr = ENC_CODERANGE_7BIT; } else { res_encindex = ptr_encindex; res_cr = ptr_cr; } } else if (str_cr == ENC_CODERANGE_VALID) { res_encindex = str_encindex; if (ENC_CODERANGE_CLEAN_P(ptr_cr)) res_cr = str_cr; else res_cr = ptr_cr; } else { /* str_cr == ENC_CODERANGE_BROKEN */ res_encindex = str_encindex; res_cr = str_cr; if (0 < len) res_cr = ENC_CODERANGE_UNKNOWN; } if (len < 0) { rb_raise(rb_eArgError, "negative string size (or size too big)"); } str_buf_cat(str, ptr, len); ENCODING_CODERANGE_SET(str, res_encindex, res_cr); return str; } VALUE rb_enc_str_buf_cat(VALUE str, const char *ptr, long len, rb_encoding *ptr_enc) { return rb_enc_cr_str_buf_cat(str, ptr, len, rb_enc_to_index(ptr_enc), ENC_CODERANGE_UNKNOWN, NULL); } VALUE rb_str_buf_cat_ascii(VALUE str, const char *ptr) { /* ptr must reference NUL terminated ASCII string. */ int encindex = ENCODING_GET(str); rb_encoding *enc = rb_enc_from_index(encindex); if (rb_enc_asciicompat(enc)) { return rb_enc_cr_str_buf_cat(str, ptr, strlen(ptr), encindex, ENC_CODERANGE_7BIT, 0); } else { char *buf = ALLOCA_N(char, rb_enc_mbmaxlen(enc)); while (*ptr) { unsigned int c = (unsigned char)*ptr; int len = rb_enc_codelen(c, enc); rb_enc_mbcput(c, buf, enc); rb_enc_cr_str_buf_cat(str, buf, len, encindex, ENC_CODERANGE_VALID, 0); ptr++; } return str; } } VALUE rb_str_buf_append(VALUE str, VALUE str2) { int str2_cr; str2_cr = ENC_CODERANGE(str2); rb_enc_cr_str_buf_cat(str, RSTRING_PTR(str2), RSTRING_LEN(str2), ENCODING_GET(str2), str2_cr, &str2_cr); OBJ_INFECT(str, str2); ENC_CODERANGE_SET(str2, str2_cr); return str; } VALUE rb_str_append(VALUE str, VALUE str2) { StringValue(str2); return rb_str_buf_append(str, str2); } #define MIN_PRE_ALLOC_SIZE 48 MJIT_FUNC_EXPORTED VALUE rb_str_concat_literals(size_t num, const VALUE *strary) { VALUE str; size_t i, s; long len = 1; if (UNLIKELY(!num)) return rb_str_new(0, 0); if (UNLIKELY(num == 1)) return rb_str_resurrect(strary[0]); for (i = 0; i < num; ++i) { len += RSTRING_LEN(strary[i]); } if (LIKELY(len < MIN_PRE_ALLOC_SIZE)) { str = rb_str_resurrect(strary[0]); s = 1; } else { str = rb_str_buf_new(len); rb_enc_copy(str, strary[0]); s = 0; } for (i = s; i < num; ++i) { const VALUE v = strary[i]; int encidx = ENCODING_GET(v); rb_enc_cr_str_buf_cat(str, RSTRING_PTR(v), RSTRING_LEN(v), encidx, ENC_CODERANGE(v), NULL); OBJ_INFECT_RAW(str, v); if (encidx != ENCINDEX_US_ASCII) { if (ENCODING_GET_INLINED(str) == ENCINDEX_US_ASCII) rb_enc_set_index(str, encidx); } } return str; } /* * call-seq: * str.concat(obj1, obj2, ...) -> str * * Concatenates the given object(s) to str. If an object is an * Integer, it is considered a codepoint and converted to a character * before concatenation. * * +concat+ can take multiple arguments, and all the arguments are * concatenated in order. * * a = "hello " * a.concat("world", 33) #=> "hello world!" * a #=> "hello world!" * * b = "sn" * b.concat("_", b, "_", b) #=> "sn_sn_sn" * * See also String#<<, which takes a single argument. */ static VALUE rb_str_concat_multi(int argc, VALUE *argv, VALUE str) { str_modifiable(str); if (argc == 1) { return rb_str_concat(str, argv[0]); } else if (argc > 1) { int i; VALUE arg_str = rb_str_tmp_new(0); rb_enc_copy(arg_str, str); for (i = 0; i < argc; i++) { rb_str_concat(arg_str, argv[i]); } rb_str_buf_append(str, arg_str); } return str; } /* * call-seq: * str << obj -> str * str << integer -> str * * Appends the given object to str. If the object is an * Integer, it is considered a codepoint and converted to a character * before being appended. * * a = "hello " * a << "world" #=> "hello world" * a << 33 #=> "hello world!" * * See also String#concat, which takes multiple arguments. */ VALUE rb_str_concat(VALUE str1, VALUE str2) { unsigned int code; rb_encoding *enc = STR_ENC_GET(str1); int encidx; if (RB_INTEGER_TYPE_P(str2)) { if (rb_num_to_uint(str2, &code) == 0) { } else if (FIXNUM_P(str2)) { rb_raise(rb_eRangeError, "%ld out of char range", FIX2LONG(str2)); } else { rb_raise(rb_eRangeError, "bignum out of char range"); } } else { return rb_str_append(str1, str2); } encidx = rb_enc_to_index(enc); if (encidx == ENCINDEX_ASCII || encidx == ENCINDEX_US_ASCII) { /* US-ASCII automatically extended to ASCII-8BIT */ char buf[1]; buf[0] = (char)code; if (code > 0xFF) { rb_raise(rb_eRangeError, "%u out of char range", code); } rb_str_cat(str1, buf, 1); if (encidx == ENCINDEX_US_ASCII && code > 127) { rb_enc_associate_index(str1, ENCINDEX_ASCII); ENC_CODERANGE_SET(str1, ENC_CODERANGE_VALID); } } else { long pos = RSTRING_LEN(str1); int cr = ENC_CODERANGE(str1); int len; char *buf; switch (len = rb_enc_codelen(code, enc)) { case ONIGERR_INVALID_CODE_POINT_VALUE: rb_raise(rb_eRangeError, "invalid codepoint 0x%X in %s", code, rb_enc_name(enc)); break; case ONIGERR_TOO_BIG_WIDE_CHAR_VALUE: case 0: rb_raise(rb_eRangeError, "%u out of char range", code); break; } buf = ALLOCA_N(char, len + 1); rb_enc_mbcput(code, buf, enc); if (rb_enc_precise_mbclen(buf, buf + len + 1, enc) != len) { rb_raise(rb_eRangeError, "invalid codepoint 0x%X in %s", code, rb_enc_name(enc)); } rb_str_resize(str1, pos+len); memcpy(RSTRING_PTR(str1) + pos, buf, len); if (cr == ENC_CODERANGE_7BIT && code > 127) cr = ENC_CODERANGE_VALID; ENC_CODERANGE_SET(str1, cr); } return str1; } /* * call-seq: * str.prepend(other_str1, other_str2, ...) -> str * * Prepend---Prepend the given strings to str. * * a = "!" * a.prepend("hello ", "world") #=> "hello world!" * a #=> "hello world!" * * See also String#concat. */ static VALUE rb_str_prepend_multi(int argc, VALUE *argv, VALUE str) { str_modifiable(str); if (argc == 1) { rb_str_update(str, 0L, 0L, argv[0]); } else if (argc > 1) { int i; VALUE arg_str = rb_str_tmp_new(0); rb_enc_copy(arg_str, str); for (i = 0; i < argc; i++) { rb_str_append(arg_str, argv[i]); } rb_str_update(str, 0L, 0L, arg_str); } return str; } st_index_t rb_str_hash(VALUE str) { int e = ENCODING_GET(str); if (e && rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT) { e = 0; } return rb_memhash((const void *)RSTRING_PTR(str), RSTRING_LEN(str)) ^ e; } int rb_str_hash_cmp(VALUE str1, VALUE str2) { long len1, len2; const char *ptr1, *ptr2; RSTRING_GETMEM(str1, ptr1, len1); RSTRING_GETMEM(str2, ptr2, len2); return (len1 != len2 || !rb_str_comparable(str1, str2) || memcmp(ptr1, ptr2, len1) != 0); } /* * call-seq: * str.hash -> integer * * Returns a hash based on the string's length, content and encoding. * * See also Object#hash. */ static VALUE rb_str_hash_m(VALUE str) { st_index_t hval = rb_str_hash(str); return ST2FIX(hval); } #define lesser(a,b) (((a)>(b))?(b):(a)) int rb_str_comparable(VALUE str1, VALUE str2) { int idx1, idx2; int rc1, rc2; if (RSTRING_LEN(str1) == 0) return TRUE; if (RSTRING_LEN(str2) == 0) return TRUE; idx1 = ENCODING_GET(str1); idx2 = ENCODING_GET(str2); if (idx1 == idx2) return TRUE; rc1 = rb_enc_str_coderange(str1); rc2 = rb_enc_str_coderange(str2); if (rc1 == ENC_CODERANGE_7BIT) { if (rc2 == ENC_CODERANGE_7BIT) return TRUE; if (rb_enc_asciicompat(rb_enc_from_index(idx2))) return TRUE; } if (rc2 == ENC_CODERANGE_7BIT) { if (rb_enc_asciicompat(rb_enc_from_index(idx1))) return TRUE; } return FALSE; } int rb_str_cmp(VALUE str1, VALUE str2) { long len1, len2; const char *ptr1, *ptr2; int retval; if (str1 == str2) return 0; RSTRING_GETMEM(str1, ptr1, len1); RSTRING_GETMEM(str2, ptr2, len2); if (ptr1 == ptr2 || (retval = memcmp(ptr1, ptr2, lesser(len1, len2))) == 0) { if (len1 == len2) { if (!rb_str_comparable(str1, str2)) { if (ENCODING_GET(str1) > ENCODING_GET(str2)) return 1; return -1; } return 0; } if (len1 > len2) return 1; return -1; } if (retval > 0) return 1; return -1; } /* * call-seq: * str == obj -> true or false * str === obj -> true or false * * Equality---Returns whether +str+ == +obj+, similar to Object#==. * * If +obj+ is not an instance of String but responds to +to_str+, then the * two strings are compared using obj.==. * * Otherwise, returns similarly to String#eql?, comparing length and content. */ VALUE rb_str_equal(VALUE str1, VALUE str2) { if (str1 == str2) return Qtrue; if (!RB_TYPE_P(str2, T_STRING)) { if (!rb_respond_to(str2, idTo_str)) { return Qfalse; } return rb_equal(str2, str1); } return rb_str_eql_internal(str1, str2); } /* * call-seq: * str.eql?(other) -> true or false * * Two strings are equal if they have the same length and content. */ MJIT_FUNC_EXPORTED VALUE rb_str_eql(VALUE str1, VALUE str2) { if (str1 == str2) return Qtrue; if (!RB_TYPE_P(str2, T_STRING)) return Qfalse; return rb_str_eql_internal(str1, str2); } /* * call-seq: * string <=> other_string -> -1, 0, +1, or nil * * Comparison---Returns -1, 0, +1, or +nil+ depending on whether +string+ is * less than, equal to, or greater than +other_string+. * * +nil+ is returned if the two values are incomparable. * * If the strings are of different lengths, and the strings are equal when * compared up to the shortest length, then the longer string is considered * greater than the shorter one. * * <=> is the basis for the methods <, * <=, >, >=, and * between?, included from module Comparable. The method * String#== does not use Comparable#==. * * "abcdef" <=> "abcde" #=> 1 * "abcdef" <=> "abcdef" #=> 0 * "abcdef" <=> "abcdefg" #=> -1 * "abcdef" <=> "ABCDEF" #=> 1 * "abcdef" <=> 1 #=> nil */ static VALUE rb_str_cmp_m(VALUE str1, VALUE str2) { int result; VALUE s = rb_check_string_type(str2); if (NIL_P(s)) { return rb_invcmp(str1, str2); } result = rb_str_cmp(str1, s); return INT2FIX(result); } static VALUE str_casecmp(VALUE str1, VALUE str2); static VALUE str_casecmp_p(VALUE str1, VALUE str2); /* * call-seq: * str.casecmp(other_str) -> -1, 0, +1, or nil * * Case-insensitive version of String#<=>. * Currently, case-insensitivity only works on characters A-Z/a-z, * not all of Unicode. This is different from String#casecmp?. * * "aBcDeF".casecmp("abcde") #=> 1 * "aBcDeF".casecmp("abcdef") #=> 0 * "aBcDeF".casecmp("abcdefg") #=> -1 * "abcdef".casecmp("ABCDEF") #=> 0 * * +nil+ is returned if the two strings have incompatible encodings, * or if +other_str+ is not a string. * * "foo".casecmp(2) #=> nil * "\u{e4 f6 fc}".encode("ISO-8859-1").casecmp("\u{c4 d6 dc}") #=> nil */ static VALUE rb_str_casecmp(VALUE str1, VALUE str2) { VALUE s = rb_check_string_type(str2); if (NIL_P(s)) { return Qnil; } return str_casecmp(str1, s); } static VALUE str_casecmp(VALUE str1, VALUE str2) { long len; rb_encoding *enc; char *p1, *p1end, *p2, *p2end; enc = rb_enc_compatible(str1, str2); if (!enc) { return Qnil; } p1 = RSTRING_PTR(str1); p1end = RSTRING_END(str1); p2 = RSTRING_PTR(str2); p2end = RSTRING_END(str2); if (single_byte_optimizable(str1) && single_byte_optimizable(str2)) { while (p1 < p1end && p2 < p2end) { if (*p1 != *p2) { unsigned int c1 = TOLOWER(*p1 & 0xff); unsigned int c2 = TOLOWER(*p2 & 0xff); if (c1 != c2) return INT2FIX(c1 < c2 ? -1 : 1); } p1++; p2++; } } else { while (p1 < p1end && p2 < p2end) { int l1, c1 = rb_enc_ascget(p1, p1end, &l1, enc); int l2, c2 = rb_enc_ascget(p2, p2end, &l2, enc); if (0 <= c1 && 0 <= c2) { c1 = TOLOWER(c1); c2 = TOLOWER(c2); if (c1 != c2) return INT2FIX(c1 < c2 ? -1 : 1); } else { int r; l1 = rb_enc_mbclen(p1, p1end, enc); l2 = rb_enc_mbclen(p2, p2end, enc); len = l1 < l2 ? l1 : l2; r = memcmp(p1, p2, len); if (r != 0) return INT2FIX(r < 0 ? -1 : 1); if (l1 != l2) return INT2FIX(l1 < l2 ? -1 : 1); } p1 += l1; p2 += l2; } } if (RSTRING_LEN(str1) == RSTRING_LEN(str2)) return INT2FIX(0); if (RSTRING_LEN(str1) > RSTRING_LEN(str2)) return INT2FIX(1); return INT2FIX(-1); } /* * call-seq: * str.casecmp?(other_str) -> true, false, or nil * * Returns +true+ if +str+ and +other_str+ are equal after * Unicode case folding, +false+ if they are not equal. * * "aBcDeF".casecmp?("abcde") #=> false * "aBcDeF".casecmp?("abcdef") #=> true * "aBcDeF".casecmp?("abcdefg") #=> false * "abcdef".casecmp?("ABCDEF") #=> true * "\u{e4 f6 fc}".casecmp?("\u{c4 d6 dc}") #=> true * * +nil+ is returned if the two strings have incompatible encodings, * or if +other_str+ is not a string. * * "foo".casecmp?(2) #=> nil * "\u{e4 f6 fc}".encode("ISO-8859-1").casecmp?("\u{c4 d6 dc}") #=> nil */ static VALUE rb_str_casecmp_p(VALUE str1, VALUE str2) { VALUE s = rb_check_string_type(str2); if (NIL_P(s)) { return Qnil; } return str_casecmp_p(str1, s); } static VALUE str_casecmp_p(VALUE str1, VALUE str2) { rb_encoding *enc; VALUE folded_str1, folded_str2; VALUE fold_opt = sym_fold; enc = rb_enc_compatible(str1, str2); if (!enc) { return Qnil; } folded_str1 = rb_str_downcase(1, &fold_opt, str1); folded_str2 = rb_str_downcase(1, &fold_opt, str2); return rb_str_eql(folded_str1, folded_str2); } static long strseq_core(const char *str_ptr, const char *str_ptr_end, long str_len, const char *sub_ptr, long sub_len, long offset, rb_encoding *enc) { const char *search_start = str_ptr; long pos, search_len = str_len - offset; for (;;) { const char *t; pos = rb_memsearch(sub_ptr, sub_len, search_start, search_len, enc); if (pos < 0) return pos; t = rb_enc_right_char_head(search_start, search_start+pos, str_ptr_end, enc); if (t == search_start + pos) break; search_len -= t - search_start; if (search_len <= 0) return -1; offset += t - search_start; search_start = t; } return pos + offset; } #define rb_str_index(str, sub, offset) rb_strseq_index(str, sub, offset, 0) static long rb_strseq_index(VALUE str, VALUE sub, long offset, int in_byte) { const char *str_ptr, *str_ptr_end, *sub_ptr; long str_len, sub_len; int single_byte = single_byte_optimizable(str); rb_encoding *enc; enc = rb_enc_check(str, sub); if (is_broken_string(sub)) return -1; str_ptr = RSTRING_PTR(str); str_ptr_end = RSTRING_END(str); str_len = RSTRING_LEN(str); sub_ptr = RSTRING_PTR(sub); sub_len = RSTRING_LEN(sub); if (str_len < sub_len) return -1; if (offset != 0) { long str_len_char, sub_len_char; str_len_char = (in_byte || single_byte) ? str_len : str_strlen(str, enc); sub_len_char = in_byte ? sub_len : str_strlen(sub, enc); if (offset < 0) { offset += str_len_char; if (offset < 0) return -1; } if (str_len_char - offset < sub_len_char) return -1; if (!in_byte) offset = str_offset(str_ptr, str_ptr_end, offset, enc, single_byte); str_ptr += offset; } if (sub_len == 0) return offset; /* need proceed one character at a time */ return strseq_core(str_ptr, str_ptr_end, str_len, sub_ptr, sub_len, offset, enc); } /* * call-seq: * str.index(substring [, offset]) -> integer or nil * str.index(regexp [, offset]) -> integer or nil * * Returns the index of the first occurrence of the given substring or * pattern (regexp) in str. Returns nil if not * found. If the second parameter is present, it specifies the position in the * string to begin the search. * * "hello".index('e') #=> 1 * "hello".index('lo') #=> 3 * "hello".index('a') #=> nil * "hello".index(?e) #=> 1 * "hello".index(/[aeiou]/, -3) #=> 4 */ static VALUE rb_str_index_m(int argc, VALUE *argv, VALUE str) { VALUE sub; VALUE initpos; long pos; if (rb_scan_args(argc, argv, "11", &sub, &initpos) == 2) { pos = NUM2LONG(initpos); } else { pos = 0; } if (pos < 0) { pos += str_strlen(str, NULL); if (pos < 0) { if (RB_TYPE_P(sub, T_REGEXP)) { rb_backref_set(Qnil); } return Qnil; } } if (SPECIAL_CONST_P(sub)) goto generic; switch (BUILTIN_TYPE(sub)) { case T_REGEXP: if (pos > str_strlen(str, NULL)) return Qnil; pos = str_offset(RSTRING_PTR(str), RSTRING_END(str), pos, rb_enc_check(str, sub), single_byte_optimizable(str)); pos = rb_reg_search(sub, str, pos, 0); pos = rb_str_sublen(str, pos); break; generic: default: { VALUE tmp; tmp = rb_check_string_type(sub); if (NIL_P(tmp)) { rb_raise(rb_eTypeError, "type mismatch: %s given", rb_obj_classname(sub)); } sub = tmp; } /* fall through */ case T_STRING: pos = rb_str_index(str, sub, pos); pos = rb_str_sublen(str, pos); break; } if (pos == -1) return Qnil; return LONG2NUM(pos); } #ifdef HAVE_MEMRCHR static long str_rindex(VALUE str, VALUE sub, const char *s, long pos, rb_encoding *enc) { char *hit, *adjusted; int c; long slen, searchlen; char *sbeg, *e, *t; slen = RSTRING_LEN(sub); if (slen == 0) return pos; sbeg = RSTRING_PTR(str); e = RSTRING_END(str); t = RSTRING_PTR(sub); c = *t & 0xff; searchlen = s - sbeg + 1; do { hit = memrchr(sbeg, c, searchlen); if (!hit) break; adjusted = rb_enc_left_char_head(sbeg, hit, e, enc); if (hit != adjusted) { searchlen = adjusted - sbeg; continue; } if (memcmp(hit, t, slen) == 0) return rb_str_sublen(str, hit - sbeg); searchlen = adjusted - sbeg; } while (searchlen > 0); return -1; } #else static long str_rindex(VALUE str, VALUE sub, const char *s, long pos, rb_encoding *enc) { long slen; char *sbeg, *e, *t; sbeg = RSTRING_PTR(str); e = RSTRING_END(str); t = RSTRING_PTR(sub); slen = RSTRING_LEN(sub); while (s) { if (memcmp(s, t, slen) == 0) { return pos; } if (pos == 0) break; pos--; s = rb_enc_prev_char(sbeg, s, e, enc); } return -1; } #endif static long rb_str_rindex(VALUE str, VALUE sub, long pos) { long len, slen; char *sbeg, *s; rb_encoding *enc; int singlebyte; enc = rb_enc_check(str, sub); if (is_broken_string(sub)) return -1; singlebyte = single_byte_optimizable(str); len = singlebyte ? RSTRING_LEN(str) : str_strlen(str, enc); /* rb_enc_check */ slen = str_strlen(sub, enc); /* rb_enc_check */ /* substring longer than string */ if (len < slen) return -1; if (len - pos < slen) pos = len - slen; if (len == 0) return pos; sbeg = RSTRING_PTR(str); if (pos == 0) { if (memcmp(sbeg, RSTRING_PTR(sub), RSTRING_LEN(sub)) == 0) return 0; else return -1; } s = str_nth(sbeg, RSTRING_END(str), pos, enc, singlebyte); return str_rindex(str, sub, s, pos, enc); } /* * call-seq: * str.rindex(substring [, integer]) -> integer or nil * str.rindex(regexp [, integer]) -> integer or nil * * Returns the index of the last occurrence of the given substring or * pattern (regexp) in str. Returns nil if not * found. If the second parameter is present, it specifies the position in the * string to end the search---characters beyond this point will not be * considered. * * "hello".rindex('e') #=> 1 * "hello".rindex('l') #=> 3 * "hello".rindex('a') #=> nil * "hello".rindex(?e) #=> 1 * "hello".rindex(/[aeiou]/, -2) #=> 1 */ static VALUE rb_str_rindex_m(int argc, VALUE *argv, VALUE str) { VALUE sub; VALUE vpos; rb_encoding *enc = STR_ENC_GET(str); long pos, len = str_strlen(str, enc); /* str's enc */ if (rb_scan_args(argc, argv, "11", &sub, &vpos) == 2) { pos = NUM2LONG(vpos); if (pos < 0) { pos += len; if (pos < 0) { if (RB_TYPE_P(sub, T_REGEXP)) { rb_backref_set(Qnil); } return Qnil; } } if (pos > len) pos = len; } else { pos = len; } if (SPECIAL_CONST_P(sub)) goto generic; switch (BUILTIN_TYPE(sub)) { case T_REGEXP: /* enc = rb_get_check(str, sub); */ pos = str_offset(RSTRING_PTR(str), RSTRING_END(str), pos, enc, single_byte_optimizable(str)); pos = rb_reg_search(sub, str, pos, 1); pos = rb_str_sublen(str, pos); if (pos >= 0) return LONG2NUM(pos); break; generic: default: { VALUE tmp; tmp = rb_check_string_type(sub); if (NIL_P(tmp)) { rb_raise(rb_eTypeError, "type mismatch: %s given", rb_obj_classname(sub)); } sub = tmp; } /* fall through */ case T_STRING: pos = rb_str_rindex(str, sub, pos); if (pos >= 0) return LONG2NUM(pos); break; } return Qnil; } /* * call-seq: * str =~ obj -> integer or nil * * Match---If obj is a Regexp, use it as a pattern to match * against str,and returns the position the match starts, or * nil if there is no match. Otherwise, invokes * obj.=~, passing str as an argument. The default * =~ in Object returns nil. * * Note: str =~ regexp is not the same as * regexp =~ str. Strings captured from named capture groups * are assigned to local variables only in the second case. * * "cat o' 9 tails" =~ /\d/ #=> 7 * "cat o' 9 tails" =~ 9 #=> nil */ static VALUE rb_str_match(VALUE x, VALUE y) { if (SPECIAL_CONST_P(y)) goto generic; switch (BUILTIN_TYPE(y)) { case T_STRING: rb_raise(rb_eTypeError, "type mismatch: String given"); case T_REGEXP: return rb_reg_match(y, x); generic: default: return rb_funcall(y, idEqTilde, 1, x); } } static VALUE get_pat(VALUE); /* * call-seq: * str.match(pattern) -> matchdata or nil * str.match(pattern, pos) -> matchdata or nil * * Converts pattern to a Regexp (if it isn't already one), * then invokes its match method on str. If the second * parameter is present, it specifies the position in the string to begin the * search. * * 'hello'.match('(.)\1') #=> # * 'hello'.match('(.)\1')[0] #=> "ll" * 'hello'.match(/(.)\1/)[0] #=> "ll" * 'hello'.match(/(.)\1/, 3) #=> nil * 'hello'.match('xx') #=> nil * * If a block is given, invoke the block with MatchData if match succeed, so * that you can write * * str.match(pat) {|m| ...} * * instead of * * if m = str.match(pat) * ... * end * * The return value is a value from block execution in this case. */ static VALUE rb_str_match_m(int argc, VALUE *argv, VALUE str) { VALUE re, result; if (argc < 1) rb_check_arity(argc, 1, 2); re = argv[0]; argv[0] = str; result = rb_funcallv(get_pat(re), rb_intern("match"), argc, argv); if (!NIL_P(result) && rb_block_given_p()) { return rb_yield(result); } return result; } /* * call-seq: * str.match?(pattern) -> true or false * str.match?(pattern, pos) -> true or false * * Converts _pattern_ to a +Regexp+ (if it isn't already one), then * returns a +true+ or +false+ indicates whether the regexp is * matched _str_ or not without updating $~ and other * related variables. If the second parameter is present, it * specifies the position in the string to begin the search. * * "Ruby".match?(/R.../) #=> true * "Ruby".match?(/R.../, 1) #=> false * "Ruby".match?(/P.../) #=> false * $& #=> nil */ static VALUE rb_str_match_m_p(int argc, VALUE *argv, VALUE str) { VALUE re; rb_check_arity(argc, 1, 2); re = get_pat(argv[0]); return rb_reg_match_p(re, str, argc > 1 ? NUM2LONG(argv[1]) : 0); } enum neighbor_char { NEIGHBOR_NOT_CHAR, NEIGHBOR_FOUND, NEIGHBOR_WRAPPED }; static enum neighbor_char enc_succ_char(char *p, long len, rb_encoding *enc) { long i; int l; if (rb_enc_mbminlen(enc) > 1) { /* wchar, trivial case */ int r = rb_enc_precise_mbclen(p, p + len, enc), c; if (!MBCLEN_CHARFOUND_P(r)) { return NEIGHBOR_NOT_CHAR; } c = rb_enc_mbc_to_codepoint(p, p + len, enc) + 1; l = rb_enc_code_to_mbclen(c, enc); if (!l) return NEIGHBOR_NOT_CHAR; if (l != len) return NEIGHBOR_WRAPPED; rb_enc_mbcput(c, p, enc); r = rb_enc_precise_mbclen(p, p + len, enc); if (!MBCLEN_CHARFOUND_P(r)) { return NEIGHBOR_NOT_CHAR; } return NEIGHBOR_FOUND; } while (1) { for (i = len-1; 0 <= i && (unsigned char)p[i] == 0xff; i--) p[i] = '\0'; if (i < 0) return NEIGHBOR_WRAPPED; ++((unsigned char*)p)[i]; l = rb_enc_precise_mbclen(p, p+len, enc); if (MBCLEN_CHARFOUND_P(l)) { l = MBCLEN_CHARFOUND_LEN(l); if (l == len) { return NEIGHBOR_FOUND; } else { memset(p+l, 0xff, len-l); } } if (MBCLEN_INVALID_P(l) && i < len-1) { long len2; int l2; for (len2 = len-1; 0 < len2; len2--) { l2 = rb_enc_precise_mbclen(p, p+len2, enc); if (!MBCLEN_INVALID_P(l2)) break; } memset(p+len2+1, 0xff, len-(len2+1)); } } } static enum neighbor_char enc_pred_char(char *p, long len, rb_encoding *enc) { long i; int l; if (rb_enc_mbminlen(enc) > 1) { /* wchar, trivial case */ int r = rb_enc_precise_mbclen(p, p + len, enc), c; if (!MBCLEN_CHARFOUND_P(r)) { return NEIGHBOR_NOT_CHAR; } c = rb_enc_mbc_to_codepoint(p, p + len, enc); if (!c) return NEIGHBOR_NOT_CHAR; --c; l = rb_enc_code_to_mbclen(c, enc); if (!l) return NEIGHBOR_NOT_CHAR; if (l != len) return NEIGHBOR_WRAPPED; rb_enc_mbcput(c, p, enc); r = rb_enc_precise_mbclen(p, p + len, enc); if (!MBCLEN_CHARFOUND_P(r)) { return NEIGHBOR_NOT_CHAR; } return NEIGHBOR_FOUND; } while (1) { for (i = len-1; 0 <= i && (unsigned char)p[i] == 0; i--) p[i] = '\xff'; if (i < 0) return NEIGHBOR_WRAPPED; --((unsigned char*)p)[i]; l = rb_enc_precise_mbclen(p, p+len, enc); if (MBCLEN_CHARFOUND_P(l)) { l = MBCLEN_CHARFOUND_LEN(l); if (l == len) { return NEIGHBOR_FOUND; } else { memset(p+l, 0, len-l); } } if (MBCLEN_INVALID_P(l) && i < len-1) { long len2; int l2; for (len2 = len-1; 0 < len2; len2--) { l2 = rb_enc_precise_mbclen(p, p+len2, enc); if (!MBCLEN_INVALID_P(l2)) break; } memset(p+len2+1, 0, len-(len2+1)); } } } /* overwrite +p+ by succeeding letter in +enc+ and returns NEIGHBOR_FOUND or NEIGHBOR_WRAPPED. When NEIGHBOR_WRAPPED, carried-out letter is stored into carry. assuming each ranges are successive, and mbclen never change in each ranges. NEIGHBOR_NOT_CHAR is returned if invalid character or the range has only one character. */ static enum neighbor_char enc_succ_alnum_char(char *p, long len, rb_encoding *enc, char *carry) { enum neighbor_char ret; unsigned int c; int ctype; int range; char save[ONIGENC_CODE_TO_MBC_MAXLEN]; /* skip 03A2, invalid char between GREEK CAPITAL LETTERS */ int try; const int max_gaps = 1; c = rb_enc_mbc_to_codepoint(p, p+len, enc); if (rb_enc_isctype(c, ONIGENC_CTYPE_DIGIT, enc)) ctype = ONIGENC_CTYPE_DIGIT; else if (rb_enc_isctype(c, ONIGENC_CTYPE_ALPHA, enc)) ctype = ONIGENC_CTYPE_ALPHA; else return NEIGHBOR_NOT_CHAR; MEMCPY(save, p, char, len); for (try = 0; try <= max_gaps; ++try) { ret = enc_succ_char(p, len, enc); if (ret == NEIGHBOR_FOUND) { c = rb_enc_mbc_to_codepoint(p, p+len, enc); if (rb_enc_isctype(c, ctype, enc)) return NEIGHBOR_FOUND; } } MEMCPY(p, save, char, len); range = 1; while (1) { MEMCPY(save, p, char, len); ret = enc_pred_char(p, len, enc); if (ret == NEIGHBOR_FOUND) { c = rb_enc_mbc_to_codepoint(p, p+len, enc); if (!rb_enc_isctype(c, ctype, enc)) { MEMCPY(p, save, char, len); break; } } else { MEMCPY(p, save, char, len); break; } range++; } if (range == 1) { return NEIGHBOR_NOT_CHAR; } if (ctype != ONIGENC_CTYPE_DIGIT) { MEMCPY(carry, p, char, len); return NEIGHBOR_WRAPPED; } MEMCPY(carry, p, char, len); enc_succ_char(carry, len, enc); return NEIGHBOR_WRAPPED; } static VALUE str_succ(VALUE str); /* * call-seq: * str.succ -> new_str * str.next -> new_str * * Returns the successor to str. The successor is calculated by * incrementing characters starting from the rightmost alphanumeric (or * the rightmost character if there are no alphanumerics) in the * string. Incrementing a digit always results in another digit, and * incrementing a letter results in another letter of the same case. * Incrementing nonalphanumerics uses the underlying character set's * collating sequence. * * If the increment generates a ``carry,'' the character to the left of * it is incremented. This process repeats until there is no carry, * adding an additional character if necessary. * * "abcd".succ #=> "abce" * "THX1138".succ #=> "THX1139" * "<>".succ #=> "<>" * "1999zzz".succ #=> "2000aaa" * "ZZZ9999".succ #=> "AAAA0000" * "***".succ #=> "**+" */ VALUE rb_str_succ(VALUE orig) { VALUE str; str = rb_str_new_with_class(orig, RSTRING_PTR(orig), RSTRING_LEN(orig)); rb_enc_cr_str_copy_for_substr(str, orig); OBJ_INFECT(str, orig); return str_succ(str); } static VALUE str_succ(VALUE str) { rb_encoding *enc; char *sbeg, *s, *e, *last_alnum = 0; int found_alnum = 0; long l, slen; char carry[ONIGENC_CODE_TO_MBC_MAXLEN] = "\1"; long carry_pos = 0, carry_len = 1; enum neighbor_char neighbor = NEIGHBOR_FOUND; slen = RSTRING_LEN(str); if (slen == 0) return str; enc = STR_ENC_GET(str); sbeg = RSTRING_PTR(str); s = e = sbeg + slen; while ((s = rb_enc_prev_char(sbeg, s, e, enc)) != 0) { if (neighbor == NEIGHBOR_NOT_CHAR && last_alnum) { if (ISALPHA(*last_alnum) ? ISDIGIT(*s) : ISDIGIT(*last_alnum) ? ISALPHA(*s) : 0) { break; } } l = rb_enc_precise_mbclen(s, e, enc); if (!ONIGENC_MBCLEN_CHARFOUND_P(l)) continue; l = ONIGENC_MBCLEN_CHARFOUND_LEN(l); neighbor = enc_succ_alnum_char(s, l, enc, carry); switch (neighbor) { case NEIGHBOR_NOT_CHAR: continue; case NEIGHBOR_FOUND: return str; case NEIGHBOR_WRAPPED: last_alnum = s; break; } found_alnum = 1; carry_pos = s - sbeg; carry_len = l; } if (!found_alnum) { /* str contains no alnum */ s = e; while ((s = rb_enc_prev_char(sbeg, s, e, enc)) != 0) { enum neighbor_char neighbor; char tmp[ONIGENC_CODE_TO_MBC_MAXLEN]; l = rb_enc_precise_mbclen(s, e, enc); if (!ONIGENC_MBCLEN_CHARFOUND_P(l)) continue; l = ONIGENC_MBCLEN_CHARFOUND_LEN(l); MEMCPY(tmp, s, char, l); neighbor = enc_succ_char(tmp, l, enc); switch (neighbor) { case NEIGHBOR_FOUND: MEMCPY(s, tmp, char, l); return str; break; case NEIGHBOR_WRAPPED: MEMCPY(s, tmp, char, l); break; case NEIGHBOR_NOT_CHAR: break; } if (rb_enc_precise_mbclen(s, s+l, enc) != l) { /* wrapped to \0...\0. search next valid char. */ enc_succ_char(s, l, enc); } if (!rb_enc_asciicompat(enc)) { MEMCPY(carry, s, char, l); carry_len = l; } carry_pos = s - sbeg; } ENC_CODERANGE_SET(str, ENC_CODERANGE_UNKNOWN); } RESIZE_CAPA(str, slen + carry_len); sbeg = RSTRING_PTR(str); s = sbeg + carry_pos; memmove(s + carry_len, s, slen - carry_pos); memmove(s, carry, carry_len); slen += carry_len; STR_SET_LEN(str, slen); TERM_FILL(&sbeg[slen], rb_enc_mbminlen(enc)); rb_enc_str_coderange(str); return str; } /* * call-seq: * str.succ! -> str * str.next! -> str * * Equivalent to String#succ, but modifies the receiver in place. */ static VALUE rb_str_succ_bang(VALUE str) { rb_str_modify(str); str_succ(str); return str; } static int all_digits_p(const char *s, long len) { while (len-- > 0) { if (!ISDIGIT(*s)) return 0; s++; } return 1; } static int str_upto_i(VALUE str, VALUE arg) { rb_yield(str); return 0; } /* * call-seq: * str.upto(other_str, exclusive=false) {|s| block } -> str * str.upto(other_str, exclusive=false) -> an_enumerator * * Iterates through successive values, starting at str and * ending at other_str inclusive, passing each value in turn * to the block. The String#succ method is used to generate each * value. If optional second argument exclusive is omitted or is * false, the last value will be included; otherwise it will be * excluded. * * If no block is given, an enumerator is returned instead. * * "a8".upto("b6") {|s| print s, ' ' } * for s in "a8".."b6" * print s, ' ' * end * * produces: * * a8 a9 b0 b1 b2 b3 b4 b5 b6 * a8 a9 b0 b1 b2 b3 b4 b5 b6 * * If str and other_str contains only ascii numeric characters, * both are recognized as decimal numbers. In addition, the width of * string (e.g. leading zeros) is handled appropriately. * * "9".upto("11").to_a #=> ["9", "10", "11"] * "25".upto("5").to_a #=> [] * "07".upto("11").to_a #=> ["07", "08", "09", "10", "11"] */ static VALUE rb_str_upto(int argc, VALUE *argv, VALUE beg) { VALUE end, exclusive; rb_scan_args(argc, argv, "11", &end, &exclusive); RETURN_ENUMERATOR(beg, argc, argv); return rb_str_upto_each(beg, end, RTEST(exclusive), str_upto_i, Qnil); } VALUE rb_str_upto_each(VALUE beg, VALUE end, int excl, int (*each)(VALUE, VALUE), VALUE arg) { VALUE current, after_end; ID succ; int n, ascii; rb_encoding *enc; CONST_ID(succ, "succ"); StringValue(end); enc = rb_enc_check(beg, end); ascii = (is_ascii_string(beg) && is_ascii_string(end)); /* single character */ if (RSTRING_LEN(beg) == 1 && RSTRING_LEN(end) == 1 && ascii) { char c = RSTRING_PTR(beg)[0]; char e = RSTRING_PTR(end)[0]; if (c > e || (excl && c == e)) return beg; for (;;) { if ((*each)(rb_enc_str_new(&c, 1, enc), arg)) break; if (!excl && c == e) break; c++; if (excl && c == e) break; } return beg; } /* both edges are all digits */ if (ascii && ISDIGIT(RSTRING_PTR(beg)[0]) && ISDIGIT(RSTRING_PTR(end)[0]) && all_digits_p(RSTRING_PTR(beg), RSTRING_LEN(beg)) && all_digits_p(RSTRING_PTR(end), RSTRING_LEN(end))) { VALUE b, e; int width; width = RSTRING_LENINT(beg); b = rb_str_to_inum(beg, 10, FALSE); e = rb_str_to_inum(end, 10, FALSE); if (FIXNUM_P(b) && FIXNUM_P(e)) { long bi = FIX2LONG(b); long ei = FIX2LONG(e); rb_encoding *usascii = rb_usascii_encoding(); while (bi <= ei) { if (excl && bi == ei) break; if ((*each)(rb_enc_sprintf(usascii, "%.*ld", width, bi), arg)) break; bi++; } } else { ID op = excl ? '<' : idLE; VALUE args[2], fmt = rb_fstring_lit("%.*d"); args[0] = INT2FIX(width); while (rb_funcall(b, op, 1, e)) { args[1] = b; if ((*each)(rb_str_format(numberof(args), args, fmt), arg)) break; b = rb_funcallv(b, succ, 0, 0); } } return beg; } /* normal case */ n = rb_str_cmp(beg, end); if (n > 0 || (excl && n == 0)) return beg; after_end = rb_funcallv(end, succ, 0, 0); current = rb_str_dup(beg); while (!rb_str_equal(current, after_end)) { VALUE next = Qnil; if (excl || !rb_str_equal(current, end)) next = rb_funcallv(current, succ, 0, 0); if ((*each)(current, arg)) break; if (NIL_P(next)) break; current = next; StringValue(current); if (excl && rb_str_equal(current, end)) break; if (RSTRING_LEN(current) > RSTRING_LEN(end) || RSTRING_LEN(current) == 0) break; } return beg; } VALUE rb_str_upto_endless_each(VALUE beg, int (*each)(VALUE, VALUE), VALUE arg) { VALUE current; ID succ; CONST_ID(succ, "succ"); /* both edges are all digits */ if (is_ascii_string(beg) && ISDIGIT(RSTRING_PTR(beg)[0]) && all_digits_p(RSTRING_PTR(beg), RSTRING_LEN(beg))) { VALUE b, args[2], fmt = rb_fstring_lit("%.*d"); int width = RSTRING_LENINT(beg); b = rb_str_to_inum(beg, 10, FALSE); if (FIXNUM_P(b)) { long bi = FIX2LONG(b); rb_encoding *usascii = rb_usascii_encoding(); while (FIXABLE(bi)) { if ((*each)(rb_enc_sprintf(usascii, "%.*ld", width, bi), arg)) break; bi++; } b = LONG2NUM(bi); } args[0] = INT2FIX(width); while (1) { args[1] = b; if ((*each)(rb_str_format(numberof(args), args, fmt), arg)) break; b = rb_funcallv(b, succ, 0, 0); } } /* normal case */ current = rb_str_dup(beg); while (1) { VALUE next = rb_funcallv(current, succ, 0, 0); if ((*each)(current, arg)) break; current = next; StringValue(current); if (RSTRING_LEN(current) == 0) break; } return beg; } static int include_range_i(VALUE str, VALUE arg) { VALUE *argp = (VALUE *)arg; if (!rb_equal(str, *argp)) return 0; *argp = Qnil; return 1; } VALUE rb_str_include_range_p(VALUE beg, VALUE end, VALUE val, VALUE exclusive) { beg = rb_str_new_frozen(beg); StringValue(end); end = rb_str_new_frozen(end); if (NIL_P(val)) return Qfalse; val = rb_check_string_type(val); if (NIL_P(val)) return Qfalse; if (rb_enc_asciicompat(STR_ENC_GET(beg)) && rb_enc_asciicompat(STR_ENC_GET(end)) && rb_enc_asciicompat(STR_ENC_GET(val))) { const char *bp = RSTRING_PTR(beg); const char *ep = RSTRING_PTR(end); const char *vp = RSTRING_PTR(val); if (RSTRING_LEN(beg) == 1 && RSTRING_LEN(end) == 1) { if (RSTRING_LEN(val) == 0 || RSTRING_LEN(val) > 1) return Qfalse; else { char b = *bp; char e = *ep; char v = *vp; if (ISASCII(b) && ISASCII(e) && ISASCII(v)) { if (b <= v && v < e) return Qtrue; if (!RTEST(exclusive) && v == e) return Qtrue; return Qfalse; } } } #if 0 /* both edges are all digits */ if (ISDIGIT(*bp) && ISDIGIT(*ep) && all_digits_p(bp, RSTRING_LEN(beg)) && all_digits_p(ep, RSTRING_LEN(end))) { /* TODO */ } #endif } rb_str_upto_each(beg, end, RTEST(exclusive), include_range_i, (VALUE)&val); return NIL_P(val) ? Qtrue : Qfalse; } static VALUE rb_str_subpat(VALUE str, VALUE re, VALUE backref) { if (rb_reg_search(re, str, 0, 0) >= 0) { VALUE match = rb_backref_get(); int nth = rb_reg_backref_number(match, backref); return rb_reg_nth_match(nth, match); } return Qnil; } static VALUE rb_str_aref(VALUE str, VALUE indx) { long idx; if (FIXNUM_P(indx)) { idx = FIX2LONG(indx); } else if (RB_TYPE_P(indx, T_REGEXP)) { return rb_str_subpat(str, indx, INT2FIX(0)); } else if (RB_TYPE_P(indx, T_STRING)) { if (rb_str_index(str, indx, 0) != -1) return rb_str_dup(indx); return Qnil; } else { /* check if indx is Range */ long beg, len = str_strlen(str, NULL); switch (rb_range_beg_len(indx, &beg, &len, len, 0)) { case Qfalse: break; case Qnil: return Qnil; default: return rb_str_substr(str, beg, len); } idx = NUM2LONG(indx); } return str_substr(str, idx, 1, FALSE); } /* * call-seq: * str[index] -> new_str or nil * str[start, length] -> new_str or nil * str[range] -> new_str or nil * str[regexp] -> new_str or nil * str[regexp, capture] -> new_str or nil * str[match_str] -> new_str or nil * str.slice(index) -> new_str or nil * str.slice(start, length) -> new_str or nil * str.slice(range) -> new_str or nil * str.slice(regexp) -> new_str or nil * str.slice(regexp, capture) -> new_str or nil * str.slice(match_str) -> new_str or nil * * Element Reference --- If passed a single +index+, returns a substring of * one character at that index. If passed a +start+ index and a +length+, * returns a substring containing +length+ characters starting at the * +start+ index. If passed a +range+, its beginning and end are interpreted as * offsets delimiting the substring to be returned. * * In these three cases, if an index is negative, it is counted from the end * of the string. For the +start+ and +range+ cases the starting index * is just before a character and an index matching the string's size. * Additionally, an empty string is returned when the starting index for a * character range is at the end of the string. * * Returns +nil+ if the initial index falls outside the string or the length * is negative. * * If a +Regexp+ is supplied, the matching portion of the string is * returned. If a +capture+ follows the regular expression, which may be a * capture group index or name, follows the regular expression that component * of the MatchData is returned instead. * * If a +match_str+ is given, that string is returned if it occurs in * the string. * * Returns +nil+ if the regular expression does not match or the match string * cannot be found. * * a = "hello there" * * a[1] #=> "e" * a[2, 3] #=> "llo" * a[2..3] #=> "ll" * * a[-3, 2] #=> "er" * a[7..-2] #=> "her" * a[-4..-2] #=> "her" * a[-2..-4] #=> "" * * a[11, 0] #=> "" * a[11] #=> nil * a[12, 0] #=> nil * a[12..-1] #=> nil * * a[/[aeiou](.)\1/] #=> "ell" * a[/[aeiou](.)\1/, 0] #=> "ell" * a[/[aeiou](.)\1/, 1] #=> "l" * a[/[aeiou](.)\1/, 2] #=> nil * * a[/(?[aeiou])(?[^aeiou])/, "non_vowel"] #=> "l" * a[/(?[aeiou])(?[^aeiou])/, "vowel"] #=> "e" * * a["lo"] #=> "lo" * a["bye"] #=> nil */ static VALUE rb_str_aref_m(int argc, VALUE *argv, VALUE str) { if (argc == 2) { if (RB_TYPE_P(argv[0], T_REGEXP)) { return rb_str_subpat(str, argv[0], argv[1]); } else { long beg = NUM2LONG(argv[0]); long len = NUM2LONG(argv[1]); return rb_str_substr(str, beg, len); } } rb_check_arity(argc, 1, 2); return rb_str_aref(str, argv[0]); } VALUE rb_str_drop_bytes(VALUE str, long len) { char *ptr = RSTRING_PTR(str); long olen = RSTRING_LEN(str), nlen; str_modifiable(str); if (len > olen) len = olen; nlen = olen - len; if (STR_EMBEDDABLE_P(nlen, TERM_LEN(str))) { char *oldptr = ptr; int fl = (int)(RBASIC(str)->flags & (STR_NOEMBED|STR_SHARED|STR_NOFREE)); STR_SET_EMBED(str); STR_SET_EMBED_LEN(str, nlen); ptr = RSTRING(str)->as.ary; memmove(ptr, oldptr + len, nlen); if (fl == STR_NOEMBED) xfree(oldptr); } else { if (!STR_SHARED_P(str)) rb_str_new_frozen(str); ptr = RSTRING(str)->as.heap.ptr += len; RSTRING(str)->as.heap.len = nlen; } ptr[nlen] = 0; ENC_CODERANGE_CLEAR(str); return str; } static void rb_str_splice_0(VALUE str, long beg, long len, VALUE val) { char *sptr; long slen, vlen = RSTRING_LEN(val); int cr; if (beg == 0 && vlen == 0) { rb_str_drop_bytes(str, len); OBJ_INFECT(str, val); return; } str_modify_keep_cr(str); RSTRING_GETMEM(str, sptr, slen); if (len < vlen) { /* expand string */ RESIZE_CAPA(str, slen + vlen - len); sptr = RSTRING_PTR(str); } if (ENC_CODERANGE(str) == ENC_CODERANGE_7BIT) cr = rb_enc_str_coderange(val); else cr = ENC_CODERANGE_UNKNOWN; if (vlen != len) { memmove(sptr + beg + vlen, sptr + beg + len, slen - (beg + len)); } if (vlen < beg && len < 0) { MEMZERO(sptr + slen, char, -len); } if (vlen > 0) { memmove(sptr + beg, RSTRING_PTR(val), vlen); } slen += vlen - len; STR_SET_LEN(str, slen); TERM_FILL(&sptr[slen], TERM_LEN(str)); OBJ_INFECT(str, val); ENC_CODERANGE_SET(str, cr); } void rb_str_update(VALUE str, long beg, long len, VALUE val) { long slen; char *p, *e; rb_encoding *enc; int singlebyte = single_byte_optimizable(str); int cr; if (len < 0) rb_raise(rb_eIndexError, "negative length %ld", len); StringValue(val); enc = rb_enc_check(str, val); slen = str_strlen(str, enc); /* rb_enc_check */ if (slen < beg) { out_of_range: rb_raise(rb_eIndexError, "index %ld out of string", beg); } if (beg < 0) { if (beg + slen < 0) { goto out_of_range; } beg += slen; } assert(beg >= 0); assert(beg <= slen); if (len > slen - beg) { len = slen - beg; } str_modify_keep_cr(str); p = str_nth(RSTRING_PTR(str), RSTRING_END(str), beg, enc, singlebyte); if (!p) p = RSTRING_END(str); e = str_nth(p, RSTRING_END(str), len, enc, singlebyte); if (!e) e = RSTRING_END(str); /* error check */ beg = p - RSTRING_PTR(str); /* physical position */ len = e - p; /* physical length */ rb_str_splice_0(str, beg, len, val); rb_enc_associate(str, enc); cr = ENC_CODERANGE_AND(ENC_CODERANGE(str), ENC_CODERANGE(val)); if (cr != ENC_CODERANGE_BROKEN) ENC_CODERANGE_SET(str, cr); } #define rb_str_splice(str, beg, len, val) rb_str_update(str, beg, len, val) static void rb_str_subpat_set(VALUE str, VALUE re, VALUE backref, VALUE val) { int nth; VALUE match; long start, end, len; rb_encoding *enc; struct re_registers *regs; if (rb_reg_search(re, str, 0, 0) < 0) { rb_raise(rb_eIndexError, "regexp not matched"); } match = rb_backref_get(); nth = rb_reg_backref_number(match, backref); regs = RMATCH_REGS(match); if (nth >= regs->num_regs) { out_of_range: rb_raise(rb_eIndexError, "index %d out of regexp", nth); } if (nth < 0) { if (-nth >= regs->num_regs) { goto out_of_range; } nth += regs->num_regs; } start = BEG(nth); if (start == -1) { rb_raise(rb_eIndexError, "regexp group %d not matched", nth); } end = END(nth); len = end - start; StringValue(val); enc = rb_enc_check_str(str, val); rb_str_splice_0(str, start, len, val); rb_enc_associate(str, enc); } static VALUE rb_str_aset(VALUE str, VALUE indx, VALUE val) { long idx, beg; if (FIXNUM_P(indx)) { idx = FIX2LONG(indx); num_index: rb_str_splice(str, idx, 1, val); return val; } if (SPECIAL_CONST_P(indx)) goto generic; switch (BUILTIN_TYPE(indx)) { case T_REGEXP: rb_str_subpat_set(str, indx, INT2FIX(0), val); return val; case T_STRING: beg = rb_str_index(str, indx, 0); if (beg < 0) { rb_raise(rb_eIndexError, "string not matched"); } beg = rb_str_sublen(str, beg); rb_str_splice(str, beg, str_strlen(indx, NULL), val); return val; generic: default: /* check if indx is Range */ { long beg, len; if (rb_range_beg_len(indx, &beg, &len, str_strlen(str, NULL), 2)) { rb_str_splice(str, beg, len, val); return val; } } idx = NUM2LONG(indx); goto num_index; } } /* * call-seq: * str[integer] = new_str * str[integer, integer] = new_str * str[range] = aString * str[regexp] = new_str * str[regexp, integer] = new_str * str[regexp, name] = new_str * str[other_str] = new_str * * Element Assignment---Replaces some or all of the content of * str. The portion of the string affected is determined using * the same criteria as String#[]. If the replacement string is not * the same length as the text it is replacing, the string will be * adjusted accordingly. If the regular expression or string is used * as the index doesn't match a position in the string, IndexError is * raised. If the regular expression form is used, the optional * second Integer allows you to specify which portion of the match to * replace (effectively using the MatchData indexing rules. The forms * that take an Integer will raise an IndexError if the value is out * of range; the Range form will raise a RangeError, and the Regexp * and String will raise an IndexError on negative match. */ static VALUE rb_str_aset_m(int argc, VALUE *argv, VALUE str) { if (argc == 3) { if (RB_TYPE_P(argv[0], T_REGEXP)) { rb_str_subpat_set(str, argv[0], argv[1], argv[2]); } else { rb_str_splice(str, NUM2LONG(argv[0]), NUM2LONG(argv[1]), argv[2]); } return argv[2]; } rb_check_arity(argc, 2, 3); return rb_str_aset(str, argv[0], argv[1]); } /* * call-seq: * str.insert(index, other_str) -> str * * Inserts other_str before the character at the given * index, modifying str. Negative indices count from the * end of the string, and insert after the given character. * The intent is insert aString so that it starts at the given * index. * * "abcd".insert(0, 'X') #=> "Xabcd" * "abcd".insert(3, 'X') #=> "abcXd" * "abcd".insert(4, 'X') #=> "abcdX" * "abcd".insert(-3, 'X') #=> "abXcd" * "abcd".insert(-1, 'X') #=> "abcdX" */ static VALUE rb_str_insert(VALUE str, VALUE idx, VALUE str2) { long pos = NUM2LONG(idx); if (pos == -1) { return rb_str_append(str, str2); } else if (pos < 0) { pos++; } rb_str_splice(str, pos, 0, str2); return str; } /* * call-seq: * str.slice!(integer) -> new_str or nil * str.slice!(integer, integer) -> new_str or nil * str.slice!(range) -> new_str or nil * str.slice!(regexp) -> new_str or nil * str.slice!(other_str) -> new_str or nil * * Deletes the specified portion from str, and returns the portion * deleted. * * string = "this is a string" * string.slice!(2) #=> "i" * string.slice!(3..6) #=> " is " * string.slice!(/s.*t/) #=> "sa st" * string.slice!("r") #=> "r" * string #=> "thing" */ static VALUE rb_str_slice_bang(int argc, VALUE *argv, VALUE str) { VALUE result; VALUE buf[3]; int i; rb_check_arity(argc, 1, 2); for (i=0; i= 0) { VALUE match; str = rb_str_new_frozen(str); rb_backref_set_string(str, pos, RSTRING_LEN(pat)); match = rb_backref_get(); OBJ_INFECT(match, pat); } else { rb_backref_set(Qnil); } } return pos; } else { return rb_reg_search0(pat, str, pos, 0, set_backref_str); } } /* * call-seq: * str.sub!(pattern, replacement) -> str or nil * str.sub!(pattern) {|match| block } -> str or nil * * Performs the same substitution as String#sub in-place. * * Returns +str+ if a substitution was performed or +nil+ if no substitution * was performed. */ static VALUE rb_str_sub_bang(int argc, VALUE *argv, VALUE str) { VALUE pat, repl, hash = Qnil; int iter = 0; int tainted = 0; long plen; int min_arity = rb_block_given_p() ? 1 : 2; long beg; rb_check_arity(argc, min_arity, 2); if (argc == 1) { iter = 1; } else { repl = argv[1]; hash = rb_check_hash_type(argv[1]); if (NIL_P(hash)) { StringValue(repl); } tainted = OBJ_TAINTED_RAW(repl); } pat = get_pat_quoted(argv[0], 1); str_modifiable(str); beg = rb_pat_search(pat, str, 0, 1); if (beg >= 0) { rb_encoding *enc; int cr = ENC_CODERANGE(str); long beg0, end0; VALUE match, match0 = Qnil; struct re_registers *regs; char *p, *rp; long len, rlen; match = rb_backref_get(); regs = RMATCH_REGS(match); if (RB_TYPE_P(pat, T_STRING)) { beg0 = beg; end0 = beg0 + RSTRING_LEN(pat); match0 = pat; } else { beg0 = BEG(0); end0 = END(0); if (iter) match0 = rb_reg_nth_match(0, match); } if (iter || !NIL_P(hash)) { p = RSTRING_PTR(str); len = RSTRING_LEN(str); if (iter) { repl = rb_obj_as_string(rb_yield(match0)); } else { repl = rb_hash_aref(hash, rb_str_subseq(str, beg0, end0 - beg0)); repl = rb_obj_as_string(repl); } str_mod_check(str, p, len); rb_check_frozen(str); } else { repl = rb_reg_regsub(repl, str, regs, RB_TYPE_P(pat, T_STRING) ? Qnil : pat); } enc = rb_enc_compatible(str, repl); if (!enc) { rb_encoding *str_enc = STR_ENC_GET(str); p = RSTRING_PTR(str); len = RSTRING_LEN(str); if (coderange_scan(p, beg0, str_enc) != ENC_CODERANGE_7BIT || coderange_scan(p+end0, len-end0, str_enc) != ENC_CODERANGE_7BIT) { rb_raise(rb_eEncCompatError, "incompatible character encodings: %s and %s", rb_enc_name(str_enc), rb_enc_name(STR_ENC_GET(repl))); } enc = STR_ENC_GET(repl); } rb_str_modify(str); rb_enc_associate(str, enc); tainted |= OBJ_TAINTED_RAW(repl); if (ENC_CODERANGE_UNKNOWN < cr && cr < ENC_CODERANGE_BROKEN) { int cr2 = ENC_CODERANGE(repl); if (cr2 == ENC_CODERANGE_BROKEN || (cr == ENC_CODERANGE_VALID && cr2 == ENC_CODERANGE_7BIT)) cr = ENC_CODERANGE_UNKNOWN; else cr = cr2; } plen = end0 - beg0; rlen = RSTRING_LEN(repl); len = RSTRING_LEN(str); if (rlen > plen) { RESIZE_CAPA(str, len + rlen - plen); } p = RSTRING_PTR(str); if (rlen != plen) { memmove(p + beg0 + rlen, p + beg0 + plen, len - beg0 - plen); } rp = RSTRING_PTR(repl); memmove(p + beg0, rp, rlen); len += rlen - plen; STR_SET_LEN(str, len); TERM_FILL(&RSTRING_PTR(str)[len], TERM_LEN(str)); ENC_CODERANGE_SET(str, cr); FL_SET_RAW(str, tainted); return str; } return Qnil; } /* * call-seq: * str.sub(pattern, replacement) -> new_str * str.sub(pattern, hash) -> new_str * str.sub(pattern) {|match| block } -> new_str * * Returns a copy of +str+ with the _first_ occurrence of +pattern+ * replaced by the second argument. The +pattern+ is typically a Regexp; if * given as a String, any regular expression metacharacters it contains will * be interpreted literally, e.g. \d will match a backslash * followed by 'd', instead of a digit. * * If +replacement+ is a String it will be substituted for the matched text. * It may contain back-references to the pattern's capture groups of the form * \d, where d is a group number, or * \k, where n is a group name. * Similarly, \&, \', \`, and * \+ correspond to special variables, $&, * $', $`, and $+, respectively. * (See rdoc-ref:regexp.rdoc for details.) * \0 is the same as \&. * \\\\ is interpreted as an escape, i.e., a single backslash. * Note that, within +replacement+ the special match variables, such as * $&, will not refer to the current match. * * If the second argument is a Hash, and the matched text is one of its keys, * the corresponding value is the replacement string. * * In the block form, the current match string is passed in as a parameter, * and variables such as $1, $2, $`, * $&, and $' will be set appropriately. * (See rdoc-ref:regexp.rdoc for details.) * The value returned by the block will be substituted for the match on each * call. * * The result inherits any tainting in the original string or any supplied * replacement string. * * "hello".sub(/[aeiou]/, '*') #=> "h*llo" * "hello".sub(/([aeiou])/, '<\1>') #=> "hllo" * "hello".sub(/./) {|s| s.ord.to_s + ' ' } #=> "104 ello" * "hello".sub(/(?[aeiou])/, '*\k*') #=> "h*e*llo" * 'Is SHELL your preferred shell?'.sub(/[[:upper:]]{2,}/, ENV) * #=> "Is /bin/bash your preferred shell?" * * Note that a string literal consumes backslashes. * (See rdoc-ref:syntax/literals.rdoc for details about string literals.) * Back-references are typically preceded by an additional backslash. * For example, if you want to write a back-reference \& in * +replacement+ with a double-quoted string literal, you need to write: * "..\\\\&..". * If you want to write a non-back-reference string \& in * +replacement+, you need first to escape the backslash to prevent * this method from interpreting it as a back-reference, and then you * need to escape the backslashes again to prevent a string literal from * consuming them: "..\\\\\\\\&..". * You may want to use the block form to avoid a lot of backslashes. */ static VALUE rb_str_sub(int argc, VALUE *argv, VALUE str) { str = rb_str_dup(str); rb_str_sub_bang(argc, argv, str); return str; } static VALUE str_gsub(int argc, VALUE *argv, VALUE str, int bang) { VALUE pat, val = Qnil, repl, match, match0 = Qnil, dest, hash = Qnil; struct re_registers *regs; long beg, beg0, end0; long offset, blen, slen, len, last; enum {STR, ITER, MAP} mode = STR; char *sp, *cp; int tainted = 0; int need_backref = -1; rb_encoding *str_enc; switch (argc) { case 1: RETURN_ENUMERATOR(str, argc, argv); mode = ITER; break; case 2: repl = argv[1]; hash = rb_check_hash_type(argv[1]); if (NIL_P(hash)) { StringValue(repl); } else { mode = MAP; } tainted = OBJ_TAINTED_RAW(repl); break; default: rb_error_arity(argc, 1, 2); } pat = get_pat_quoted(argv[0], 1); beg = rb_pat_search(pat, str, 0, need_backref); if (beg < 0) { if (bang) return Qnil; /* no match, no substitution */ return rb_str_dup(str); } offset = 0; blen = RSTRING_LEN(str) + 30; /* len + margin */ dest = rb_str_buf_new(blen); sp = RSTRING_PTR(str); slen = RSTRING_LEN(str); cp = sp; str_enc = STR_ENC_GET(str); rb_enc_associate(dest, str_enc); ENC_CODERANGE_SET(dest, rb_enc_asciicompat(str_enc) ? ENC_CODERANGE_7BIT : ENC_CODERANGE_VALID); do { match = rb_backref_get(); regs = RMATCH_REGS(match); if (RB_TYPE_P(pat, T_STRING)) { beg0 = beg; end0 = beg0 + RSTRING_LEN(pat); match0 = pat; } else { beg0 = BEG(0); end0 = END(0); if (mode == ITER) match0 = rb_reg_nth_match(0, match); } if (mode) { if (mode == ITER) { val = rb_obj_as_string(rb_yield(match0)); } else { val = rb_hash_aref(hash, rb_str_subseq(str, beg0, end0 - beg0)); val = rb_obj_as_string(val); } str_mod_check(str, sp, slen); if (val == dest) { /* paranoid check [ruby-dev:24827] */ rb_raise(rb_eRuntimeError, "block should not cheat"); } } else if (need_backref) { val = rb_reg_regsub(repl, str, regs, RB_TYPE_P(pat, T_STRING) ? Qnil : pat); if (need_backref < 0) { need_backref = val != repl; } } else { val = repl; } tainted |= OBJ_TAINTED_RAW(val); len = beg0 - offset; /* copy pre-match substr */ if (len) { rb_enc_str_buf_cat(dest, cp, len, str_enc); } rb_str_buf_append(dest, val); last = offset; offset = end0; if (beg0 == end0) { /* * Always consume at least one character of the input string * in order to prevent infinite loops. */ if (RSTRING_LEN(str) <= end0) break; len = rb_enc_fast_mbclen(RSTRING_PTR(str)+end0, RSTRING_END(str), str_enc); rb_enc_str_buf_cat(dest, RSTRING_PTR(str)+end0, len, str_enc); offset = end0 + len; } cp = RSTRING_PTR(str) + offset; if (offset > RSTRING_LEN(str)) break; beg = rb_pat_search(pat, str, offset, need_backref); } while (beg >= 0); if (RSTRING_LEN(str) > offset) { rb_enc_str_buf_cat(dest, cp, RSTRING_LEN(str) - offset, str_enc); } rb_pat_search(pat, str, last, 1); if (bang) { str_shared_replace(str, dest); } else { RBASIC_SET_CLASS(dest, rb_obj_class(str)); tainted |= OBJ_TAINTED_RAW(str); str = dest; } FL_SET_RAW(str, tainted); return str; } /* * call-seq: * str.gsub!(pattern, replacement) -> str or nil * str.gsub!(pattern, hash) -> str or nil * str.gsub!(pattern) {|match| block } -> str or nil * str.gsub!(pattern) -> an_enumerator * * Performs the substitutions of String#gsub in place, returning * str, or nil if no substitutions were * performed. If no block and no replacement is given, an * enumerator is returned instead. */ static VALUE rb_str_gsub_bang(int argc, VALUE *argv, VALUE str) { str_modify_keep_cr(str); return str_gsub(argc, argv, str, 1); } /* * call-seq: * str.gsub(pattern, replacement) -> new_str * str.gsub(pattern, hash) -> new_str * str.gsub(pattern) {|match| block } -> new_str * str.gsub(pattern) -> enumerator * * Returns a copy of str with all occurrences of * pattern substituted for the second argument. The pattern is * typically a Regexp; if given as a String, any * regular expression metacharacters it contains will be interpreted * literally, e.g. \d will match a backslash followed by 'd', * instead of a digit. * * If +replacement+ is a String it will be substituted for the matched text. * It may contain back-references to the pattern's capture groups of the form * \d, where d is a group number, or * \k, where n is a group name. * Similarly, \&, \', \`, and * \+ correspond to special variables, $&, * $', $`, and $+, respectively. * (See rdoc-ref:regexp.rdoc for details.) * \0 is the same as \&. * \\\\ is interpreted as an escape, i.e., a single backslash. * Note that, within +replacement+ the special match variables, such as * $&, will not refer to the current match. * * If the second argument is a Hash, and the matched text is one * of its keys, the corresponding value is the replacement string. * * In the block form, the current match string is passed in as a parameter, * and variables such as $1, $2, $`, * $&, and $' will be set appropriately. * (See rdoc-ref:regexp.rdoc for details.) * The value returned by the block will be substituted for the match on each * call. * * The result inherits any tainting in the original string or any supplied * replacement string. * * When neither a block nor a second argument is supplied, an * Enumerator is returned. * * "hello".gsub(/[aeiou]/, '*') #=> "h*ll*" * "hello".gsub(/([aeiou])/, '<\1>') #=> "hll" * "hello".gsub(/./) {|s| s.ord.to_s + ' '} #=> "104 101 108 108 111 " * "hello".gsub(/(?[aeiou])/, '{\k}') #=> "h{e}ll{o}" * 'hello'.gsub(/[eo]/, 'e' => 3, 'o' => '*') #=> "h3ll*" * * Note that a string literal consumes backslashes. * (See rdoc-ref:syntax/literals.rdoc for details on string literals.) * Back-references are typically preceded by an additional backslash. * For example, if you want to write a back-reference \& in * +replacement+ with a double-quoted string literal, you need to write: * "..\\\\&..". * If you want to write a non-back-reference string \& in * +replacement+, you need first to escape the backslash to prevent * this method from interpreting it as a back-reference, and then you * need to escape the backslashes again to prevent a string literal from * consuming them: "..\\\\\\\\&..". * You may want to use the block form to avoid a lot of backslashes. */ static VALUE rb_str_gsub(int argc, VALUE *argv, VALUE str) { return str_gsub(argc, argv, str, 0); } /* * call-seq: * str.replace(other_str) -> str * * Replaces the contents and taintedness of str with the corresponding * values in other_str. * * s = "hello" #=> "hello" * s.replace "world" #=> "world" */ VALUE rb_str_replace(VALUE str, VALUE str2) { str_modifiable(str); if (str == str2) return str; StringValue(str2); str_discard(str); return str_replace(str, str2); } /* * call-seq: * string.clear -> string * * Makes string empty. * * a = "abcde" * a.clear #=> "" */ static VALUE rb_str_clear(VALUE str) { str_discard(str); STR_SET_EMBED(str); STR_SET_EMBED_LEN(str, 0); RSTRING_PTR(str)[0] = 0; if (rb_enc_asciicompat(STR_ENC_GET(str))) ENC_CODERANGE_SET(str, ENC_CODERANGE_7BIT); else ENC_CODERANGE_SET(str, ENC_CODERANGE_VALID); return str; } /* * call-seq: * string.chr -> string * * Returns a one-character string at the beginning of the string. * * a = "abcde" * a.chr #=> "a" */ static VALUE rb_str_chr(VALUE str) { return rb_str_substr(str, 0, 1); } /* * call-seq: * str.getbyte(index) -> 0 .. 255 * * returns the indexth byte as an integer. */ static VALUE rb_str_getbyte(VALUE str, VALUE index) { long pos = NUM2LONG(index); if (pos < 0) pos += RSTRING_LEN(str); if (pos < 0 || RSTRING_LEN(str) <= pos) return Qnil; return INT2FIX((unsigned char)RSTRING_PTR(str)[pos]); } /* * call-seq: * str.setbyte(index, integer) -> integer * * modifies the indexth byte as integer. */ static VALUE rb_str_setbyte(VALUE str, VALUE index, VALUE value) { long pos = NUM2LONG(index); long len = RSTRING_LEN(str); char *head, *left = 0; unsigned char *ptr; rb_encoding *enc; int cr = ENC_CODERANGE_UNKNOWN, width, nlen; if (pos < -len || len <= pos) rb_raise(rb_eIndexError, "index %ld out of string", pos); if (pos < 0) pos += len; VALUE v = rb_to_int(value); VALUE w = rb_int_and(v, INT2FIX(0xff)); unsigned char byte = NUM2INT(w) & 0xFF; if (!str_independent(str)) str_make_independent(str); enc = STR_ENC_GET(str); head = RSTRING_PTR(str); ptr = (unsigned char *)&head[pos]; if (!STR_EMBED_P(str)) { cr = ENC_CODERANGE(str); switch (cr) { case ENC_CODERANGE_7BIT: left = (char *)ptr; *ptr = byte; if (ISASCII(byte)) goto end; nlen = rb_enc_precise_mbclen(left, head+len, enc); if (!MBCLEN_CHARFOUND_P(nlen)) ENC_CODERANGE_SET(str, ENC_CODERANGE_BROKEN); else ENC_CODERANGE_SET(str, ENC_CODERANGE_VALID); goto end; case ENC_CODERANGE_VALID: left = rb_enc_left_char_head(head, ptr, head+len, enc); width = rb_enc_precise_mbclen(left, head+len, enc); *ptr = byte; nlen = rb_enc_precise_mbclen(left, head+len, enc); if (!MBCLEN_CHARFOUND_P(nlen)) ENC_CODERANGE_SET(str, ENC_CODERANGE_BROKEN); else if (MBCLEN_CHARFOUND_LEN(nlen) != width || ISASCII(byte)) ENC_CODERANGE_CLEAR(str); goto end; } } ENC_CODERANGE_CLEAR(str); *ptr = byte; end: return value; } static VALUE str_byte_substr(VALUE str, long beg, long len, int empty) { char *p, *s = RSTRING_PTR(str); long n = RSTRING_LEN(str); VALUE str2; if (beg > n || len < 0) return Qnil; if (beg < 0) { beg += n; if (beg < 0) return Qnil; } if (len > n - beg) len = n - beg; if (len <= 0) { if (!empty) return Qnil; len = 0; p = 0; } else p = s + beg; if (!STR_EMBEDDABLE_P(len, TERM_LEN(str)) && SHARABLE_SUBSTRING_P(beg, len, n)) { str2 = rb_str_new_frozen(str); str2 = str_new_shared(rb_obj_class(str2), str2); RSTRING(str2)->as.heap.ptr += beg; RSTRING(str2)->as.heap.len = len; } else { str2 = rb_str_new_with_class(str, p, len); } str_enc_copy(str2, str); if (RSTRING_LEN(str2) == 0) { if (!rb_enc_asciicompat(STR_ENC_GET(str))) ENC_CODERANGE_SET(str2, ENC_CODERANGE_VALID); else ENC_CODERANGE_SET(str2, ENC_CODERANGE_7BIT); } else { switch (ENC_CODERANGE(str)) { case ENC_CODERANGE_7BIT: ENC_CODERANGE_SET(str2, ENC_CODERANGE_7BIT); break; default: ENC_CODERANGE_SET(str2, ENC_CODERANGE_UNKNOWN); break; } } OBJ_INFECT_RAW(str2, str); return str2; } static VALUE str_byte_aref(VALUE str, VALUE indx) { long idx; if (FIXNUM_P(indx)) { idx = FIX2LONG(indx); } else { /* check if indx is Range */ long beg, len = RSTRING_LEN(str); switch (rb_range_beg_len(indx, &beg, &len, len, 0)) { case Qfalse: break; case Qnil: return Qnil; default: return str_byte_substr(str, beg, len, TRUE); } idx = NUM2LONG(indx); } return str_byte_substr(str, idx, 1, FALSE); } /* * call-seq: * str.byteslice(integer) -> new_str or nil * str.byteslice(integer, integer) -> new_str or nil * str.byteslice(range) -> new_str or nil * * Byte Reference---If passed a single Integer, returns a * substring of one byte at that position. If passed two Integer * objects, returns a substring starting at the offset given by the first, and * a length given by the second. If given a Range, a substring containing * bytes at offsets given by the range is returned. In all three cases, if * an offset is negative, it is counted from the end of str. Returns * nil if the initial offset falls outside the string, the length * is negative, or the beginning of the range is greater than the end. * The encoding of the resulted string keeps original encoding. * * "hello".byteslice(1) #=> "e" * "hello".byteslice(-1) #=> "o" * "hello".byteslice(1, 2) #=> "el" * "\x80\u3042".byteslice(1, 3) #=> "\u3042" * "\x03\u3042\xff".byteslice(1..3) #=> "\u3042" */ static VALUE rb_str_byteslice(int argc, VALUE *argv, VALUE str) { if (argc == 2) { long beg = NUM2LONG(argv[0]); long end = NUM2LONG(argv[1]); return str_byte_substr(str, beg, end, TRUE); } rb_check_arity(argc, 1, 2); return str_byte_aref(str, argv[0]); } /* * call-seq: * str.reverse -> new_str * * Returns a new string with the characters from str in reverse order. * * "stressed".reverse #=> "desserts" */ static VALUE rb_str_reverse(VALUE str) { rb_encoding *enc; VALUE rev; char *s, *e, *p; int cr; if (RSTRING_LEN(str) <= 1) return rb_str_dup(str); enc = STR_ENC_GET(str); rev = rb_str_new_with_class(str, 0, RSTRING_LEN(str)); s = RSTRING_PTR(str); e = RSTRING_END(str); p = RSTRING_END(rev); cr = ENC_CODERANGE(str); if (RSTRING_LEN(str) > 1) { if (single_byte_optimizable(str)) { while (s < e) { *--p = *s++; } } else if (cr == ENC_CODERANGE_VALID) { while (s < e) { int clen = rb_enc_fast_mbclen(s, e, enc); p -= clen; memcpy(p, s, clen); s += clen; } } else { cr = rb_enc_asciicompat(enc) ? ENC_CODERANGE_7BIT : ENC_CODERANGE_VALID; while (s < e) { int clen = rb_enc_mbclen(s, e, enc); if (clen > 1 || (*s & 0x80)) cr = ENC_CODERANGE_UNKNOWN; p -= clen; memcpy(p, s, clen); s += clen; } } } STR_SET_LEN(rev, RSTRING_LEN(str)); OBJ_INFECT_RAW(rev, str); str_enc_copy(rev, str); ENC_CODERANGE_SET(rev, cr); return rev; } /* * call-seq: * str.reverse! -> str * * Reverses str in place. */ static VALUE rb_str_reverse_bang(VALUE str) { if (RSTRING_LEN(str) > 1) { if (single_byte_optimizable(str)) { char *s, *e, c; str_modify_keep_cr(str); s = RSTRING_PTR(str); e = RSTRING_END(str) - 1; while (s < e) { c = *s; *s++ = *e; *e-- = c; } } else { str_shared_replace(str, rb_str_reverse(str)); } } else { str_modify_keep_cr(str); } return str; } /* * call-seq: * str.include? other_str -> true or false * * Returns true if str contains the given string or * character. * * "hello".include? "lo" #=> true * "hello".include? "ol" #=> false * "hello".include? ?h #=> true */ static VALUE rb_str_include(VALUE str, VALUE arg) { long i; StringValue(arg); i = rb_str_index(str, arg, 0); if (i == -1) return Qfalse; return Qtrue; } /* * call-seq: * str.to_i(base=10) -> integer * * Returns the result of interpreting leading characters in str as an * integer base base (between 2 and 36). Extraneous characters past the * end of a valid number are ignored. If there is not a valid number at the * start of str, 0 is returned. This method never raises an * exception when base is valid. * * "12345".to_i #=> 12345 * "99 red balloons".to_i #=> 99 * "0a".to_i #=> 0 * "0a".to_i(16) #=> 10 * "hello".to_i #=> 0 * "1100101".to_i(2) #=> 101 * "1100101".to_i(8) #=> 294977 * "1100101".to_i(10) #=> 1100101 * "1100101".to_i(16) #=> 17826049 */ static VALUE rb_str_to_i(int argc, VALUE *argv, VALUE str) { int base = 10; if (rb_check_arity(argc, 0, 1) && (base = NUM2INT(argv[0])) < 0) { rb_raise(rb_eArgError, "invalid radix %d", base); } return rb_str_to_inum(str, base, FALSE); } /* * call-seq: * str.to_f -> float * * Returns the result of interpreting leading characters in str as a * floating point number. Extraneous characters past the end of a valid number * are ignored. If there is not a valid number at the start of str, * 0.0 is returned. This method never raises an exception. * * "123.45e1".to_f #=> 1234.5 * "45.67 degrees".to_f #=> 45.67 * "thx1138".to_f #=> 0.0 */ static VALUE rb_str_to_f(VALUE str) { return DBL2NUM(rb_str_to_dbl(str, FALSE)); } /* * call-seq: * str.to_s -> str * str.to_str -> str * * Returns +self+. * * If called on a subclass of String, converts the receiver to a String object. */ static VALUE rb_str_to_s(VALUE str) { if (rb_obj_class(str) != rb_cString) { return str_duplicate(rb_cString, str); } return str; } #if 0 static void str_cat_char(VALUE str, unsigned int c, rb_encoding *enc) { char s[RUBY_MAX_CHAR_LEN]; int n = rb_enc_codelen(c, enc); rb_enc_mbcput(c, s, enc); rb_enc_str_buf_cat(str, s, n, enc); } #endif #define CHAR_ESC_LEN 13 /* sizeof(\x{ hex of 32bit unsigned int } \0) */ int rb_str_buf_cat_escaped_char(VALUE result, unsigned int c, int unicode_p) { char buf[CHAR_ESC_LEN + 1]; int l; #if SIZEOF_INT > 4 c &= 0xffffffff; #endif if (unicode_p) { if (c < 0x7F && ISPRINT(c)) { snprintf(buf, CHAR_ESC_LEN, "%c", c); } else if (c < 0x10000) { snprintf(buf, CHAR_ESC_LEN, "\\u%04X", c); } else { snprintf(buf, CHAR_ESC_LEN, "\\u{%X}", c); } } else { if (c < 0x100) { snprintf(buf, CHAR_ESC_LEN, "\\x%02X", c); } else { snprintf(buf, CHAR_ESC_LEN, "\\x{%X}", c); } } l = (int)strlen(buf); /* CHAR_ESC_LEN cannot exceed INT_MAX */ rb_str_buf_cat(result, buf, l); return l; } const char * ruby_escaped_char(int c) { switch (c) { case '\0': return "\\0"; case '\n': return "\\n"; case '\r': return "\\r"; case '\t': return "\\t"; case '\f': return "\\f"; case '\013': return "\\v"; case '\010': return "\\b"; case '\007': return "\\a"; case '\033': return "\\e"; case '\x7f': return "\\c?"; } return NULL; } VALUE rb_str_escape(VALUE str) { int encidx = ENCODING_GET(str); rb_encoding *enc = rb_enc_from_index(encidx); const char *p = RSTRING_PTR(str); const char *pend = RSTRING_END(str); const char *prev = p; char buf[CHAR_ESC_LEN + 1]; VALUE result = rb_str_buf_new(0); int unicode_p = rb_enc_unicode_p(enc); int asciicompat = rb_enc_asciicompat(enc); while (p < pend) { unsigned int c; const char *cc; int n = rb_enc_precise_mbclen(p, pend, enc); if (!MBCLEN_CHARFOUND_P(n)) { if (p > prev) str_buf_cat(result, prev, p - prev); n = rb_enc_mbminlen(enc); if (pend < p + n) n = (int)(pend - p); while (n--) { snprintf(buf, CHAR_ESC_LEN, "\\x%02X", *p & 0377); str_buf_cat(result, buf, strlen(buf)); prev = ++p; } continue; } n = MBCLEN_CHARFOUND_LEN(n); c = rb_enc_mbc_to_codepoint(p, pend, enc); p += n; cc = ruby_escaped_char(c); if (cc) { if (p - n > prev) str_buf_cat(result, prev, p - n - prev); str_buf_cat(result, cc, strlen(cc)); prev = p; } else if (asciicompat && rb_enc_isascii(c, enc) && ISPRINT(c)) { } else { if (p - n > prev) str_buf_cat(result, prev, p - n - prev); rb_str_buf_cat_escaped_char(result, c, unicode_p); prev = p; } } if (p > prev) str_buf_cat(result, prev, p - prev); ENCODING_CODERANGE_SET(result, rb_usascii_encindex(), ENC_CODERANGE_7BIT); OBJ_INFECT_RAW(result, str); return result; } /* * call-seq: * str.inspect -> string * * Returns a printable version of _str_, surrounded by quote marks, * with special characters escaped. * * str = "hello" * str[3] = "\b" * str.inspect #=> "\"hel\\bo\"" */ VALUE rb_str_inspect(VALUE str) { int encidx = ENCODING_GET(str); rb_encoding *enc = rb_enc_from_index(encidx), *actenc; const char *p, *pend, *prev; char buf[CHAR_ESC_LEN + 1]; VALUE result = rb_str_buf_new(0); rb_encoding *resenc = rb_default_internal_encoding(); int unicode_p = rb_enc_unicode_p(enc); int asciicompat = rb_enc_asciicompat(enc); if (resenc == NULL) resenc = rb_default_external_encoding(); if (!rb_enc_asciicompat(resenc)) resenc = rb_usascii_encoding(); rb_enc_associate(result, resenc); str_buf_cat2(result, "\""); p = RSTRING_PTR(str); pend = RSTRING_END(str); prev = p; actenc = get_actual_encoding(encidx, str); if (actenc != enc) { enc = actenc; if (unicode_p) unicode_p = rb_enc_unicode_p(enc); } while (p < pend) { unsigned int c, cc; int n; n = rb_enc_precise_mbclen(p, pend, enc); if (!MBCLEN_CHARFOUND_P(n)) { if (p > prev) str_buf_cat(result, prev, p - prev); n = rb_enc_mbminlen(enc); if (pend < p + n) n = (int)(pend - p); while (n--) { snprintf(buf, CHAR_ESC_LEN, "\\x%02X", *p & 0377); str_buf_cat(result, buf, strlen(buf)); prev = ++p; } continue; } n = MBCLEN_CHARFOUND_LEN(n); c = rb_enc_mbc_to_codepoint(p, pend, enc); p += n; if ((asciicompat || unicode_p) && (c == '"'|| c == '\\' || (c == '#' && p < pend && MBCLEN_CHARFOUND_P(rb_enc_precise_mbclen(p,pend,enc)) && (cc = rb_enc_codepoint(p,pend,enc), (cc == '$' || cc == '@' || cc == '{'))))) { if (p - n > prev) str_buf_cat(result, prev, p - n - prev); str_buf_cat2(result, "\\"); if (asciicompat || enc == resenc) { prev = p - n; continue; } } switch (c) { case '\n': cc = 'n'; break; case '\r': cc = 'r'; break; case '\t': cc = 't'; break; case '\f': cc = 'f'; break; case '\013': cc = 'v'; break; case '\010': cc = 'b'; break; case '\007': cc = 'a'; break; case 033: cc = 'e'; break; default: cc = 0; break; } if (cc) { if (p - n > prev) str_buf_cat(result, prev, p - n - prev); buf[0] = '\\'; buf[1] = (char)cc; str_buf_cat(result, buf, 2); prev = p; continue; } if ((enc == resenc && rb_enc_isprint(c, enc)) || (asciicompat && rb_enc_isascii(c, enc) && ISPRINT(c))) { continue; } else { if (p - n > prev) str_buf_cat(result, prev, p - n - prev); rb_str_buf_cat_escaped_char(result, c, unicode_p); prev = p; continue; } } if (p > prev) str_buf_cat(result, prev, p - prev); str_buf_cat2(result, "\""); OBJ_INFECT_RAW(result, str); return result; } #define IS_EVSTR(p,e) ((p) < (e) && (*(p) == '$' || *(p) == '@' || *(p) == '{')) /* * call-seq: * str.dump -> new_str * * Returns a quoted version of the string with all non-printing characters * replaced by \xHH notation and all special characters escaped. * * This method can be used for round-trip: if the resulting +new_str+ is * eval'ed, it will produce the original string. * * "hello \n ''".dump #=> "\"hello \\n ''\"" * "\f\x00\xff\\\"".dump #=> "\"\\f\\x00\\xFF\\\\\\\"\"" * * See also String#undump. */ VALUE rb_str_dump(VALUE str) { int encidx = rb_enc_get_index(str); rb_encoding *enc = rb_enc_from_index(encidx); long len; const char *p, *pend; char *q, *qend; VALUE result; int u8 = (encidx == rb_utf8_encindex()); static const char nonascii_suffix[] = ".dup.force_encoding(\"%s\")"; len = 2; /* "" */ if (!rb_enc_asciicompat(enc)) { len += strlen(nonascii_suffix) - rb_strlen_lit("%s"); len += strlen(enc->name); } p = RSTRING_PTR(str); pend = p + RSTRING_LEN(str); while (p < pend) { int clen; unsigned char c = *p++; switch (c) { case '"': case '\\': case '\n': case '\r': case '\t': case '\f': case '\013': case '\010': case '\007': case '\033': clen = 2; break; case '#': clen = IS_EVSTR(p, pend) ? 2 : 1; break; default: if (ISPRINT(c)) { clen = 1; } else { if (u8 && c > 0x7F) { /* \u notation */ int n = rb_enc_precise_mbclen(p-1, pend, enc); if (MBCLEN_CHARFOUND_P(n)) { unsigned int cc = rb_enc_mbc_to_codepoint(p-1, pend, enc); if (cc <= 0xFFFF) clen = 6; /* \uXXXX */ else if (cc <= 0xFFFFF) clen = 9; /* \u{XXXXX} */ else clen = 10; /* \u{XXXXXX} */ p += MBCLEN_CHARFOUND_LEN(n)-1; break; } } clen = 4; /* \xNN */ } break; } if (clen > LONG_MAX - len) { rb_raise(rb_eRuntimeError, "string size too big"); } len += clen; } result = rb_str_new_with_class(str, 0, len); p = RSTRING_PTR(str); pend = p + RSTRING_LEN(str); q = RSTRING_PTR(result); qend = q + len + 1; *q++ = '"'; while (p < pend) { unsigned char c = *p++; if (c == '"' || c == '\\') { *q++ = '\\'; *q++ = c; } else if (c == '#') { if (IS_EVSTR(p, pend)) *q++ = '\\'; *q++ = '#'; } else if (c == '\n') { *q++ = '\\'; *q++ = 'n'; } else if (c == '\r') { *q++ = '\\'; *q++ = 'r'; } else if (c == '\t') { *q++ = '\\'; *q++ = 't'; } else if (c == '\f') { *q++ = '\\'; *q++ = 'f'; } else if (c == '\013') { *q++ = '\\'; *q++ = 'v'; } else if (c == '\010') { *q++ = '\\'; *q++ = 'b'; } else if (c == '\007') { *q++ = '\\'; *q++ = 'a'; } else if (c == '\033') { *q++ = '\\'; *q++ = 'e'; } else if (ISPRINT(c)) { *q++ = c; } else { *q++ = '\\'; if (u8) { int n = rb_enc_precise_mbclen(p-1, pend, enc) - 1; if (MBCLEN_CHARFOUND_P(n)) { int cc = rb_enc_mbc_to_codepoint(p-1, pend, enc); p += n; if (cc <= 0xFFFF) snprintf(q, qend-q, "u%04X", cc); /* \uXXXX */ else snprintf(q, qend-q, "u{%X}", cc); /* \u{XXXXX} or \u{XXXXXX} */ q += strlen(q); continue; } } snprintf(q, qend-q, "x%02X", c); q += 3; } } *q++ = '"'; *q = '\0'; if (!rb_enc_asciicompat(enc)) { snprintf(q, qend-q, nonascii_suffix, enc->name); encidx = rb_ascii8bit_encindex(); } OBJ_INFECT_RAW(result, str); /* result from dump is ASCII */ rb_enc_associate_index(result, encidx); ENC_CODERANGE_SET(result, ENC_CODERANGE_7BIT); return result; } static int unescape_ascii(unsigned int c) { switch (c) { case 'n': return '\n'; case 'r': return '\r'; case 't': return '\t'; case 'f': return '\f'; case 'v': return '\13'; case 'b': return '\010'; case 'a': return '\007'; case 'e': return 033; default: UNREACHABLE; } } static void undump_after_backslash(VALUE undumped, const char **ss, const char *s_end, rb_encoding **penc, bool *utf8, bool *binary) { const char *s = *ss; unsigned int c; int codelen; size_t hexlen; unsigned char buf[6]; static rb_encoding *enc_utf8 = NULL; switch (*s) { case '\\': case '"': case '#': rb_str_cat(undumped, s, 1); /* cat itself */ s++; break; case 'n': case 'r': case 't': case 'f': case 'v': case 'b': case 'a': case 'e': *buf = unescape_ascii(*s); rb_str_cat(undumped, (char *)buf, 1); s++; break; case 'u': if (*binary) { rb_raise(rb_eRuntimeError, "hex escape and Unicode escape are mixed"); } *utf8 = true; if (++s >= s_end) { rb_raise(rb_eRuntimeError, "invalid Unicode escape"); } if (enc_utf8 == NULL) enc_utf8 = rb_utf8_encoding(); if (*penc != enc_utf8) { *penc = enc_utf8; rb_enc_associate(undumped, enc_utf8); } if (*s == '{') { /* handle \u{...} form */ s++; for (;;) { if (s >= s_end) { rb_raise(rb_eRuntimeError, "unterminated Unicode escape"); } if (*s == '}') { s++; break; } if (ISSPACE(*s)) { s++; continue; } c = scan_hex(s, s_end-s, &hexlen); if (hexlen == 0 || hexlen > 6) { rb_raise(rb_eRuntimeError, "invalid Unicode escape"); } if (c > 0x10ffff) { rb_raise(rb_eRuntimeError, "invalid Unicode codepoint (too large)"); } if (0xd800 <= c && c <= 0xdfff) { rb_raise(rb_eRuntimeError, "invalid Unicode codepoint"); } codelen = rb_enc_mbcput(c, (char *)buf, *penc); rb_str_cat(undumped, (char *)buf, codelen); s += hexlen; } } else { /* handle \uXXXX form */ c = scan_hex(s, 4, &hexlen); if (hexlen != 4) { rb_raise(rb_eRuntimeError, "invalid Unicode escape"); } if (0xd800 <= c && c <= 0xdfff) { rb_raise(rb_eRuntimeError, "invalid Unicode codepoint"); } codelen = rb_enc_mbcput(c, (char *)buf, *penc); rb_str_cat(undumped, (char *)buf, codelen); s += hexlen; } break; case 'x': if (*utf8) { rb_raise(rb_eRuntimeError, "hex escape and Unicode escape are mixed"); } *binary = true; if (++s >= s_end) { rb_raise(rb_eRuntimeError, "invalid hex escape"); } *buf = scan_hex(s, 2, &hexlen); if (hexlen != 2) { rb_raise(rb_eRuntimeError, "invalid hex escape"); } rb_str_cat(undumped, (char *)buf, 1); s += hexlen; break; default: rb_str_cat(undumped, s-1, 2); s++; } *ss = s; } static VALUE rb_str_is_ascii_only_p(VALUE str); /* * call-seq: * str.undump -> new_str * * Returns an unescaped version of the string. * This does the inverse of String#dump. * * "\"hello \\n ''\"".undump #=> "hello \n ''" */ static VALUE str_undump(VALUE str) { const char *s = RSTRING_PTR(str); const char *s_end = RSTRING_END(str); rb_encoding *enc = rb_enc_get(str); VALUE undumped = rb_enc_str_new(s, 0L, enc); bool utf8 = false; bool binary = false; int w; rb_must_asciicompat(str); if (rb_str_is_ascii_only_p(str) == Qfalse) { rb_raise(rb_eRuntimeError, "non-ASCII character detected"); } if (!str_null_check(str, &w)) { rb_raise(rb_eRuntimeError, "string contains null byte"); } if (RSTRING_LEN(str) < 2) goto invalid_format; if (*s != '"') goto invalid_format; /* strip '"' at the start */ s++; for (;;) { if (s >= s_end) { rb_raise(rb_eRuntimeError, "unterminated dumped string"); } if (*s == '"') { /* epilogue */ s++; if (s == s_end) { /* ascii compatible dumped string */ break; } else { static const char force_encoding_suffix[] = ".force_encoding(\""; /* "\")" */ static const char dup_suffix[] = ".dup"; const char *encname; int encidx; ptrdiff_t size; /* check separately for strings dumped by older versions */ size = sizeof(dup_suffix) - 1; if (s_end - s > size && memcmp(s, dup_suffix, size) == 0) s += size; size = sizeof(force_encoding_suffix) - 1; if (s_end - s <= size) goto invalid_format; if (memcmp(s, force_encoding_suffix, size) != 0) goto invalid_format; s += size; if (utf8) { rb_raise(rb_eRuntimeError, "dumped string contained Unicode escape but used force_encoding"); } encname = s; s = memchr(s, '"', s_end-s); size = s - encname; if (!s) goto invalid_format; if (s_end - s != 2) goto invalid_format; if (s[0] != '"' || s[1] != ')') goto invalid_format; encidx = rb_enc_find_index2(encname, (long)size); if (encidx < 0) { rb_raise(rb_eRuntimeError, "dumped string has unknown encoding name"); } rb_enc_associate_index(undumped, encidx); } break; } if (*s == '\\') { s++; if (s >= s_end) { rb_raise(rb_eRuntimeError, "invalid escape"); } undump_after_backslash(undumped, &s, s_end, &enc, &utf8, &binary); } else { rb_str_cat(undumped, s++, 1); } } OBJ_INFECT(undumped, str); return undumped; invalid_format: rb_raise(rb_eRuntimeError, "invalid dumped string; not wrapped with '\"' nor '\"...\".force_encoding(\"...\")' form"); } static void rb_str_check_dummy_enc(rb_encoding *enc) { if (rb_enc_dummy_p(enc)) { rb_raise(rb_eEncCompatError, "incompatible encoding with this operation: %s", rb_enc_name(enc)); } } static rb_encoding * str_true_enc(VALUE str) { rb_encoding *enc = STR_ENC_GET(str); rb_str_check_dummy_enc(enc); return enc; } static OnigCaseFoldType check_case_options(int argc, VALUE *argv, OnigCaseFoldType flags) { if (argc==0) return flags; if (argc>2) rb_raise(rb_eArgError, "too many options"); if (argv[0]==sym_turkic) { flags |= ONIGENC_CASE_FOLD_TURKISH_AZERI; if (argc==2) { if (argv[1]==sym_lithuanian) flags |= ONIGENC_CASE_FOLD_LITHUANIAN; else rb_raise(rb_eArgError, "invalid second option"); } } else if (argv[0]==sym_lithuanian) { flags |= ONIGENC_CASE_FOLD_LITHUANIAN; if (argc==2) { if (argv[1]==sym_turkic) flags |= ONIGENC_CASE_FOLD_TURKISH_AZERI; else rb_raise(rb_eArgError, "invalid second option"); } } else if (argc>1) rb_raise(rb_eArgError, "too many options"); else if (argv[0]==sym_ascii) flags |= ONIGENC_CASE_ASCII_ONLY; else if (argv[0]==sym_fold) { if ((flags & (ONIGENC_CASE_UPCASE|ONIGENC_CASE_DOWNCASE)) == ONIGENC_CASE_DOWNCASE) flags ^= ONIGENC_CASE_FOLD|ONIGENC_CASE_DOWNCASE; else rb_raise(rb_eArgError, "option :fold only allowed for downcasing"); } else rb_raise(rb_eArgError, "invalid option"); return flags; } static inline bool case_option_single_p(OnigCaseFoldType flags, rb_encoding *enc, VALUE str) { if ((flags & ONIGENC_CASE_ASCII_ONLY) && (enc==rb_utf8_encoding() || rb_enc_mbmaxlen(enc) == 1)) return true; return !(flags & ONIGENC_CASE_FOLD_TURKISH_AZERI) && ENC_CODERANGE(str) == ENC_CODERANGE_7BIT; } /* 16 should be long enough to absorb any kind of single character length increase */ #define CASE_MAPPING_ADDITIONAL_LENGTH 20 #ifndef CASEMAP_DEBUG # define CASEMAP_DEBUG 0 #endif struct mapping_buffer; typedef struct mapping_buffer { size_t capa; size_t used; struct mapping_buffer *next; OnigUChar space[FLEX_ARY_LEN]; } mapping_buffer; static void mapping_buffer_free(void *p) { mapping_buffer *previous_buffer; mapping_buffer *current_buffer = p; while (current_buffer) { previous_buffer = current_buffer; current_buffer = current_buffer->next; ruby_sized_xfree(previous_buffer, previous_buffer->capa); } } static const rb_data_type_t mapping_buffer_type = { "mapping_buffer", {0, mapping_buffer_free,} }; static VALUE rb_str_casemap(VALUE source, OnigCaseFoldType *flags, rb_encoding *enc) { VALUE target; const OnigUChar *source_current, *source_end; int target_length = 0; VALUE buffer_anchor; mapping_buffer *current_buffer = 0; mapping_buffer **pre_buffer; size_t buffer_count = 0; int buffer_length_or_invalid; if (RSTRING_LEN(source) == 0) return rb_str_dup(source); source_current = (OnigUChar*)RSTRING_PTR(source); source_end = (OnigUChar*)RSTRING_END(source); buffer_anchor = TypedData_Wrap_Struct(0, &mapping_buffer_type, 0); pre_buffer = (mapping_buffer **)&DATA_PTR(buffer_anchor); while (source_current < source_end) { /* increase multiplier using buffer count to converge quickly */ size_t capa = (size_t)(source_end-source_current)*++buffer_count + CASE_MAPPING_ADDITIONAL_LENGTH; if (CASEMAP_DEBUG) { fprintf(stderr, "Buffer allocation, capa is %"PRIuSIZE"\n", capa); /* for tuning */ } current_buffer = xmalloc(offsetof(mapping_buffer, space) + capa); *pre_buffer = current_buffer; pre_buffer = ¤t_buffer->next; current_buffer->next = NULL; current_buffer->capa = capa; buffer_length_or_invalid = enc->case_map(flags, (const OnigUChar**)&source_current, source_end, current_buffer->space, current_buffer->space+current_buffer->capa, enc); if (buffer_length_or_invalid < 0) { current_buffer = DATA_PTR(buffer_anchor); DATA_PTR(buffer_anchor) = 0; mapping_buffer_free(current_buffer); rb_raise(rb_eArgError, "input string invalid"); } target_length += current_buffer->used = buffer_length_or_invalid; } if (CASEMAP_DEBUG) { fprintf(stderr, "Buffer count is %"PRIuSIZE"\n", buffer_count); /* for tuning */ } if (buffer_count==1) { target = rb_str_new_with_class(source, (const char*)current_buffer->space, target_length); } else { char *target_current; target = rb_str_new_with_class(source, 0, target_length); target_current = RSTRING_PTR(target); current_buffer = DATA_PTR(buffer_anchor); while (current_buffer) { memcpy(target_current, current_buffer->space, current_buffer->used); target_current += current_buffer->used; current_buffer = current_buffer->next; } } current_buffer = DATA_PTR(buffer_anchor); DATA_PTR(buffer_anchor) = 0; mapping_buffer_free(current_buffer); /* TODO: check about string terminator character */ OBJ_INFECT_RAW(target, source); str_enc_copy(target, source); /*ENC_CODERANGE_SET(mapped, cr);*/ return target; } static VALUE rb_str_ascii_casemap(VALUE source, VALUE target, OnigCaseFoldType *flags, rb_encoding *enc) { const OnigUChar *source_current, *source_end; OnigUChar *target_current, *target_end; long old_length = RSTRING_LEN(source); int length_or_invalid; if (old_length == 0) return Qnil; source_current = (OnigUChar*)RSTRING_PTR(source); source_end = (OnigUChar*)RSTRING_END(source); if (source == target) { target_current = (OnigUChar*)source_current; target_end = (OnigUChar*)source_end; } else { target_current = (OnigUChar*)RSTRING_PTR(target); target_end = (OnigUChar*)RSTRING_END(target); } length_or_invalid = onigenc_ascii_only_case_map(flags, &source_current, source_end, target_current, target_end, enc); if (length_or_invalid < 0) rb_raise(rb_eArgError, "input string invalid"); if (CASEMAP_DEBUG && length_or_invalid != old_length) { fprintf(stderr, "problem with rb_str_ascii_casemap" "; old_length=%ld, new_length=%d\n", old_length, length_or_invalid); rb_raise(rb_eArgError, "internal problem with rb_str_ascii_casemap" "; old_length=%ld, new_length=%d\n", old_length, length_or_invalid); } OBJ_INFECT_RAW(target, source); str_enc_copy(target, source); return target; } static bool upcase_single(VALUE str) { char *s = RSTRING_PTR(str), *send = RSTRING_END(str); bool modified = false; while (s < send) { unsigned int c = *(unsigned char*)s; if (rb_enc_isascii(c, enc) && 'a' <= c && c <= 'z') { *s = 'A' + (c - 'a'); modified = true; } s++; } return modified; } /* * call-seq: * str.upcase! -> str or nil * str.upcase!([options]) -> str or nil * * Upcases the contents of str, returning nil if no changes * were made. * * See String#downcase for meaning of +options+ and use with different encodings. */ static VALUE rb_str_upcase_bang(int argc, VALUE *argv, VALUE str) { rb_encoding *enc; OnigCaseFoldType flags = ONIGENC_CASE_UPCASE; flags = check_case_options(argc, argv, flags); str_modify_keep_cr(str); enc = str_true_enc(str); if (case_option_single_p(flags, enc, str)) { if (upcase_single(str)) flags |= ONIGENC_CASE_MODIFIED; } else if (flags&ONIGENC_CASE_ASCII_ONLY) rb_str_ascii_casemap(str, str, &flags, enc); else str_shared_replace(str, rb_str_casemap(str, &flags, enc)); if (ONIGENC_CASE_MODIFIED&flags) return str; return Qnil; } /* * call-seq: * str.upcase -> new_str * str.upcase([options]) -> new_str * * Returns a copy of str with all lowercase letters replaced with their * uppercase counterparts. * * See String#downcase for meaning of +options+ and use with different encodings. * * "hEllO".upcase #=> "HELLO" */ static VALUE rb_str_upcase(int argc, VALUE *argv, VALUE str) { rb_encoding *enc; OnigCaseFoldType flags = ONIGENC_CASE_UPCASE; VALUE ret; flags = check_case_options(argc, argv, flags); enc = str_true_enc(str); if (case_option_single_p(flags, enc, str)) { ret = rb_str_new_with_class(str, RSTRING_PTR(str), RSTRING_LEN(str)); OBJ_INFECT_RAW(ret, str); str_enc_copy(ret, str); upcase_single(ret); } else if (flags&ONIGENC_CASE_ASCII_ONLY) { ret = rb_str_new_with_class(str, 0, RSTRING_LEN(str)); rb_str_ascii_casemap(str, ret, &flags, enc); } else { ret = rb_str_casemap(str, &flags, enc); } return ret; } static bool downcase_single(VALUE str) { char *s = RSTRING_PTR(str), *send = RSTRING_END(str); bool modified = false; while (s < send) { unsigned int c = *(unsigned char*)s; if (rb_enc_isascii(c, enc) && 'A' <= c && c <= 'Z') { *s = 'a' + (c - 'A'); modified = true; } s++; } return modified; } /* * call-seq: * str.downcase! -> str or nil * str.downcase!([options]) -> str or nil * * Downcases the contents of str, returning nil if no * changes were made. * * See String#downcase for meaning of +options+ and use with different encodings. */ static VALUE rb_str_downcase_bang(int argc, VALUE *argv, VALUE str) { rb_encoding *enc; OnigCaseFoldType flags = ONIGENC_CASE_DOWNCASE; flags = check_case_options(argc, argv, flags); str_modify_keep_cr(str); enc = str_true_enc(str); if (case_option_single_p(flags, enc, str)) { if (downcase_single(str)) flags |= ONIGENC_CASE_MODIFIED; } else if (flags&ONIGENC_CASE_ASCII_ONLY) rb_str_ascii_casemap(str, str, &flags, enc); else str_shared_replace(str, rb_str_casemap(str, &flags, enc)); if (ONIGENC_CASE_MODIFIED&flags) return str; return Qnil; } /* * call-seq: * str.downcase -> new_str * str.downcase([options]) -> new_str * * Returns a copy of str with all uppercase letters replaced with their * lowercase counterparts. Which letters exactly are replaced, and by which * other letters, depends on the presence or absence of options, and on the * +encoding+ of the string. * * The meaning of the +options+ is as follows: * * No option :: * Full Unicode case mapping, suitable for most languages * (see :turkic and :lithuanian options below for exceptions). * Context-dependent case mapping as described in Table 3-14 of the * Unicode standard is currently not supported. * :ascii :: * Only the ASCII region, i.e. the characters ``A'' to ``Z'' and * ``a'' to ``z'', are affected. * This option cannot be combined with any other option. * :turkic :: * Full Unicode case mapping, adapted for Turkic languages * (Turkish, Azerbaijani, ...). This means that upper case I is mapped to * lower case dotless i, and so on. * :lithuanian :: * Currently, just full Unicode case mapping. In the future, full Unicode * case mapping adapted for Lithuanian (keeping the dot on the lower case * i even if there is an accent on top). * :fold :: * Only available on +downcase+ and +downcase!+. Unicode case folding, * which is more far-reaching than Unicode case mapping. * This option currently cannot be combined with any other option * (i.e. there is currently no variant for turkic languages). * * Please note that several assumptions that are valid for ASCII-only case * conversions do not hold for more general case conversions. For example, * the length of the result may not be the same as the length of the input * (neither in characters nor in bytes), some roundtrip assumptions * (e.g. str.downcase == str.upcase.downcase) may not apply, and Unicode * normalization (i.e. String#unicode_normalize) is not necessarily maintained * by case mapping operations. * * Non-ASCII case mapping/folding is currently supported for UTF-8, * UTF-16BE/LE, UTF-32BE/LE, and ISO-8859-1~16 Strings/Symbols. * This support will be extended to other encodings. * * "hEllO".downcase #=> "hello" */ static VALUE rb_str_downcase(int argc, VALUE *argv, VALUE str) { rb_encoding *enc; OnigCaseFoldType flags = ONIGENC_CASE_DOWNCASE; VALUE ret; flags = check_case_options(argc, argv, flags); enc = str_true_enc(str); if (case_option_single_p(flags, enc, str)) { ret = rb_str_new_with_class(str, RSTRING_PTR(str), RSTRING_LEN(str)); OBJ_INFECT_RAW(ret, str); str_enc_copy(ret, str); downcase_single(ret); } else if (flags&ONIGENC_CASE_ASCII_ONLY) { ret = rb_str_new_with_class(str, 0, RSTRING_LEN(str)); rb_str_ascii_casemap(str, ret, &flags, enc); } else { ret = rb_str_casemap(str, &flags, enc); } return ret; } /* * call-seq: * str.capitalize! -> str or nil * str.capitalize!([options]) -> str or nil * * Modifies str by converting the first character to uppercase and the * remainder to lowercase. Returns nil if no changes are made. * There is an exception for modern Georgian (mkhedruli/MTAVRULI), where * the result is the same as for String#downcase, to avoid mixed case. * * See String#downcase for meaning of +options+ and use with different encodings. * * a = "hello" * a.capitalize! #=> "Hello" * a #=> "Hello" * a.capitalize! #=> nil */ static VALUE rb_str_capitalize_bang(int argc, VALUE *argv, VALUE str) { rb_encoding *enc; OnigCaseFoldType flags = ONIGENC_CASE_UPCASE | ONIGENC_CASE_TITLECASE; flags = check_case_options(argc, argv, flags); str_modify_keep_cr(str); enc = str_true_enc(str); if (RSTRING_LEN(str) == 0 || !RSTRING_PTR(str)) return Qnil; if (flags&ONIGENC_CASE_ASCII_ONLY) rb_str_ascii_casemap(str, str, &flags, enc); else str_shared_replace(str, rb_str_casemap(str, &flags, enc)); if (ONIGENC_CASE_MODIFIED&flags) return str; return Qnil; } /* * call-seq: * str.capitalize -> new_str * str.capitalize([options]) -> new_str * * Returns a copy of str with the first character converted to uppercase * and the remainder to lowercase. * * See String#downcase for meaning of +options+ and use with different encodings. * * "hello".capitalize #=> "Hello" * "HELLO".capitalize #=> "Hello" * "123ABC".capitalize #=> "123abc" */ static VALUE rb_str_capitalize(int argc, VALUE *argv, VALUE str) { rb_encoding *enc; OnigCaseFoldType flags = ONIGENC_CASE_UPCASE | ONIGENC_CASE_TITLECASE; VALUE ret; flags = check_case_options(argc, argv, flags); enc = str_true_enc(str); if (RSTRING_LEN(str) == 0 || !RSTRING_PTR(str)) return str; if (flags&ONIGENC_CASE_ASCII_ONLY) { ret = rb_str_new_with_class(str, 0, RSTRING_LEN(str)); rb_str_ascii_casemap(str, ret, &flags, enc); } else { ret = rb_str_casemap(str, &flags, enc); } return ret; } /* * call-seq: * str.swapcase! -> str or nil * str.swapcase!([options]) -> str or nil * * Equivalent to String#swapcase, but modifies the receiver in place, * returning str, or nil if no changes were made. * * See String#downcase for meaning of +options+ and use with * different encodings. */ static VALUE rb_str_swapcase_bang(int argc, VALUE *argv, VALUE str) { rb_encoding *enc; OnigCaseFoldType flags = ONIGENC_CASE_UPCASE | ONIGENC_CASE_DOWNCASE; flags = check_case_options(argc, argv, flags); str_modify_keep_cr(str); enc = str_true_enc(str); if (flags&ONIGENC_CASE_ASCII_ONLY) rb_str_ascii_casemap(str, str, &flags, enc); else str_shared_replace(str, rb_str_casemap(str, &flags, enc)); if (ONIGENC_CASE_MODIFIED&flags) return str; return Qnil; } /* * call-seq: * str.swapcase -> new_str * str.swapcase([options]) -> new_str * * Returns a copy of str with uppercase alphabetic characters converted * to lowercase and lowercase characters converted to uppercase. * * See String#downcase for meaning of +options+ and use with different encodings. * * "Hello".swapcase #=> "hELLO" * "cYbEr_PuNk11".swapcase #=> "CyBeR_pUnK11" */ static VALUE rb_str_swapcase(int argc, VALUE *argv, VALUE str) { rb_encoding *enc; OnigCaseFoldType flags = ONIGENC_CASE_UPCASE | ONIGENC_CASE_DOWNCASE; VALUE ret; flags = check_case_options(argc, argv, flags); enc = str_true_enc(str); if (RSTRING_LEN(str) == 0 || !RSTRING_PTR(str)) return str; if (flags&ONIGENC_CASE_ASCII_ONLY) { ret = rb_str_new_with_class(str, 0, RSTRING_LEN(str)); rb_str_ascii_casemap(str, ret, &flags, enc); } else { ret = rb_str_casemap(str, &flags, enc); } return ret; } typedef unsigned char *USTR; struct tr { int gen; unsigned int now, max; char *p, *pend; }; static unsigned int trnext(struct tr *t, rb_encoding *enc) { int n; for (;;) { if (!t->gen) { nextpart: if (t->p == t->pend) return -1; if (rb_enc_ascget(t->p, t->pend, &n, enc) == '\\' && t->p + n < t->pend) { t->p += n; } t->now = rb_enc_codepoint_len(t->p, t->pend, &n, enc); t->p += n; if (rb_enc_ascget(t->p, t->pend, &n, enc) == '-' && t->p + n < t->pend) { t->p += n; if (t->p < t->pend) { unsigned int c = rb_enc_codepoint_len(t->p, t->pend, &n, enc); t->p += n; if (t->now > c) { if (t->now < 0x80 && c < 0x80) { rb_raise(rb_eArgError, "invalid range \"%c-%c\" in string transliteration", t->now, c); } else { rb_raise(rb_eArgError, "invalid range in string transliteration"); } continue; /* not reached */ } t->gen = 1; t->max = c; } } return t->now; } else { while (ONIGENC_CODE_TO_MBCLEN(enc, ++t->now) <= 0) { if (t->now == t->max) { t->gen = 0; goto nextpart; } } if (t->now < t->max) { return t->now; } else { t->gen = 0; return t->max; } } } } static VALUE rb_str_delete_bang(int,VALUE*,VALUE); static VALUE tr_trans(VALUE str, VALUE src, VALUE repl, int sflag) { const unsigned int errc = -1; unsigned int trans[256]; rb_encoding *enc, *e1, *e2; struct tr trsrc, trrepl; int cflag = 0; unsigned int c, c0, last = 0; int modify = 0, i, l; unsigned char *s, *send; VALUE hash = 0; int singlebyte = single_byte_optimizable(str); int termlen; int cr; #define CHECK_IF_ASCII(c) \ (void)((cr == ENC_CODERANGE_7BIT && !rb_isascii(c)) ? \ (cr = ENC_CODERANGE_VALID) : 0) StringValue(src); StringValue(repl); if (RSTRING_LEN(str) == 0 || !RSTRING_PTR(str)) return Qnil; if (RSTRING_LEN(repl) == 0) { return rb_str_delete_bang(1, &src, str); } cr = ENC_CODERANGE(str); e1 = rb_enc_check(str, src); e2 = rb_enc_check(str, repl); if (e1 == e2) { enc = e1; } else { enc = rb_enc_check(src, repl); } trsrc.p = RSTRING_PTR(src); trsrc.pend = trsrc.p + RSTRING_LEN(src); if (RSTRING_LEN(src) > 1 && rb_enc_ascget(trsrc.p, trsrc.pend, &l, enc) == '^' && trsrc.p + l < trsrc.pend) { cflag = 1; trsrc.p += l; } trrepl.p = RSTRING_PTR(repl); trrepl.pend = trrepl.p + RSTRING_LEN(repl); trsrc.gen = trrepl.gen = 0; trsrc.now = trrepl.now = 0; trsrc.max = trrepl.max = 0; if (cflag) { for (i=0; i<256; i++) { trans[i] = 1; } while ((c = trnext(&trsrc, enc)) != errc) { if (c < 256) { trans[c] = errc; } else { if (!hash) hash = rb_hash_new(); rb_hash_aset(hash, UINT2NUM(c), Qtrue); } } while ((c = trnext(&trrepl, enc)) != errc) /* retrieve last replacer */; last = trrepl.now; for (i=0; i<256; i++) { if (trans[i] != errc) { trans[i] = last; } } } else { unsigned int r; for (i=0; i<256; i++) { trans[i] = errc; } while ((c = trnext(&trsrc, enc)) != errc) { r = trnext(&trrepl, enc); if (r == errc) r = trrepl.now; if (c < 256) { trans[c] = r; if (rb_enc_codelen(r, enc) != 1) singlebyte = 0; } else { if (!hash) hash = rb_hash_new(); rb_hash_aset(hash, UINT2NUM(c), UINT2NUM(r)); } } } if (cr == ENC_CODERANGE_VALID && rb_enc_asciicompat(e1)) cr = ENC_CODERANGE_7BIT; str_modify_keep_cr(str); s = (unsigned char *)RSTRING_PTR(str); send = (unsigned char *)RSTRING_END(str); termlen = rb_enc_mbminlen(enc); if (sflag) { int clen, tlen; long offset, max = RSTRING_LEN(str); unsigned int save = -1; unsigned char *buf = ALLOC_N(unsigned char, max + termlen), *t = buf; while (s < send) { int may_modify = 0; c0 = c = rb_enc_codepoint_len((char *)s, (char *)send, &clen, e1); tlen = enc == e1 ? clen : rb_enc_codelen(c, enc); s += clen; if (c < 256) { c = trans[c]; } else if (hash) { VALUE tmp = rb_hash_lookup(hash, UINT2NUM(c)); if (NIL_P(tmp)) { if (cflag) c = last; else c = errc; } else if (cflag) c = errc; else c = NUM2INT(tmp); } else { c = errc; } if (c != (unsigned int)-1) { if (save == c) { CHECK_IF_ASCII(c); continue; } save = c; tlen = rb_enc_codelen(c, enc); modify = 1; } else { save = -1; c = c0; if (enc != e1) may_modify = 1; } if ((offset = t - buf) + tlen > max) { size_t MAYBE_UNUSED(old) = max + termlen; max = offset + tlen + (send - s); SIZED_REALLOC_N(buf, unsigned char, max + termlen, old); t = buf + offset; } rb_enc_mbcput(c, t, enc); if (may_modify && memcmp(s, t, tlen) != 0) { modify = 1; } CHECK_IF_ASCII(c); t += tlen; } if (!STR_EMBED_P(str)) { ruby_sized_xfree(STR_HEAP_PTR(str), STR_HEAP_SIZE(str)); } TERM_FILL((char *)t, termlen); RSTRING(str)->as.heap.ptr = (char *)buf; RSTRING(str)->as.heap.len = t - buf; STR_SET_NOEMBED(str); RSTRING(str)->as.heap.aux.capa = max; } else if (rb_enc_mbmaxlen(enc) == 1 || (singlebyte && !hash)) { while (s < send) { c = (unsigned char)*s; if (trans[c] != errc) { if (!cflag) { c = trans[c]; *s = c; modify = 1; } else { *s = last; modify = 1; } } CHECK_IF_ASCII(c); s++; } } else { int clen, tlen; long offset, max = (long)((send - s) * 1.2); unsigned char *buf = ALLOC_N(unsigned char, max + termlen), *t = buf; while (s < send) { int may_modify = 0; c0 = c = rb_enc_codepoint_len((char *)s, (char *)send, &clen, e1); tlen = enc == e1 ? clen : rb_enc_codelen(c, enc); if (c < 256) { c = trans[c]; } else if (hash) { VALUE tmp = rb_hash_lookup(hash, UINT2NUM(c)); if (NIL_P(tmp)) { if (cflag) c = last; else c = errc; } else if (cflag) c = errc; else c = NUM2INT(tmp); } else { c = cflag ? last : errc; } if (c != errc) { tlen = rb_enc_codelen(c, enc); modify = 1; } else { c = c0; if (enc != e1) may_modify = 1; } if ((offset = t - buf) + tlen > max) { size_t MAYBE_UNUSED(old) = max + termlen; max = offset + tlen + (long)((send - s) * 1.2); SIZED_REALLOC_N(buf, unsigned char, max + termlen, old); t = buf + offset; } if (s != t) { rb_enc_mbcput(c, t, enc); if (may_modify && memcmp(s, t, tlen) != 0) { modify = 1; } } CHECK_IF_ASCII(c); s += clen; t += tlen; } if (!STR_EMBED_P(str)) { ruby_sized_xfree(STR_HEAP_PTR(str), STR_HEAP_SIZE(str)); } TERM_FILL((char *)t, termlen); RSTRING(str)->as.heap.ptr = (char *)buf; RSTRING(str)->as.heap.len = t - buf; STR_SET_NOEMBED(str); RSTRING(str)->as.heap.aux.capa = max; } if (modify) { if (cr != ENC_CODERANGE_BROKEN) ENC_CODERANGE_SET(str, cr); rb_enc_associate(str, enc); return str; } return Qnil; } /* * call-seq: * str.tr!(from_str, to_str) -> str or nil * * Translates str in place, using the same rules as * String#tr. Returns str, or nil if no changes * were made. */ static VALUE rb_str_tr_bang(VALUE str, VALUE src, VALUE repl) { return tr_trans(str, src, repl, 0); } /* * call-seq: * str.tr(from_str, to_str) => new_str * * Returns a copy of +str+ with the characters in +from_str+ replaced by the * corresponding characters in +to_str+. If +to_str+ is shorter than * +from_str+, it is padded with its last character in order to maintain the * correspondence. * * "hello".tr('el', 'ip') #=> "hippo" * "hello".tr('aeiou', '*') #=> "h*ll*" * "hello".tr('aeiou', 'AA*') #=> "hAll*" * * Both strings may use the c1-c2 notation to denote ranges of * characters, and +from_str+ may start with a ^, which denotes * all characters except those listed. * * "hello".tr('a-y', 'b-z') #=> "ifmmp" * "hello".tr('^aeiou', '*') #=> "*e**o" * * The backslash character \\ can be used to escape * ^ or - and is otherwise ignored unless it * appears at the end of a range or the end of the +from_str+ or +to_str+: * * "hello^world".tr("\\^aeiou", "*") #=> "h*ll**w*rld" * "hello-world".tr("a\\-eo", "*") #=> "h*ll**w*rld" * * "hello\r\nworld".tr("\r", "") #=> "hello\nworld" * "hello\r\nworld".tr("\\r", "") #=> "hello\r\nwold" * "hello\r\nworld".tr("\\\r", "") #=> "hello\nworld" * * "X['\\b']".tr("X\\", "") #=> "['b']" * "X['\\b']".tr("X-\\]", "") #=> "'b'" */ static VALUE rb_str_tr(VALUE str, VALUE src, VALUE repl) { str = rb_str_dup(str); tr_trans(str, src, repl, 0); return str; } #define TR_TABLE_SIZE 257 static void tr_setup_table(VALUE str, char stable[TR_TABLE_SIZE], int first, VALUE *tablep, VALUE *ctablep, rb_encoding *enc) { const unsigned int errc = -1; char buf[256]; struct tr tr; unsigned int c; VALUE table = 0, ptable = 0; int i, l, cflag = 0; tr.p = RSTRING_PTR(str); tr.pend = tr.p + RSTRING_LEN(str); tr.gen = tr.now = tr.max = 0; if (RSTRING_LEN(str) > 1 && rb_enc_ascget(tr.p, tr.pend, &l, enc) == '^') { cflag = 1; tr.p += l; } if (first) { for (i=0; i<256; i++) { stable[i] = 1; } stable[256] = cflag; } else if (stable[256] && !cflag) { stable[256] = 0; } for (i=0; i<256; i++) { buf[i] = cflag; } while ((c = trnext(&tr, enc)) != errc) { if (c < 256) { buf[c & 0xff] = !cflag; } else { VALUE key = UINT2NUM(c); if (!table && (first || *tablep || stable[256])) { if (cflag) { ptable = *ctablep; table = ptable ? ptable : rb_hash_new(); *ctablep = table; } else { table = rb_hash_new(); ptable = *tablep; *tablep = table; } } if (table && (!ptable || (cflag ^ !NIL_P(rb_hash_aref(ptable, key))))) { rb_hash_aset(table, key, Qtrue); } } } for (i=0; i<256; i++) { stable[i] = stable[i] && buf[i]; } if (!table && !cflag) { *tablep = 0; } } static int tr_find(unsigned int c, const char table[TR_TABLE_SIZE], VALUE del, VALUE nodel) { if (c < 256) { return table[c] != 0; } else { VALUE v = UINT2NUM(c); if (del) { if (!NIL_P(rb_hash_lookup(del, v)) && (!nodel || NIL_P(rb_hash_lookup(nodel, v)))) { return TRUE; } } else if (nodel && !NIL_P(rb_hash_lookup(nodel, v))) { return FALSE; } return table[256] ? TRUE : FALSE; } } /* * call-seq: * str.delete!([other_str]+) -> str or nil * * Performs a delete operation in place, returning str, or * nil if str was not modified. */ static VALUE rb_str_delete_bang(int argc, VALUE *argv, VALUE str) { char squeez[TR_TABLE_SIZE]; rb_encoding *enc = 0; char *s, *send, *t; VALUE del = 0, nodel = 0; int modify = 0; int i, ascompat, cr; if (RSTRING_LEN(str) == 0 || !RSTRING_PTR(str)) return Qnil; rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS); for (i=0; i new_str * * Returns a copy of str with all characters in the intersection of its * arguments deleted. Uses the same rules for building the set of characters as * String#count. * * "hello".delete "l","lo" #=> "heo" * "hello".delete "lo" #=> "he" * "hello".delete "aeiou", "^e" #=> "hell" * "hello".delete "ej-m" #=> "ho" */ static VALUE rb_str_delete(int argc, VALUE *argv, VALUE str) { str = rb_str_dup(str); rb_str_delete_bang(argc, argv, str); return str; } /* * call-seq: * str.squeeze!([other_str]*) -> str or nil * * Squeezes str in place, returning either str, or * nil if no changes were made. */ static VALUE rb_str_squeeze_bang(int argc, VALUE *argv, VALUE str) { char squeez[TR_TABLE_SIZE]; rb_encoding *enc = 0; VALUE del = 0, nodel = 0; unsigned char *s, *send, *t; int i, modify = 0; int ascompat, singlebyte = single_byte_optimizable(str); unsigned int save; if (argc == 0) { enc = STR_ENC_GET(str); } else { for (i=0; i 0 && !squeez[c])) { *t++ = save = c; } } } else { while (s < send) { unsigned int c; int clen; if (ascompat && (c = *s) < 0x80) { if (c != save || (argc > 0 && !squeez[c])) { *t++ = save = c; } s++; } else { c = rb_enc_codepoint_len((char *)s, (char *)send, &clen, enc); if (c != save || (argc > 0 && !tr_find(c, squeez, del, nodel))) { if (t != s) rb_enc_mbcput(c, t, enc); save = c; t += clen; } s += clen; } } } TERM_FILL((char *)t, TERM_LEN(str)); if ((char *)t - RSTRING_PTR(str) != RSTRING_LEN(str)) { STR_SET_LEN(str, (char *)t - RSTRING_PTR(str)); modify = 1; } if (modify) return str; return Qnil; } /* * call-seq: * str.squeeze([other_str]*) -> new_str * * Builds a set of characters from the other_str parameter(s) * using the procedure described for String#count. Returns a new * string where runs of the same character that occur in this set are * replaced by a single character. If no arguments are given, all * runs of identical characters are replaced by a single character. * * "yellow moon".squeeze #=> "yelow mon" * " now is the".squeeze(" ") #=> " now is the" * "putters shoot balls".squeeze("m-z") #=> "puters shot balls" */ static VALUE rb_str_squeeze(int argc, VALUE *argv, VALUE str) { str = rb_str_dup(str); rb_str_squeeze_bang(argc, argv, str); return str; } /* * call-seq: * str.tr_s!(from_str, to_str) -> str or nil * * Performs String#tr_s processing on str in place, * returning str, or nil if no changes were made. */ static VALUE rb_str_tr_s_bang(VALUE str, VALUE src, VALUE repl) { return tr_trans(str, src, repl, 1); } /* * call-seq: * str.tr_s(from_str, to_str) -> new_str * * Processes a copy of str as described under String#tr, then * removes duplicate characters in regions that were affected by the * translation. * * "hello".tr_s('l', 'r') #=> "hero" * "hello".tr_s('el', '*') #=> "h*o" * "hello".tr_s('el', 'hx') #=> "hhxo" */ static VALUE rb_str_tr_s(VALUE str, VALUE src, VALUE repl) { str = rb_str_dup(str); tr_trans(str, src, repl, 1); return str; } /* * call-seq: * str.count([other_str]+) -> integer * * Each +other_str+ parameter defines a set of characters to count. The * intersection of these sets defines the characters to count in +str+. Any * +other_str+ that starts with a caret ^ is negated. The * sequence c1-c2 means all characters between c1 and c2. The * backslash character \\ can be used to escape ^ or * - and is otherwise ignored unless it appears at the end of a * sequence or the end of a +other_str+. * * a = "hello world" * a.count "lo" #=> 5 * a.count "lo", "o" #=> 2 * a.count "hello", "^l" #=> 4 * a.count "ej-m" #=> 4 * * "hello^world".count "\\^aeiou" #=> 4 * "hello-world".count "a\\-eo" #=> 4 * * c = "hello world\\r\\n" * c.count "\\" #=> 2 * c.count "\\A" #=> 0 * c.count "X-\\w" #=> 3 */ static VALUE rb_str_count(int argc, VALUE *argv, VALUE str) { char table[TR_TABLE_SIZE]; rb_encoding *enc = 0; VALUE del = 0, nodel = 0, tstr; char *s, *send; int i; int ascompat; rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS); tstr = argv[0]; StringValue(tstr); enc = rb_enc_check(str, tstr); if (argc == 1) { const char *ptstr; if (RSTRING_LEN(tstr) == 1 && rb_enc_asciicompat(enc) && (ptstr = RSTRING_PTR(tstr), ONIGENC_IS_ALLOWED_REVERSE_MATCH(enc, (const unsigned char *)ptstr, (const unsigned char *)ptstr+1)) && !is_broken_string(str)) { int n = 0; int clen; unsigned char c = rb_enc_codepoint_len(ptstr, ptstr+1, &clen, enc); s = RSTRING_PTR(str); if (!s || RSTRING_LEN(str) == 0) return INT2FIX(0); send = RSTRING_END(str); while (s < send) { if (*(unsigned char*)s++ == c) n++; } return INT2NUM(n); } } tr_setup_table(tstr, table, TRUE, &del, &nodel, enc); for (i=1; i= 0 && len == 0) { return empty_count + 1; } if (empty_count > 0) { /* make different substrings */ if (result) { do { rb_ary_push(result, str_new_empty(str)); } while (--empty_count > 0); } else { do { rb_yield(str_new_empty(str)); } while (--empty_count > 0); } } str = rb_str_subseq(str, beg, len); if (result) { rb_ary_push(result, str); } else { rb_yield(str); } return empty_count; } /* * call-seq: * str.split(pattern=nil, [limit]) -> an_array * str.split(pattern=nil, [limit]) {|sub| block } -> str * * Divides str into substrings based on a delimiter, returning an array * of these substrings. * * If pattern is a String, then its contents are used as * the delimiter when splitting str. If pattern is a single * space, str is split on whitespace, with leading and trailing * whitespace and runs of contiguous whitespace characters ignored. * * If pattern is a Regexp, str is divided where the * pattern matches. Whenever the pattern matches a zero-length string, * str is split into individual characters. If pattern contains * groups, the respective matches will be returned in the array as well. * * If pattern is nil, the value of $; is used. * If $; is nil (which is the default), str is * split on whitespace as if ' ' were specified. * * If the limit parameter is omitted, trailing null fields are * suppressed. If limit is a positive number, at most that number * of split substrings will be returned (captured groups will be returned * as well, but are not counted towards the limit). * If limit is 1, the entire * string is returned as the only entry in an array. If negative, there is no * limit to the number of fields returned, and trailing null fields are not * suppressed. * * When the input +str+ is empty an empty Array is returned as the string is * considered to have no fields to split. * * " now's the time ".split #=> ["now's", "the", "time"] * " now's the time ".split(' ') #=> ["now's", "the", "time"] * " now's the time".split(/ /) #=> ["", "now's", "", "the", "time"] * "1, 2.34,56, 7".split(%r{,\s*}) #=> ["1", "2.34", "56", "7"] * "hello".split(//) #=> ["h", "e", "l", "l", "o"] * "hello".split(//, 3) #=> ["h", "e", "llo"] * "hi mom".split(%r{\s*}) #=> ["h", "i", "m", "o", "m"] * * "mellow yellow".split("ello") #=> ["m", "w y", "w"] * "1,2,,3,4,,".split(',') #=> ["1", "2", "", "3", "4"] * "1,2,,3,4,,".split(',', 4) #=> ["1", "2", "", "3,4,,"] * "1,2,,3,4,,".split(',', -4) #=> ["1", "2", "", "3", "4", "", ""] * * "1:2:3".split(/(:)()()/, 2) #=> ["1", ":", "", "", "2:3"] * * "".split(',', -1) #=> [] * * If a block is given, invoke the block with each split substring. * */ static VALUE rb_str_split_m(int argc, VALUE *argv, VALUE str) { rb_encoding *enc; VALUE spat; VALUE limit; enum {awk, string, regexp, chars} split_type; long beg, end, i = 0, empty_count = -1; int lim = 0; VALUE result, tmp; result = rb_block_given_p() ? Qfalse : Qnil; if (rb_scan_args(argc, argv, "02", &spat, &limit) == 2) { lim = NUM2INT(limit); if (lim <= 0) limit = Qnil; else if (lim == 1) { if (RSTRING_LEN(str) == 0) return result ? rb_ary_new2(0) : str; tmp = rb_str_dup(str); if (!result) { rb_yield(tmp); return str; } return rb_ary_new3(1, tmp); } i = 1; } if (NIL_P(limit) && !lim) empty_count = 0; enc = STR_ENC_GET(str); split_type = regexp; if (!NIL_P(spat)) { spat = get_pat_quoted(spat, 0); } else if (NIL_P(spat = rb_fs)) { split_type = awk; } else if (!(spat = rb_fs_check(spat))) { rb_raise(rb_eTypeError, "value of $; must be String or Regexp"); } else { rb_warn("$; is set to non-nil value"); } if (split_type != awk) { if (BUILTIN_TYPE(spat) == T_STRING) { rb_encoding *enc2 = STR_ENC_GET(spat); mustnot_broken(spat); split_type = string; if (RSTRING_LEN(spat) == 0) { /* Special case - split into chars */ split_type = chars; } else if (rb_enc_asciicompat(enc2) == 1) { if (RSTRING_LEN(spat) == 1 && RSTRING_PTR(spat)[0] == ' ') { split_type = awk; } } else { int l; if (rb_enc_ascget(RSTRING_PTR(spat), RSTRING_END(spat), &l, enc2) == ' ' && RSTRING_LEN(spat) == l) { split_type = awk; } } } } #define SPLIT_STR(beg, len) (empty_count = split_string(result, str, beg, len, empty_count)) if (result) result = rb_ary_new(); beg = 0; char *ptr = RSTRING_PTR(str); char *eptr = RSTRING_END(str); if (split_type == awk) { char *bptr = ptr; int skip = 1; unsigned int c; end = beg; if (is_ascii_string(str)) { while (ptr < eptr) { c = (unsigned char)*ptr++; if (skip) { if (ascii_isspace(c)) { beg = ptr - bptr; } else { end = ptr - bptr; skip = 0; if (!NIL_P(limit) && lim <= i) break; } } else if (ascii_isspace(c)) { SPLIT_STR(beg, end-beg); skip = 1; beg = ptr - bptr; if (!NIL_P(limit)) ++i; } else { end = ptr - bptr; } } } else { while (ptr < eptr) { int n; c = rb_enc_codepoint_len(ptr, eptr, &n, enc); ptr += n; if (skip) { if (rb_isspace(c)) { beg = ptr - bptr; } else { end = ptr - bptr; skip = 0; if (!NIL_P(limit) && lim <= i) break; } } else if (rb_isspace(c)) { SPLIT_STR(beg, end-beg); skip = 1; beg = ptr - bptr; if (!NIL_P(limit)) ++i; } else { end = ptr - bptr; } } } } else if (split_type == string) { char *str_start = ptr; char *substr_start = ptr; char *sptr = RSTRING_PTR(spat); long slen = RSTRING_LEN(spat); mustnot_broken(str); enc = rb_enc_check(str, spat); while (ptr < eptr && (end = rb_memsearch(sptr, slen, ptr, eptr - ptr, enc)) >= 0) { /* Check we are at the start of a char */ char *t = rb_enc_right_char_head(ptr, ptr + end, eptr, enc); if (t != ptr + end) { ptr = t; continue; } SPLIT_STR(substr_start - str_start, (ptr+end) - substr_start); ptr += end + slen; substr_start = ptr; if (!NIL_P(limit) && lim <= ++i) break; } beg = ptr - str_start; } else if (split_type == chars) { char *str_start = ptr; int n; mustnot_broken(str); enc = rb_enc_get(str); while (ptr < eptr && (n = rb_enc_precise_mbclen(ptr, eptr, enc)) > 0) { SPLIT_STR(ptr - str_start, n); ptr += n; if (!NIL_P(limit) && lim <= ++i) break; } beg = ptr - str_start; } else { long len = RSTRING_LEN(str); long start = beg; long idx; int last_null = 0; struct re_registers *regs; VALUE match = 0; for (; (end = rb_reg_search(spat, str, start, 0)) >= 0; (match ? (rb_match_unbusy(match), rb_backref_set(match)) : (void)0)) { match = rb_backref_get(); if (!result) rb_match_busy(match); regs = RMATCH_REGS(match); if (start == end && BEG(0) == END(0)) { if (!ptr) { SPLIT_STR(0, 0); break; } else if (last_null == 1) { SPLIT_STR(beg, rb_enc_fast_mbclen(ptr+beg, eptr, enc)); beg = start; } else { if (start == len) start++; else start += rb_enc_fast_mbclen(ptr+start,eptr,enc); last_null = 1; continue; } } else { SPLIT_STR(beg, end-beg); beg = start = END(0); } last_null = 0; for (idx=1; idx < regs->num_regs; idx++) { if (BEG(idx) == -1) continue; SPLIT_STR(BEG(idx), END(idx)-BEG(idx)); } if (!NIL_P(limit) && lim <= ++i) break; } if (match) rb_match_unbusy(match); } if (RSTRING_LEN(str) > 0 && (!NIL_P(limit) || RSTRING_LEN(str) > beg || lim < 0)) { SPLIT_STR(beg, RSTRING_LEN(str)-beg); } return result ? result : str; } VALUE rb_str_split(VALUE str, const char *sep0) { VALUE sep; StringValue(str); sep = rb_str_new_cstr(sep0); return rb_str_split_m(1, &sep, str); } #define WANTARRAY(m, size) (!rb_block_given_p() ? rb_ary_new_capa(size) : 0) static inline int enumerator_element(VALUE ary, VALUE e) { if (ary) { rb_ary_push(ary, e); return 0; } else { rb_yield(e); return 1; } } #define ENUM_ELEM(ary, e) enumerator_element(ary, e) static const char * chomp_newline(const char *p, const char *e, rb_encoding *enc) { const char *prev = rb_enc_prev_char(p, e, e, enc); if (rb_enc_is_newline(prev, e, enc)) { e = prev; prev = rb_enc_prev_char(p, e, e, enc); if (prev && rb_enc_ascget(prev, e, NULL, enc) == '\r') e = prev; } return e; } static VALUE rb_str_enumerate_lines(int argc, VALUE *argv, VALUE str, VALUE ary) { rb_encoding *enc; VALUE line, rs, orig = str, opts = Qnil, chomp = Qfalse; const char *ptr, *pend, *subptr, *subend, *rsptr, *hit, *adjusted; long pos, len, rslen; int rsnewline = 0; if (rb_scan_args(argc, argv, "01:", &rs, &opts) == 0) rs = rb_rs; if (!NIL_P(opts)) { static ID keywords[1]; if (!keywords[0]) { keywords[0] = rb_intern_const("chomp"); } rb_get_kwargs(opts, keywords, 0, 1, &chomp); chomp = (chomp != Qundef && RTEST(chomp)); } if (NIL_P(rs)) { if (!ENUM_ELEM(ary, str)) { return ary; } else { return orig; } } if (!RSTRING_LEN(str)) goto end; str = rb_str_new_frozen(str); ptr = subptr = RSTRING_PTR(str); pend = RSTRING_END(str); len = RSTRING_LEN(str); StringValue(rs); rslen = RSTRING_LEN(rs); if (rs == rb_default_rs) enc = rb_enc_get(str); else enc = rb_enc_check(str, rs); if (rslen == 0) { /* paragraph mode */ int n; const char *eol = NULL; subend = subptr; while (subend < pend) { do { if (rb_enc_ascget(subend, pend, &n, enc) != '\r') n = 0; rslen = n + rb_enc_mbclen(subend + n, pend, enc); if (rb_enc_is_newline(subend + n, pend, enc)) { if (eol == subend) break; subend += rslen; if (subptr) eol = subend; } else { if (!subptr) subptr = subend; subend += rslen; } rslen = 0; } while (subend < pend); if (!subptr) break; line = rb_str_subseq(str, subptr - ptr, subend - subptr + (chomp ? 0 : rslen)); if (ENUM_ELEM(ary, line)) { str_mod_check(str, ptr, len); } subptr = eol = NULL; } goto end; } else { rsptr = RSTRING_PTR(rs); if (RSTRING_LEN(rs) == rb_enc_mbminlen(enc) && rb_enc_is_newline(rsptr, rsptr + RSTRING_LEN(rs), enc)) { rsnewline = 1; } } if ((rs == rb_default_rs) && !rb_enc_asciicompat(enc)) { rs = rb_str_new(rsptr, rslen); rs = rb_str_encode(rs, rb_enc_from_encoding(enc), 0, Qnil); rsptr = RSTRING_PTR(rs); rslen = RSTRING_LEN(rs); } while (subptr < pend) { pos = rb_memsearch(rsptr, rslen, subptr, pend - subptr, enc); if (pos < 0) break; hit = subptr + pos; adjusted = rb_enc_right_char_head(subptr, hit, pend, enc); if (hit != adjusted) { subptr = adjusted; continue; } subend = hit += rslen; if (chomp) { if (rsnewline) { subend = chomp_newline(subptr, subend, enc); } else { subend -= rslen; } } line = rb_str_subseq(str, subptr - ptr, subend - subptr); if (ENUM_ELEM(ary, line)) { str_mod_check(str, ptr, len); } subptr = hit; } if (subptr != pend) { if (chomp) { if (rsnewline) { pend = chomp_newline(subptr, pend, enc); } else if (pend - subptr >= rslen && memcmp(pend - rslen, rsptr, rslen) == 0) { pend -= rslen; } } line = rb_str_subseq(str, subptr - ptr, pend - subptr); ENUM_ELEM(ary, line); RB_GC_GUARD(str); } end: if (ary) return ary; else return orig; } /* * call-seq: * str.each_line(separator=$/, chomp: false) {|substr| block } -> str * str.each_line(separator=$/, chomp: false) -> an_enumerator * * Splits str using the supplied parameter as the record * separator ($/ by default), passing each substring in * turn to the supplied block. If a zero-length record separator is * supplied, the string is split into paragraphs delimited by * multiple successive newlines. * * If +chomp+ is +true+, +separator+ will be removed from the end of each * line. * * If no block is given, an enumerator is returned instead. * * "hello\nworld".each_line {|s| p s} * # prints: * # "hello\n" * # "world" * * "hello\nworld".each_line('l') {|s| p s} * # prints: * # "hel" * # "l" * # "o\nworl" * # "d" * * "hello\n\n\nworld".each_line('') {|s| p s} * # prints * # "hello\n\n" * # "world" * * "hello\nworld".each_line(chomp: true) {|s| p s} * # prints: * # "hello" * # "world" * * "hello\nworld".each_line('l', chomp: true) {|s| p s} * # prints: * # "he" * # "" * # "o\nwor" * # "d" * */ static VALUE rb_str_each_line(int argc, VALUE *argv, VALUE str) { RETURN_SIZED_ENUMERATOR(str, argc, argv, 0); return rb_str_enumerate_lines(argc, argv, str, 0); } /* * call-seq: * str.lines(separator=$/, chomp: false) -> an_array * * Returns an array of lines in str split using the supplied * record separator ($/ by default). This is a * shorthand for str.each_line(separator, getline_args).to_a. * * If +chomp+ is +true+, +separator+ will be removed from the end of each * line. * * "hello\nworld\n".lines #=> ["hello\n", "world\n"] * "hello world".lines(' ') #=> ["hello ", " ", "world"] * "hello\nworld\n".lines(chomp: true) #=> ["hello", "world"] * * If a block is given, which is a deprecated form, works the same as * each_line. */ static VALUE rb_str_lines(int argc, VALUE *argv, VALUE str) { VALUE ary = WANTARRAY("lines", 0); return rb_str_enumerate_lines(argc, argv, str, ary); } static VALUE rb_str_each_byte_size(VALUE str, VALUE args, VALUE eobj) { return LONG2FIX(RSTRING_LEN(str)); } static VALUE rb_str_enumerate_bytes(VALUE str, VALUE ary) { long i; for (i=0; i str * str.each_byte -> an_enumerator * * Passes each byte in str to the given block, or returns an * enumerator if no block is given. * * "hello".each_byte {|c| print c, ' ' } * * produces: * * 104 101 108 108 111 */ static VALUE rb_str_each_byte(VALUE str) { RETURN_SIZED_ENUMERATOR(str, 0, 0, rb_str_each_byte_size); return rb_str_enumerate_bytes(str, 0); } /* * call-seq: * str.bytes -> an_array * * Returns an array of bytes in str. This is a shorthand for * str.each_byte.to_a. * * If a block is given, which is a deprecated form, works the same as * each_byte. */ static VALUE rb_str_bytes(VALUE str) { VALUE ary = WANTARRAY("bytes", RSTRING_LEN(str)); return rb_str_enumerate_bytes(str, ary); } static VALUE rb_str_each_char_size(VALUE str, VALUE args, VALUE eobj) { return rb_str_length(str); } static VALUE rb_str_enumerate_chars(VALUE str, VALUE ary) { VALUE orig = str; long i, len, n; const char *ptr; rb_encoding *enc; str = rb_str_new_frozen(str); ptr = RSTRING_PTR(str); len = RSTRING_LEN(str); enc = rb_enc_get(str); if (ENC_CODERANGE_CLEAN_P(ENC_CODERANGE(str))) { for (i = 0; i < len; i += n) { n = rb_enc_fast_mbclen(ptr + i, ptr + len, enc); ENUM_ELEM(ary, rb_str_subseq(str, i, n)); } } else { for (i = 0; i < len; i += n) { n = rb_enc_mbclen(ptr + i, ptr + len, enc); ENUM_ELEM(ary, rb_str_subseq(str, i, n)); } } RB_GC_GUARD(str); if (ary) return ary; else return orig; } /* * call-seq: * str.each_char {|cstr| block } -> str * str.each_char -> an_enumerator * * Passes each character in str to the given block, or returns * an enumerator if no block is given. * * "hello".each_char {|c| print c, ' ' } * * produces: * * h e l l o */ static VALUE rb_str_each_char(VALUE str) { RETURN_SIZED_ENUMERATOR(str, 0, 0, rb_str_each_char_size); return rb_str_enumerate_chars(str, 0); } /* * call-seq: * str.chars -> an_array * * Returns an array of characters in str. This is a shorthand * for str.each_char.to_a. * * If a block is given, which is a deprecated form, works the same as * each_char. */ static VALUE rb_str_chars(VALUE str) { VALUE ary = WANTARRAY("chars", rb_str_strlen(str)); return rb_str_enumerate_chars(str, ary); } static VALUE rb_str_enumerate_codepoints(VALUE str, VALUE ary) { VALUE orig = str; int n; unsigned int c; const char *ptr, *end; rb_encoding *enc; if (single_byte_optimizable(str)) return rb_str_enumerate_bytes(str, ary); str = rb_str_new_frozen(str); ptr = RSTRING_PTR(str); end = RSTRING_END(str); enc = STR_ENC_GET(str); while (ptr < end) { c = rb_enc_codepoint_len(ptr, end, &n, enc); ENUM_ELEM(ary, UINT2NUM(c)); ptr += n; } RB_GC_GUARD(str); if (ary) return ary; else return orig; } /* * call-seq: * str.each_codepoint {|integer| block } -> str * str.each_codepoint -> an_enumerator * * Passes the Integer ordinal of each character in str, * also known as a codepoint when applied to Unicode strings to the * given block. For encodings other than UTF-8/UTF-16(BE|LE)/UTF-32(BE|LE), * values are directly derived from the binary representation * of each character. * * If no block is given, an enumerator is returned instead. * * "hello\u0639".each_codepoint {|c| print c, ' ' } * * produces: * * 104 101 108 108 111 1593 */ static VALUE rb_str_each_codepoint(VALUE str) { RETURN_SIZED_ENUMERATOR(str, 0, 0, rb_str_each_char_size); return rb_str_enumerate_codepoints(str, 0); } /* * call-seq: * str.codepoints -> an_array * * Returns an array of the Integer ordinals of the * characters in str. This is a shorthand for * str.each_codepoint.to_a. * * If a block is given, which is a deprecated form, works the same as * each_codepoint. */ static VALUE rb_str_codepoints(VALUE str) { VALUE ary = WANTARRAY("codepoints", rb_str_strlen(str)); return rb_str_enumerate_codepoints(str, ary); } static regex_t * get_reg_grapheme_cluster(rb_encoding *enc) { int encidx = rb_enc_to_index(enc); regex_t *reg_grapheme_cluster = NULL; static regex_t *reg_grapheme_cluster_utf8 = NULL; /* synchronize */ if (encidx == rb_utf8_encindex() && reg_grapheme_cluster_utf8) { reg_grapheme_cluster = reg_grapheme_cluster_utf8; } if (!reg_grapheme_cluster) { const OnigUChar source_ascii[] = "\\X"; OnigErrorInfo einfo; const OnigUChar *source = source_ascii; size_t source_len = sizeof(source_ascii) - 1; switch (encidx) { #define CHARS_16BE(x) (OnigUChar)((x)>>8), (OnigUChar)(x) #define CHARS_16LE(x) (OnigUChar)(x), (OnigUChar)((x)>>8) #define CHARS_32BE(x) CHARS_16BE((x)>>16), CHARS_16BE(x) #define CHARS_32LE(x) CHARS_16LE(x), CHARS_16LE((x)>>16) #define CASE_UTF(e) \ case ENCINDEX_UTF_##e: { \ static const OnigUChar source_UTF_##e[] = {CHARS_##e('\\'), CHARS_##e('X')}; \ source = source_UTF_##e; \ source_len = sizeof(source_UTF_##e); \ break; \ } CASE_UTF(16BE); CASE_UTF(16LE); CASE_UTF(32BE); CASE_UTF(32LE); #undef CASE_UTF #undef CHARS_16BE #undef CHARS_16LE #undef CHARS_32BE #undef CHARS_32LE } int r = onig_new(®_grapheme_cluster, source, source + source_len, ONIG_OPTION_DEFAULT, enc, OnigDefaultSyntax, &einfo); if (r) { UChar message[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str(message, r, &einfo); rb_fatal("cannot compile grapheme cluster regexp: %s", (char *)message); } if (encidx == rb_utf8_encindex()) { reg_grapheme_cluster_utf8 = reg_grapheme_cluster; } } return reg_grapheme_cluster; } static VALUE rb_str_each_grapheme_cluster_size(VALUE str, VALUE args, VALUE eobj) { size_t grapheme_cluster_count = 0; regex_t *reg_grapheme_cluster = NULL; rb_encoding *enc = rb_enc_from_index(ENCODING_GET(str)); const char *ptr, *end; if (!rb_enc_unicode_p(enc)) { return rb_str_length(str); } reg_grapheme_cluster = get_reg_grapheme_cluster(enc); ptr = RSTRING_PTR(str); end = RSTRING_END(str); while (ptr < end) { OnigPosition len = onig_match(reg_grapheme_cluster, (const OnigUChar *)ptr, (const OnigUChar *)end, (const OnigUChar *)ptr, NULL, 0); if (len <= 0) break; grapheme_cluster_count++; ptr += len; } return SIZET2NUM(grapheme_cluster_count); } static VALUE rb_str_enumerate_grapheme_clusters(VALUE str, VALUE ary) { VALUE orig = str; regex_t *reg_grapheme_cluster = NULL; rb_encoding *enc = rb_enc_from_index(ENCODING_GET(str)); const char *ptr0, *ptr, *end; if (!rb_enc_unicode_p(enc)) { return rb_str_enumerate_chars(str, ary); } if (!ary) str = rb_str_new_frozen(str); reg_grapheme_cluster = get_reg_grapheme_cluster(enc); ptr0 = ptr = RSTRING_PTR(str); end = RSTRING_END(str); while (ptr < end) { OnigPosition len = onig_match(reg_grapheme_cluster, (const OnigUChar *)ptr, (const OnigUChar *)end, (const OnigUChar *)ptr, NULL, 0); if (len <= 0) break; ENUM_ELEM(ary, rb_str_subseq(str, ptr-ptr0, len)); ptr += len; } RB_GC_GUARD(str); if (ary) return ary; else return orig; } /* * call-seq: * str.each_grapheme_cluster {|cstr| block } -> str * str.each_grapheme_cluster -> an_enumerator * * Passes each grapheme cluster in str to the given block, or returns * an enumerator if no block is given. * Unlike String#each_char, this enumerates by grapheme clusters defined by * Unicode Standard Annex #29 http://unicode.org/reports/tr29/ * * "a\u0300".each_char.to_a.size #=> 2 * "a\u0300".each_grapheme_cluster.to_a.size #=> 1 * */ static VALUE rb_str_each_grapheme_cluster(VALUE str) { RETURN_SIZED_ENUMERATOR(str, 0, 0, rb_str_each_grapheme_cluster_size); return rb_str_enumerate_grapheme_clusters(str, 0); } /* * call-seq: * str.grapheme_clusters -> an_array * * Returns an array of grapheme clusters in str. This is a shorthand * for str.each_grapheme_cluster.to_a. * * If a block is given, which is a deprecated form, works the same as * each_grapheme_cluster. */ static VALUE rb_str_grapheme_clusters(VALUE str) { VALUE ary = WANTARRAY("grapheme_clusters", rb_str_strlen(str)); return rb_str_enumerate_grapheme_clusters(str, ary); } static long chopped_length(VALUE str) { rb_encoding *enc = STR_ENC_GET(str); const char *p, *p2, *beg, *end; beg = RSTRING_PTR(str); end = beg + RSTRING_LEN(str); if (beg >= end) return 0; p = rb_enc_prev_char(beg, end, end, enc); if (!p) return 0; if (p > beg && rb_enc_ascget(p, end, 0, enc) == '\n') { p2 = rb_enc_prev_char(beg, p, end, enc); if (p2 && rb_enc_ascget(p2, end, 0, enc) == '\r') p = p2; } return p - beg; } /* * call-seq: * str.chop! -> str or nil * * Processes str as for String#chop, returning str, or * nil if str is the empty string. See also * String#chomp!. */ static VALUE rb_str_chop_bang(VALUE str) { str_modify_keep_cr(str); if (RSTRING_LEN(str) > 0) { long len; len = chopped_length(str); STR_SET_LEN(str, len); TERM_FILL(&RSTRING_PTR(str)[len], TERM_LEN(str)); if (ENC_CODERANGE(str) != ENC_CODERANGE_7BIT) { ENC_CODERANGE_CLEAR(str); } return str; } return Qnil; } /* * call-seq: * str.chop -> new_str * * Returns a new String with the last character removed. If the * string ends with \r\n, both characters are * removed. Applying chop to an empty string returns an * empty string. String#chomp is often a safer alternative, as it * leaves the string unchanged if it doesn't end in a record * separator. * * "string\r\n".chop #=> "string" * "string\n\r".chop #=> "string\n" * "string\n".chop #=> "string" * "string".chop #=> "strin" * "x".chop.chop #=> "" */ static VALUE rb_str_chop(VALUE str) { return rb_str_subseq(str, 0, chopped_length(str)); } static long chompped_length(VALUE str, VALUE rs) { rb_encoding *enc; int newline; char *pp, *e, *rsptr; long rslen; char *const p = RSTRING_PTR(str); long len = RSTRING_LEN(str); if (len == 0) return 0; e = p + len; if (rs == rb_default_rs) { smart_chomp: enc = rb_enc_get(str); if (rb_enc_mbminlen(enc) > 1) { pp = rb_enc_left_char_head(p, e-rb_enc_mbminlen(enc), e, enc); if (rb_enc_is_newline(pp, e, enc)) { e = pp; } pp = e - rb_enc_mbminlen(enc); if (pp >= p) { pp = rb_enc_left_char_head(p, pp, e, enc); if (rb_enc_ascget(pp, e, 0, enc) == '\r') { e = pp; } } } else { switch (*(e-1)) { /* not e[-1] to get rid of VC bug */ case '\n': if (--e > p && *(e-1) == '\r') { --e; } break; case '\r': --e; break; } } return e - p; } enc = rb_enc_get(str); RSTRING_GETMEM(rs, rsptr, rslen); if (rslen == 0) { if (rb_enc_mbminlen(enc) > 1) { while (e > p) { pp = rb_enc_left_char_head(p, e-rb_enc_mbminlen(enc), e, enc); if (!rb_enc_is_newline(pp, e, enc)) break; e = pp; pp -= rb_enc_mbminlen(enc); if (pp >= p) { pp = rb_enc_left_char_head(p, pp, e, enc); if (rb_enc_ascget(pp, e, 0, enc) == '\r') { e = pp; } } } } else { while (e > p && *(e-1) == '\n') { --e; if (e > p && *(e-1) == '\r') --e; } } return e - p; } if (rslen > len) return len; enc = rb_enc_get(rs); newline = rsptr[rslen-1]; if (rslen == rb_enc_mbminlen(enc)) { if (rslen == 1) { if (newline == '\n') goto smart_chomp; } else { if (rb_enc_is_newline(rsptr, rsptr+rslen, enc)) goto smart_chomp; } } enc = rb_enc_check(str, rs); if (is_broken_string(rs)) { return len; } pp = e - rslen; if (p[len-1] == newline && (rslen <= 1 || memcmp(rsptr, pp, rslen) == 0)) { if (rb_enc_left_char_head(p, pp, e, enc) == pp) return len - rslen; RB_GC_GUARD(rs); } return len; } /*! * Returns the separator for arguments of rb_str_chomp. * * @return returns rb_ps ($/) as default, the default value of rb_ps ($/) is "\n". */ static VALUE chomp_rs(int argc, const VALUE *argv) { rb_check_arity(argc, 0, 1); if (argc > 0) { VALUE rs = argv[0]; if (!NIL_P(rs)) StringValue(rs); return rs; } else { return rb_rs; } } VALUE rb_str_chomp_string(VALUE str, VALUE rs) { long olen = RSTRING_LEN(str); long len = chompped_length(str, rs); if (len >= olen) return Qnil; str_modify_keep_cr(str); STR_SET_LEN(str, len); TERM_FILL(&RSTRING_PTR(str)[len], TERM_LEN(str)); if (ENC_CODERANGE(str) != ENC_CODERANGE_7BIT) { ENC_CODERANGE_CLEAR(str); } return str; } /* * call-seq: * str.chomp!(separator=$/) -> str or nil * * Modifies str in place as described for String#chomp, * returning str, or nil if no modifications were * made. */ static VALUE rb_str_chomp_bang(int argc, VALUE *argv, VALUE str) { VALUE rs; str_modifiable(str); if (RSTRING_LEN(str) == 0) return Qnil; rs = chomp_rs(argc, argv); if (NIL_P(rs)) return Qnil; return rb_str_chomp_string(str, rs); } /* * call-seq: * str.chomp(separator=$/) -> new_str * * Returns a new String with the given record separator removed * from the end of str (if present). If $/ has not been * changed from the default Ruby record separator, then chomp also * removes carriage return characters (that is it will remove \n, * \r, and \r\n). If $/ is an empty string, * it will remove all trailing newlines from the string. * * "hello".chomp #=> "hello" * "hello\n".chomp #=> "hello" * "hello\r\n".chomp #=> "hello" * "hello\n\r".chomp #=> "hello\n" * "hello\r".chomp #=> "hello" * "hello \n there".chomp #=> "hello \n there" * "hello".chomp("llo") #=> "he" * "hello\r\n\r\n".chomp('') #=> "hello" * "hello\r\n\r\r\n".chomp('') #=> "hello\r\n\r" */ static VALUE rb_str_chomp(int argc, VALUE *argv, VALUE str) { VALUE rs = chomp_rs(argc, argv); if (NIL_P(rs)) return rb_str_dup(str); return rb_str_subseq(str, 0, chompped_length(str, rs)); } static long lstrip_offset(VALUE str, const char *s, const char *e, rb_encoding *enc) { const char *const start = s; if (!s || s >= e) return 0; /* remove spaces at head */ if (single_byte_optimizable(str)) { while (s < e && ascii_isspace(*s)) s++; } else { while (s < e) { int n; unsigned int cc = rb_enc_codepoint_len(s, e, &n, enc); if (!rb_isspace(cc)) break; s += n; } } return s - start; } /* * call-seq: * str.lstrip! -> self or nil * * Removes leading whitespace from the receiver. * Returns the altered receiver, or +nil+ if no change was made. * See also String#rstrip! and String#strip!. * * Refer to String#strip for the definition of whitespace. * * " hello ".lstrip! #=> "hello " * "hello ".lstrip! #=> nil * "hello".lstrip! #=> nil */ static VALUE rb_str_lstrip_bang(VALUE str) { rb_encoding *enc; char *start, *s; long olen, loffset; str_modify_keep_cr(str); enc = STR_ENC_GET(str); RSTRING_GETMEM(str, start, olen); loffset = lstrip_offset(str, start, start+olen, enc); if (loffset > 0) { long len = olen-loffset; s = start + loffset; memmove(start, s, len); STR_SET_LEN(str, len); #if !SHARABLE_MIDDLE_SUBSTRING TERM_FILL(start+len, rb_enc_mbminlen(enc)); #endif return str; } return Qnil; } /* * call-seq: * str.lstrip -> new_str * * Returns a copy of the receiver with leading whitespace removed. * See also String#rstrip and String#strip. * * Refer to String#strip for the definition of whitespace. * * " hello ".lstrip #=> "hello " * "hello".lstrip #=> "hello" */ static VALUE rb_str_lstrip(VALUE str) { char *start; long len, loffset; RSTRING_GETMEM(str, start, len); loffset = lstrip_offset(str, start, start+len, STR_ENC_GET(str)); if (loffset <= 0) return rb_str_dup(str); return rb_str_subseq(str, loffset, len - loffset); } static long rstrip_offset(VALUE str, const char *s, const char *e, rb_encoding *enc) { const char *t; rb_str_check_dummy_enc(enc); if (!s || s >= e) return 0; t = e; /* remove trailing spaces or '\0's */ if (single_byte_optimizable(str)) { unsigned char c; while (s < t && ((c = *(t-1)) == '\0' || ascii_isspace(c))) t--; } else { char *tp; while ((tp = rb_enc_prev_char(s, t, e, enc)) != NULL) { unsigned int c = rb_enc_codepoint(tp, e, enc); if (c && !rb_isspace(c)) break; t = tp; } } return e - t; } /* * call-seq: * str.rstrip! -> self or nil * * Removes trailing whitespace from the receiver. * Returns the altered receiver, or +nil+ if no change was made. * See also String#lstrip! and String#strip!. * * Refer to String#strip for the definition of whitespace. * * " hello ".rstrip! #=> " hello" * " hello".rstrip! #=> nil * "hello".rstrip! #=> nil */ static VALUE rb_str_rstrip_bang(VALUE str) { rb_encoding *enc; char *start; long olen, roffset; str_modify_keep_cr(str); enc = STR_ENC_GET(str); RSTRING_GETMEM(str, start, olen); roffset = rstrip_offset(str, start, start+olen, enc); if (roffset > 0) { long len = olen - roffset; STR_SET_LEN(str, len); #if !SHARABLE_MIDDLE_SUBSTRING TERM_FILL(start+len, rb_enc_mbminlen(enc)); #endif return str; } return Qnil; } /* * call-seq: * str.rstrip -> new_str * * Returns a copy of the receiver with trailing whitespace removed. * See also String#lstrip and String#strip. * * Refer to String#strip for the definition of whitespace. * * " hello ".rstrip #=> " hello" * "hello".rstrip #=> "hello" */ static VALUE rb_str_rstrip(VALUE str) { rb_encoding *enc; char *start; long olen, roffset; enc = STR_ENC_GET(str); RSTRING_GETMEM(str, start, olen); roffset = rstrip_offset(str, start, start+olen, enc); if (roffset <= 0) return rb_str_dup(str); return rb_str_subseq(str, 0, olen-roffset); } /* * call-seq: * str.strip! -> self or nil * * Removes leading and trailing whitespace from the receiver. * Returns the altered receiver, or +nil+ if there was no change. * * Refer to String#strip for the definition of whitespace. * * " hello ".strip! #=> "hello" * "hello".strip! #=> nil */ static VALUE rb_str_strip_bang(VALUE str) { char *start; long olen, loffset, roffset; rb_encoding *enc; str_modify_keep_cr(str); enc = STR_ENC_GET(str); RSTRING_GETMEM(str, start, olen); loffset = lstrip_offset(str, start, start+olen, enc); roffset = rstrip_offset(str, start+loffset, start+olen, enc); if (loffset > 0 || roffset > 0) { long len = olen-roffset; if (loffset > 0) { len -= loffset; memmove(start, start + loffset, len); } STR_SET_LEN(str, len); #if !SHARABLE_MIDDLE_SUBSTRING TERM_FILL(start+len, rb_enc_mbminlen(enc)); #endif return str; } return Qnil; } /* * call-seq: * str.strip -> new_str * * Returns a copy of the receiver with leading and trailing whitespace removed. * * Whitespace is defined as any of the following characters: * null, horizontal tab, line feed, vertical tab, form feed, carriage return, space. * * " hello ".strip #=> "hello" * "\tgoodbye\r\n".strip #=> "goodbye" * "\x00\t\n\v\f\r ".strip #=> "" * "hello".strip #=> "hello" */ static VALUE rb_str_strip(VALUE str) { char *start; long olen, loffset, roffset; rb_encoding *enc = STR_ENC_GET(str); RSTRING_GETMEM(str, start, olen); loffset = lstrip_offset(str, start, start+olen, enc); roffset = rstrip_offset(str, start+loffset, start+olen, enc); if (loffset <= 0 && roffset <= 0) return rb_str_dup(str); return rb_str_subseq(str, loffset, olen-loffset-roffset); } static VALUE scan_once(VALUE str, VALUE pat, long *start, int set_backref_str) { VALUE result, match; struct re_registers *regs; int i; long end, pos = rb_pat_search(pat, str, *start, set_backref_str); if (pos >= 0) { if (BUILTIN_TYPE(pat) == T_STRING) { regs = NULL; end = pos + RSTRING_LEN(pat); } else { match = rb_backref_get(); regs = RMATCH_REGS(match); pos = BEG(0); end = END(0); } if (pos == end) { rb_encoding *enc = STR_ENC_GET(str); /* * Always consume at least one character of the input string */ if (RSTRING_LEN(str) > end) *start = end + rb_enc_fast_mbclen(RSTRING_PTR(str) + end, RSTRING_END(str), enc); else *start = end + 1; } else { *start = end; } if (!regs || regs->num_regs == 1) { result = rb_str_subseq(str, pos, end - pos); OBJ_INFECT(result, pat); return result; } result = rb_ary_new2(regs->num_regs); for (i=1; i < regs->num_regs; i++) { VALUE s = Qnil; if (BEG(i) >= 0) { s = rb_str_subseq(str, BEG(i), END(i)-BEG(i)); OBJ_INFECT(s, pat); } rb_ary_push(result, s); } return result; } return Qnil; } /* * call-seq: * str.scan(pattern) -> array * str.scan(pattern) {|match, ...| block } -> str * * Both forms iterate through str, matching the pattern (which may be a * Regexp or a String). For each match, a result is * generated and either added to the result array or passed to the block. If * the pattern contains no groups, each individual result consists of the * matched string, $&. If the pattern contains groups, each * individual result is itself an array containing one entry per group. * * a = "cruel world" * a.scan(/\w+/) #=> ["cruel", "world"] * a.scan(/.../) #=> ["cru", "el ", "wor"] * a.scan(/(...)/) #=> [["cru"], ["el "], ["wor"]] * a.scan(/(..)(..)/) #=> [["cr", "ue"], ["l ", "wo"]] * * And the block form: * * a.scan(/\w+/) {|w| print "<<#{w}>> " } * print "\n" * a.scan(/(.)(.)/) {|x,y| print y, x } * print "\n" * * produces: * * <> <> * rceu lowlr */ static VALUE rb_str_scan(VALUE str, VALUE pat) { VALUE result; long start = 0; long last = -1, prev = 0; char *p = RSTRING_PTR(str); long len = RSTRING_LEN(str); pat = get_pat_quoted(pat, 1); mustnot_broken(str); if (!rb_block_given_p()) { VALUE ary = rb_ary_new(); while (!NIL_P(result = scan_once(str, pat, &start, 0))) { last = prev; prev = start; rb_ary_push(ary, result); } if (last >= 0) rb_pat_search(pat, str, last, 1); else rb_backref_set(Qnil); return ary; } while (!NIL_P(result = scan_once(str, pat, &start, 1))) { last = prev; prev = start; rb_yield(result); str_mod_check(str, p, len); } if (last >= 0) rb_pat_search(pat, str, last, 1); return str; } /* * call-seq: * str.hex -> integer * * Treats leading characters from str as a string of hexadecimal digits * (with an optional sign and an optional 0x) and returns the * corresponding number. Zero is returned on error. * * "0x0a".hex #=> 10 * "-1234".hex #=> -4660 * "0".hex #=> 0 * "wombat".hex #=> 0 */ static VALUE rb_str_hex(VALUE str) { return rb_str_to_inum(str, 16, FALSE); } /* * call-seq: * str.oct -> integer * * Treats leading characters of str as a string of octal digits (with an * optional sign) and returns the corresponding number. Returns 0 if the * conversion fails. * * "123".oct #=> 83 * "-377".oct #=> -255 * "bad".oct #=> 0 * "0377bad".oct #=> 255 * * If +str+ starts with 0, radix indicators are honored. * See Kernel#Integer. */ static VALUE rb_str_oct(VALUE str) { return rb_str_to_inum(str, -8, FALSE); } /* * call-seq: * str.crypt(salt_str) -> new_str * * Returns the string generated by calling crypt(3) * standard library function with str and * salt_str, in this order, as its arguments. Please do * not use this method any longer. It is legacy; provided only for * backward compatibility with ruby scripts in earlier days. It is * bad to use in contemporary programs for several reasons: * * * Behaviour of C's crypt(3) depends on the OS it is * run. The generated string lacks data portability. * * * On some OSes such as Mac OS, crypt(3) never fails * (i.e. silently ends up in unexpected results). * * * On some OSes such as Mac OS, crypt(3) is not * thread safe. * * * So-called "traditional" usage of crypt(3) is very * very very weak. According to its manpage, Linux's traditional * crypt(3) output has only 2**56 variations; too * easy to brute force today. And this is the default behaviour. * * * In order to make things robust some OSes implement so-called * "modular" usage. To go through, you have to do a complex * build-up of the salt_str parameter, by hand. * Failure in generation of a proper salt string tends not to * yield any errors; typos in parameters are normally not * detectable. * * * For instance, in the following example, the second invocation * of String#crypt is wrong; it has a typo in "round=" (lacks * "s"). However the call does not fail and something unexpected * is generated. * * "foo".crypt("$5$rounds=1000$salt$") # OK, proper usage * "foo".crypt("$5$round=1000$salt$") # Typo not detected * * * Even in the "modular" mode, some hash functions are considered * archaic and no longer recommended at all; for instance module * $1$ is officially abandoned by its author: see * http://phk.freebsd.dk/sagas/md5crypt_eol.html . For another * instance module $3$ is considered completely * broken: see the manpage of FreeBSD. * * * On some OS such as Mac OS, there is no modular mode. Yet, as * written above, crypt(3) on Mac OS never fails. * This means even if you build up a proper salt string it * generates a traditional DES hash anyways, and there is no way * for you to be aware of. * * "foo".crypt("$5$rounds=1000$salt$") # => "$5fNPQMxC5j6." * * If for some reason you cannot migrate to other secure contemporary * password hashing algorithms, install the string-crypt gem and * require 'string/crypt' to continue using it. */ static VALUE rb_str_crypt(VALUE str, VALUE salt) { #ifdef HAVE_CRYPT_R VALUE databuf; struct crypt_data *data; # define CRYPT_END() ALLOCV_END(databuf) #else extern char *crypt(const char *, const char *); # define CRYPT_END() (void)0 #endif VALUE result; const char *s, *saltp; char *res; #ifdef BROKEN_CRYPT char salt_8bit_clean[3]; #endif StringValue(salt); mustnot_wchar(str); mustnot_wchar(salt); if (RSTRING_LEN(salt) < 2) { short_salt: rb_raise(rb_eArgError, "salt too short (need >=2 bytes)"); } s = StringValueCStr(str); saltp = RSTRING_PTR(salt); if (!saltp[0] || !saltp[1]) goto short_salt; #ifdef BROKEN_CRYPT if (!ISASCII((unsigned char)saltp[0]) || !ISASCII((unsigned char)saltp[1])) { salt_8bit_clean[0] = saltp[0] & 0x7f; salt_8bit_clean[1] = saltp[1] & 0x7f; salt_8bit_clean[2] = '\0'; saltp = salt_8bit_clean; } #endif #ifdef HAVE_CRYPT_R data = ALLOCV(databuf, sizeof(struct crypt_data)); # ifdef HAVE_STRUCT_CRYPT_DATA_INITIALIZED data->initialized = 0; # endif res = crypt_r(s, saltp, data); #else res = crypt(s, saltp); #endif if (!res) { int err = errno; CRYPT_END(); rb_syserr_fail(err, "crypt"); } result = rb_str_new_cstr(res); CRYPT_END(); FL_SET_RAW(result, OBJ_TAINTED_RAW(str) | OBJ_TAINTED_RAW(salt)); return result; } /* * call-seq: * str.ord -> integer * * Returns the Integer ordinal of a one-character string. * * "a".ord #=> 97 */ VALUE rb_str_ord(VALUE s) { unsigned int c; c = rb_enc_codepoint(RSTRING_PTR(s), RSTRING_END(s), STR_ENC_GET(s)); return UINT2NUM(c); } /* * call-seq: * str.sum(n=16) -> integer * * Returns a basic n-bit checksum of the characters in str, * where n is the optional Integer parameter, defaulting * to 16. The result is simply the sum of the binary value of each byte in * str modulo 2**n - 1. This is not a particularly good * checksum. */ static VALUE rb_str_sum(int argc, VALUE *argv, VALUE str) { int bits = 16; char *ptr, *p, *pend; long len; VALUE sum = INT2FIX(0); unsigned long sum0 = 0; if (rb_check_arity(argc, 0, 1) && (bits = NUM2INT(argv[0])) < 0) { bits = 0; } ptr = p = RSTRING_PTR(str); len = RSTRING_LEN(str); pend = p + len; while (p < pend) { if (FIXNUM_MAX - UCHAR_MAX < sum0) { sum = rb_funcall(sum, '+', 1, LONG2FIX(sum0)); str_mod_check(str, ptr, len); sum0 = 0; } sum0 += (unsigned char)*p; p++; } if (bits == 0) { if (sum0) { sum = rb_funcall(sum, '+', 1, LONG2FIX(sum0)); } } else { if (sum == INT2FIX(0)) { if (bits < (int)sizeof(long)*CHAR_BIT) { sum0 &= (((unsigned long)1)<= width) return rb_str_dup(str); n = width - len; llen = (jflag == 'l') ? 0 : ((jflag == 'r') ? n : n/2); rlen = n - llen; cr = ENC_CODERANGE(str); if (flen > 1) { llen2 = str_offset(f, f + flen, llen % fclen, enc, singlebyte); rlen2 = str_offset(f, f + flen, rlen % fclen, enc, singlebyte); } size = RSTRING_LEN(str); if ((len = llen / fclen + rlen / fclen) >= LONG_MAX / flen || (len *= flen) >= LONG_MAX - llen2 - rlen2 || (len += llen2 + rlen2) >= LONG_MAX - size) { rb_raise(rb_eArgError, "argument too big"); } len += size; res = str_new0(rb_obj_class(str), 0, len, termlen); p = RSTRING_PTR(res); if (flen <= 1) { memset(p, *f, llen); p += llen; } else { while (llen >= fclen) { memcpy(p,f,flen); p += flen; llen -= fclen; } if (llen > 0) { memcpy(p, f, llen2); p += llen2; } } memcpy(p, RSTRING_PTR(str), size); p += size; if (flen <= 1) { memset(p, *f, rlen); p += rlen; } else { while (rlen >= fclen) { memcpy(p,f,flen); p += flen; rlen -= fclen; } if (rlen > 0) { memcpy(p, f, rlen2); p += rlen2; } } TERM_FILL(p, termlen); STR_SET_LEN(res, p-RSTRING_PTR(res)); OBJ_INFECT_RAW(res, str); if (!NIL_P(pad)) OBJ_INFECT_RAW(res, pad); rb_enc_associate(res, enc); if (argc == 2) cr = ENC_CODERANGE_AND(cr, ENC_CODERANGE(pad)); if (cr != ENC_CODERANGE_BROKEN) ENC_CODERANGE_SET(res, cr); RB_GC_GUARD(pad); return res; } /* * call-seq: * str.ljust(integer, padstr=' ') -> new_str * * If integer is greater than the length of str, returns a new * String of length integer with str left justified * and padded with padstr; otherwise, returns str. * * "hello".ljust(4) #=> "hello" * "hello".ljust(20) #=> "hello " * "hello".ljust(20, '1234') #=> "hello123412341234123" */ static VALUE rb_str_ljust(int argc, VALUE *argv, VALUE str) { return rb_str_justify(argc, argv, str, 'l'); } /* * call-seq: * str.rjust(integer, padstr=' ') -> new_str * * If integer is greater than the length of str, returns a new * String of length integer with str right justified * and padded with padstr; otherwise, returns str. * * "hello".rjust(4) #=> "hello" * "hello".rjust(20) #=> " hello" * "hello".rjust(20, '1234') #=> "123412341234123hello" */ static VALUE rb_str_rjust(int argc, VALUE *argv, VALUE str) { return rb_str_justify(argc, argv, str, 'r'); } /* * call-seq: * str.center(width, padstr=' ') -> new_str * * Centers +str+ in +width+. If +width+ is greater than the length of +str+, * returns a new String of length +width+ with +str+ centered and padded with * +padstr+; otherwise, returns +str+. * * "hello".center(4) #=> "hello" * "hello".center(20) #=> " hello " * "hello".center(20, '123') #=> "1231231hello12312312" */ static VALUE rb_str_center(int argc, VALUE *argv, VALUE str) { return rb_str_justify(argc, argv, str, 'c'); } /* * call-seq: * str.partition(sep) -> [head, sep, tail] * str.partition(regexp) -> [head, match, tail] * * Searches sep or pattern (regexp) in the string * and returns the part before it, the match, and the part * after it. * If it is not found, returns two empty strings and str. * * "hello".partition("l") #=> ["he", "l", "lo"] * "hello".partition("x") #=> ["hello", "", ""] * "hello".partition(/.l/) #=> ["h", "el", "lo"] */ static VALUE rb_str_partition(VALUE str, VALUE sep) { long pos; sep = get_pat_quoted(sep, 0); if (RB_TYPE_P(sep, T_REGEXP)) { pos = rb_reg_search(sep, str, 0, 0); if (pos < 0) { failed: return rb_ary_new3(3, rb_str_dup(str), str_new_empty(str), str_new_empty(str)); } sep = rb_str_subpat(str, sep, INT2FIX(0)); if (pos == 0 && RSTRING_LEN(sep) == 0) goto failed; } else { pos = rb_str_index(str, sep, 0); if (pos < 0) goto failed; } return rb_ary_new3(3, rb_str_subseq(str, 0, pos), sep, rb_str_subseq(str, pos+RSTRING_LEN(sep), RSTRING_LEN(str)-pos-RSTRING_LEN(sep))); } /* * call-seq: * str.rpartition(sep) -> [head, sep, tail] * str.rpartition(regexp) -> [head, match, tail] * * Searches sep or pattern (regexp) in the string from the end * of the string, and returns the part before it, the match, and the part * after it. * If it is not found, returns two empty strings and str. * * "hello".rpartition("l") #=> ["hel", "l", "o"] * "hello".rpartition("x") #=> ["", "", "hello"] * "hello".rpartition(/.l/) #=> ["he", "ll", "o"] */ static VALUE rb_str_rpartition(VALUE str, VALUE sep) { long pos = RSTRING_LEN(str); int regex = FALSE; if (RB_TYPE_P(sep, T_REGEXP)) { pos = rb_reg_search(sep, str, pos, 1); regex = TRUE; } else { VALUE tmp; tmp = rb_check_string_type(sep); if (NIL_P(tmp)) { rb_raise(rb_eTypeError, "type mismatch: %s given", rb_obj_classname(sep)); } sep = tmp; pos = rb_str_sublen(str, pos); pos = rb_str_rindex(str, sep, pos); } if (pos < 0) { return rb_ary_new3(3, str_new_empty(str), str_new_empty(str), rb_str_dup(str)); } if (regex) { sep = rb_reg_nth_match(0, rb_backref_get()); } else { pos = rb_str_offset(str, pos); } return rb_ary_new3(3, rb_str_subseq(str, 0, pos), sep, rb_str_subseq(str, pos+RSTRING_LEN(sep), RSTRING_LEN(str)-pos-RSTRING_LEN(sep))); } /* * call-seq: * str.start_with?([prefixes]+) -> true or false * * Returns true if +str+ starts with one of the +prefixes+ given. * Each of the +prefixes+ should be a String or a Regexp. * * "hello".start_with?("hell") #=> true * "hello".start_with?(/H/i) #=> true * * # returns true if one of the prefixes matches. * "hello".start_with?("heaven", "hell") #=> true * "hello".start_with?("heaven", "paradise") #=> false */ static VALUE rb_str_start_with(int argc, VALUE *argv, VALUE str) { int i; for (i=0; i true or false * * Returns true if +str+ ends with one of the +suffixes+ given. * * "hello".end_with?("ello") #=> true * * # returns true if one of the +suffixes+ matches. * "hello".end_with?("heaven", "ello") #=> true * "hello".end_with?("heaven", "paradise") #=> false */ static VALUE rb_str_end_with(int argc, VALUE *argv, VALUE str) { int i; char *p, *s, *e; rb_encoding *enc; for (i=0; iprefix to be deleted in the given str, * returning 0 if str does not start with the prefix. * * @param str the target * @param prefix the prefix * @retval 0 if the given str does not start with the given prefix * @retval Positive-Integer otherwise */ static long deleted_prefix_length(VALUE str, VALUE prefix) { char *strptr, *prefixptr; long olen, prefixlen; StringValue(prefix); if (is_broken_string(prefix)) return 0; rb_enc_check(str, prefix); /* return 0 if not start with prefix */ prefixlen = RSTRING_LEN(prefix); if (prefixlen <= 0) return 0; olen = RSTRING_LEN(str); if (olen < prefixlen) return 0; strptr = RSTRING_PTR(str); prefixptr = RSTRING_PTR(prefix); if (memcmp(strptr, prefixptr, prefixlen) != 0) return 0; return prefixlen; } /* * call-seq: * str.delete_prefix!(prefix) -> self or nil * * Deletes leading prefix from str, returning * nil if no change was made. * * "hello".delete_prefix!("hel") #=> "lo" * "hello".delete_prefix!("llo") #=> nil */ static VALUE rb_str_delete_prefix_bang(VALUE str, VALUE prefix) { long prefixlen; str_modify_keep_cr(str); prefixlen = deleted_prefix_length(str, prefix); if (prefixlen <= 0) return Qnil; return rb_str_drop_bytes(str, prefixlen); } /* * call-seq: * str.delete_prefix(prefix) -> new_str * * Returns a copy of str with leading prefix deleted. * * "hello".delete_prefix("hel") #=> "lo" * "hello".delete_prefix("llo") #=> "hello" */ static VALUE rb_str_delete_prefix(VALUE str, VALUE prefix) { long prefixlen; prefixlen = deleted_prefix_length(str, prefix); if (prefixlen <= 0) return rb_str_dup(str); return rb_str_subseq(str, prefixlen, RSTRING_LEN(str) - prefixlen); } /*! * Returns the length of the suffix to be deleted in the given str, * returning 0 if str does not end with the suffix. * * @param str the target * @param suffix the suffix * @retval 0 if the given str does not end with the given suffix * @retval Positive-Integer otherwise */ static long deleted_suffix_length(VALUE str, VALUE suffix) { char *strptr, *suffixptr, *s; long olen, suffixlen; rb_encoding *enc; StringValue(suffix); if (is_broken_string(suffix)) return 0; enc = rb_enc_check(str, suffix); /* return 0 if not start with suffix */ suffixlen = RSTRING_LEN(suffix); if (suffixlen <= 0) return 0; olen = RSTRING_LEN(str); if (olen < suffixlen) return 0; strptr = RSTRING_PTR(str); suffixptr = RSTRING_PTR(suffix); s = strptr + olen - suffixlen; if (memcmp(s, suffixptr, suffixlen) != 0) return 0; if (rb_enc_left_char_head(strptr, s, strptr + olen, enc) != s) return 0; return suffixlen; } /* * call-seq: * str.delete_suffix!(suffix) -> self or nil * * Deletes trailing suffix from str, returning * nil if no change was made. * * "hello".delete_suffix!("llo") #=> "he" * "hello".delete_suffix!("hel") #=> nil */ static VALUE rb_str_delete_suffix_bang(VALUE str, VALUE suffix) { long olen, suffixlen, len; str_modifiable(str); suffixlen = deleted_suffix_length(str, suffix); if (suffixlen <= 0) return Qnil; olen = RSTRING_LEN(str); str_modify_keep_cr(str); len = olen - suffixlen; STR_SET_LEN(str, len); TERM_FILL(&RSTRING_PTR(str)[len], TERM_LEN(str)); if (ENC_CODERANGE(str) != ENC_CODERANGE_7BIT) { ENC_CODERANGE_CLEAR(str); } return str; } /* * call-seq: * str.delete_suffix(suffix) -> new_str * * Returns a copy of str with trailing suffix deleted. * * "hello".delete_suffix("llo") #=> "he" * "hello".delete_suffix("hel") #=> "hello" */ static VALUE rb_str_delete_suffix(VALUE str, VALUE suffix) { long suffixlen; suffixlen = deleted_suffix_length(str, suffix); if (suffixlen <= 0) return rb_str_dup(str); return rb_str_subseq(str, 0, RSTRING_LEN(str) - suffixlen); } void rb_str_setter(VALUE val, ID id, VALUE *var) { if (!NIL_P(val) && !RB_TYPE_P(val, T_STRING)) { rb_raise(rb_eTypeError, "value of %"PRIsVALUE" must be String", rb_id2str(id)); } *var = val; } static void rb_fs_setter(VALUE val, ID id, VALUE *var) { val = rb_fs_check(val); if (!val) { rb_raise(rb_eTypeError, "value of %"PRIsVALUE" must be String or Regexp", rb_id2str(id)); } if (!NIL_P(val)) { rb_warn("non-nil $; will be deprecated"); } *var = val; } /* * call-seq: * str.force_encoding(encoding) -> str * * Changes the encoding to +encoding+ and returns self. */ static VALUE rb_str_force_encoding(VALUE str, VALUE enc) { str_modifiable(str); rb_enc_associate(str, rb_to_encoding(enc)); ENC_CODERANGE_CLEAR(str); return str; } /* * call-seq: * str.b -> str * * Returns a copied string whose encoding is ASCII-8BIT. */ static VALUE rb_str_b(VALUE str) { VALUE str2 = str_alloc(rb_cString); str_replace_shared_without_enc(str2, str); OBJ_INFECT_RAW(str2, str); ENC_CODERANGE_CLEAR(str2); return str2; } /* * call-seq: * str.valid_encoding? -> true or false * * Returns true for a string which is encoded correctly. * * "\xc2\xa1".force_encoding("UTF-8").valid_encoding? #=> true * "\xc2".force_encoding("UTF-8").valid_encoding? #=> false * "\x80".force_encoding("UTF-8").valid_encoding? #=> false */ static VALUE rb_str_valid_encoding_p(VALUE str) { int cr = rb_enc_str_coderange(str); return cr == ENC_CODERANGE_BROKEN ? Qfalse : Qtrue; } /* * call-seq: * str.ascii_only? -> true or false * * Returns true for a string which has only ASCII characters. * * "abc".force_encoding("UTF-8").ascii_only? #=> true * "abc\u{6666}".force_encoding("UTF-8").ascii_only? #=> false */ static VALUE rb_str_is_ascii_only_p(VALUE str) { int cr = rb_enc_str_coderange(str); return cr == ENC_CODERANGE_7BIT ? Qtrue : Qfalse; } /** * Shortens _str_ and adds three dots, an ellipsis, if it is longer * than _len_ characters. * * \param str the string to ellipsize. * \param len the maximum string length. * \return the ellipsized string. * \pre _len_ must not be negative. * \post the length of the returned string in characters is less than or equal to _len_. * \post If the length of _str_ is less than or equal _len_, returns _str_ itself. * \post the encoding of returned string is equal to the encoding of _str_. * \post the class of returned string is equal to the class of _str_. * \note the length is counted in characters. */ VALUE rb_str_ellipsize(VALUE str, long len) { static const char ellipsis[] = "..."; const long ellipsislen = sizeof(ellipsis) - 1; rb_encoding *const enc = rb_enc_get(str); const long blen = RSTRING_LEN(str); const char *const p = RSTRING_PTR(str), *e = p + blen; VALUE estr, ret = 0; if (len < 0) rb_raise(rb_eIndexError, "negative length %ld", len); if (len * rb_enc_mbminlen(enc) >= blen || (e = rb_enc_nth(p, e, len, enc)) - p == blen) { ret = str; } else if (len <= ellipsislen || !(e = rb_enc_step_back(p, e, e, len = ellipsislen, enc))) { if (rb_enc_asciicompat(enc)) { ret = rb_str_new_with_class(str, ellipsis, len); rb_enc_associate(ret, enc); } else { estr = rb_usascii_str_new(ellipsis, len); ret = rb_str_encode(estr, rb_enc_from_encoding(enc), 0, Qnil); } } else if (ret = rb_str_subseq(str, 0, e - p), rb_enc_asciicompat(enc)) { rb_str_cat(ret, ellipsis, ellipsislen); } else { estr = rb_str_encode(rb_usascii_str_new(ellipsis, ellipsislen), rb_enc_from_encoding(enc), 0, Qnil); rb_str_append(ret, estr); } return ret; } static VALUE str_compat_and_valid(VALUE str, rb_encoding *enc) { int cr; str = StringValue(str); cr = rb_enc_str_coderange(str); if (cr == ENC_CODERANGE_BROKEN) { rb_raise(rb_eArgError, "replacement must be valid byte sequence '%+"PRIsVALUE"'", str); } else { rb_encoding *e = STR_ENC_GET(str); if (cr == ENC_CODERANGE_7BIT ? rb_enc_mbminlen(enc) != 1 : enc != e) { rb_raise(rb_eEncCompatError, "incompatible character encodings: %s and %s", rb_enc_name(enc), rb_enc_name(e)); } } return str; } static VALUE enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl, int cr); /** * @param str the string to be scrubbed * @param repl the replacement character * @return If given string is invalid, returns a new string. Otherwise, returns Qnil. */ VALUE rb_str_scrub(VALUE str, VALUE repl) { rb_encoding *enc = STR_ENC_GET(str); return enc_str_scrub(enc, str, repl, ENC_CODERANGE(str)); } VALUE rb_enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl) { int cr = ENC_CODERANGE_UNKNOWN; if (enc == STR_ENC_GET(str)) { /* cached coderange makes sense only when enc equals the * actual encoding of str */ cr = ENC_CODERANGE(str); } return enc_str_scrub(enc, str, repl, cr); } static VALUE enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl, int cr) { int encidx; VALUE buf = Qnil; const char *rep, *p, *e, *p1, *sp; long replen = -1; int tainted = 0; long slen; if (rb_block_given_p()) { if (!NIL_P(repl)) rb_raise(rb_eArgError, "both of block and replacement given"); replen = 0; } if (ENC_CODERANGE_CLEAN_P(cr)) return Qnil; if (!NIL_P(repl)) { repl = str_compat_and_valid(repl, enc); tainted = OBJ_TAINTED_RAW(repl); } if (rb_enc_dummy_p(enc)) { return Qnil; } encidx = rb_enc_to_index(enc); #define DEFAULT_REPLACE_CHAR(str) do { \ static const char replace[sizeof(str)-1] = str; \ rep = replace; replen = (int)sizeof(replace); \ } while (0) slen = RSTRING_LEN(str); p = RSTRING_PTR(str); e = RSTRING_END(str); p1 = p; sp = p; if (rb_enc_asciicompat(enc)) { int rep7bit_p; if (!replen) { rep = NULL; rep7bit_p = FALSE; } else if (!NIL_P(repl)) { rep = RSTRING_PTR(repl); replen = RSTRING_LEN(repl); rep7bit_p = (ENC_CODERANGE(repl) == ENC_CODERANGE_7BIT); } else if (encidx == rb_utf8_encindex()) { DEFAULT_REPLACE_CHAR("\xEF\xBF\xBD"); rep7bit_p = FALSE; } else { DEFAULT_REPLACE_CHAR("?"); rep7bit_p = TRUE; } cr = ENC_CODERANGE_7BIT; p = search_nonascii(p, e); if (!p) { p = e; } while (p < e) { int ret = rb_enc_precise_mbclen(p, e, enc); if (MBCLEN_NEEDMORE_P(ret)) { break; } else if (MBCLEN_CHARFOUND_P(ret)) { cr = ENC_CODERANGE_VALID; p += MBCLEN_CHARFOUND_LEN(ret); } else if (MBCLEN_INVALID_P(ret)) { /* * p1~p: valid ascii/multibyte chars * p ~e: invalid bytes + unknown bytes */ long clen = rb_enc_mbmaxlen(enc); if (NIL_P(buf)) buf = rb_str_buf_new(RSTRING_LEN(str)); if (p > p1) { rb_str_buf_cat(buf, p1, p - p1); } if (e - p < clen) clen = e - p; if (clen <= 2) { clen = 1; } else { const char *q = p; clen--; for (; clen > 1; clen--) { ret = rb_enc_precise_mbclen(q, q + clen, enc); if (MBCLEN_NEEDMORE_P(ret)) break; if (MBCLEN_INVALID_P(ret)) continue; UNREACHABLE; } } if (rep) { rb_str_buf_cat(buf, rep, replen); if (!rep7bit_p) cr = ENC_CODERANGE_VALID; } else { repl = rb_yield(rb_enc_str_new(p, clen, enc)); str_mod_check(str, sp, slen); repl = str_compat_and_valid(repl, enc); tainted |= OBJ_TAINTED_RAW(repl); rb_str_buf_cat(buf, RSTRING_PTR(repl), RSTRING_LEN(repl)); if (ENC_CODERANGE(repl) == ENC_CODERANGE_VALID) cr = ENC_CODERANGE_VALID; } p += clen; p1 = p; p = search_nonascii(p, e); if (!p) { p = e; break; } } else { UNREACHABLE; } } if (NIL_P(buf)) { if (p == e) { ENC_CODERANGE_SET(str, cr); return Qnil; } buf = rb_str_buf_new(RSTRING_LEN(str)); } if (p1 < p) { rb_str_buf_cat(buf, p1, p - p1); } if (p < e) { if (rep) { rb_str_buf_cat(buf, rep, replen); if (!rep7bit_p) cr = ENC_CODERANGE_VALID; } else { repl = rb_yield(rb_enc_str_new(p, e-p, enc)); str_mod_check(str, sp, slen); repl = str_compat_and_valid(repl, enc); tainted |= OBJ_TAINTED_RAW(repl); rb_str_buf_cat(buf, RSTRING_PTR(repl), RSTRING_LEN(repl)); if (ENC_CODERANGE(repl) == ENC_CODERANGE_VALID) cr = ENC_CODERANGE_VALID; } } } else { /* ASCII incompatible */ long mbminlen = rb_enc_mbminlen(enc); if (!replen) { rep = NULL; } else if (!NIL_P(repl)) { rep = RSTRING_PTR(repl); replen = RSTRING_LEN(repl); } else if (encidx == ENCINDEX_UTF_16BE) { DEFAULT_REPLACE_CHAR("\xFF\xFD"); } else if (encidx == ENCINDEX_UTF_16LE) { DEFAULT_REPLACE_CHAR("\xFD\xFF"); } else if (encidx == ENCINDEX_UTF_32BE) { DEFAULT_REPLACE_CHAR("\x00\x00\xFF\xFD"); } else if (encidx == ENCINDEX_UTF_32LE) { DEFAULT_REPLACE_CHAR("\xFD\xFF\x00\x00"); } else { DEFAULT_REPLACE_CHAR("?"); } while (p < e) { int ret = rb_enc_precise_mbclen(p, e, enc); if (MBCLEN_NEEDMORE_P(ret)) { break; } else if (MBCLEN_CHARFOUND_P(ret)) { p += MBCLEN_CHARFOUND_LEN(ret); } else if (MBCLEN_INVALID_P(ret)) { const char *q = p; long clen = rb_enc_mbmaxlen(enc); if (NIL_P(buf)) buf = rb_str_buf_new(RSTRING_LEN(str)); if (p > p1) rb_str_buf_cat(buf, p1, p - p1); if (e - p < clen) clen = e - p; if (clen <= mbminlen * 2) { clen = mbminlen; } else { clen -= mbminlen; for (; clen > mbminlen; clen-=mbminlen) { ret = rb_enc_precise_mbclen(q, q + clen, enc); if (MBCLEN_NEEDMORE_P(ret)) break; if (MBCLEN_INVALID_P(ret)) continue; UNREACHABLE; } } if (rep) { rb_str_buf_cat(buf, rep, replen); } else { repl = rb_yield(rb_enc_str_new(p, clen, enc)); str_mod_check(str, sp, slen); repl = str_compat_and_valid(repl, enc); tainted |= OBJ_TAINTED_RAW(repl); rb_str_buf_cat(buf, RSTRING_PTR(repl), RSTRING_LEN(repl)); } p += clen; p1 = p; } else { UNREACHABLE; } } if (NIL_P(buf)) { if (p == e) { ENC_CODERANGE_SET(str, ENC_CODERANGE_VALID); return Qnil; } buf = rb_str_buf_new(RSTRING_LEN(str)); } if (p1 < p) { rb_str_buf_cat(buf, p1, p - p1); } if (p < e) { if (rep) { rb_str_buf_cat(buf, rep, replen); } else { repl = rb_yield(rb_enc_str_new(p, e-p, enc)); str_mod_check(str, sp, slen); repl = str_compat_and_valid(repl, enc); tainted |= OBJ_TAINTED_RAW(repl); rb_str_buf_cat(buf, RSTRING_PTR(repl), RSTRING_LEN(repl)); } } cr = ENC_CODERANGE_VALID; } FL_SET_RAW(buf, tainted|OBJ_TAINTED_RAW(str)); ENCODING_CODERANGE_SET(buf, rb_enc_to_index(enc), cr); return buf; } /* * call-seq: * str.scrub -> new_str * str.scrub(repl) -> new_str * str.scrub{|bytes|} -> new_str * * If the string is invalid byte sequence then replace invalid bytes with given replacement * character, else returns self. * If block is given, replace invalid bytes with returned value of the block. * * "abc\u3042\x81".scrub #=> "abc\u3042\uFFFD" * "abc\u3042\x81".scrub("*") #=> "abc\u3042*" * "abc\u3042\xE3\x80".scrub{|bytes| '<'+bytes.unpack('H*')[0]+'>' } #=> "abc\u3042" */ static VALUE str_scrub(int argc, VALUE *argv, VALUE str) { VALUE repl = argc ? (rb_check_arity(argc, 0, 1), argv[0]) : Qnil; VALUE new = rb_str_scrub(str, repl); return NIL_P(new) ? rb_str_dup(str): new; } /* * call-seq: * str.scrub! -> str * str.scrub!(repl) -> str * str.scrub!{|bytes|} -> str * * If the string is invalid byte sequence then replace invalid bytes with given replacement * character, else returns self. * If block is given, replace invalid bytes with returned value of the block. * * "abc\u3042\x81".scrub! #=> "abc\u3042\uFFFD" * "abc\u3042\x81".scrub!("*") #=> "abc\u3042*" * "abc\u3042\xE3\x80".scrub!{|bytes| '<'+bytes.unpack('H*')[0]+'>' } #=> "abc\u3042" */ static VALUE str_scrub_bang(int argc, VALUE *argv, VALUE str) { VALUE repl = argc ? (rb_check_arity(argc, 0, 1), argv[0]) : Qnil; VALUE new = rb_str_scrub(str, repl); if (!NIL_P(new)) rb_str_replace(str, new); return str; } static ID id_normalize; static ID id_normalized_p; static VALUE mUnicodeNormalize; static VALUE unicode_normalize_common(int argc, VALUE *argv, VALUE str, ID id) { static int UnicodeNormalizeRequired = 0; VALUE argv2[2]; if (!UnicodeNormalizeRequired) { rb_require("unicode_normalize/normalize.rb"); UnicodeNormalizeRequired = 1; } argv2[0] = str; if (rb_check_arity(argc, 0, 1)) argv2[1] = argv[0]; return rb_funcallv(mUnicodeNormalize, id, argc+1, argv2); } /* * call-seq: * str.unicode_normalize(form=:nfc) * * Unicode Normalization---Returns a normalized form of +str+, * using Unicode normalizations NFC, NFD, NFKC, or NFKD. * The normalization form used is determined by +form+, which can * be any of the four values +:nfc+, +:nfd+, +:nfkc+, or +:nfkd+. * The default is +:nfc+. * * If the string is not in a Unicode Encoding, then an Exception is raised. * In this context, 'Unicode Encoding' means any of UTF-8, UTF-16BE/LE, * and UTF-32BE/LE, as well as GB18030, UCS_2BE, and UCS_4BE. * Anything other than UTF-8 is implemented by converting to UTF-8, * which makes it slower than UTF-8. * * "a\u0300".unicode_normalize #=> "\u00E0" * "a\u0300".unicode_normalize(:nfc) #=> "\u00E0" * "\u00E0".unicode_normalize(:nfd) #=> "a\u0300" * "\xE0".force_encoding('ISO-8859-1').unicode_normalize(:nfd) * #=> Encoding::CompatibilityError raised */ static VALUE rb_str_unicode_normalize(int argc, VALUE *argv, VALUE str) { return unicode_normalize_common(argc, argv, str, id_normalize); } /* * call-seq: * str.unicode_normalize!(form=:nfc) * * Destructive version of String#unicode_normalize, doing Unicode * normalization in place. */ static VALUE rb_str_unicode_normalize_bang(int argc, VALUE *argv, VALUE str) { return rb_str_replace(str, unicode_normalize_common(argc, argv, str, id_normalize)); } /* call-seq: * str.unicode_normalized?(form=:nfc) * * Checks whether +str+ is in Unicode normalization form +form+, * which can be any of the four values +:nfc+, +:nfd+, +:nfkc+, or +:nfkd+. * The default is +:nfc+. * * If the string is not in a Unicode Encoding, then an Exception is raised. * For details, see String#unicode_normalize. * * "a\u0300".unicode_normalized? #=> false * "a\u0300".unicode_normalized?(:nfd) #=> true * "\u00E0".unicode_normalized? #=> true * "\u00E0".unicode_normalized?(:nfd) #=> false * "\xE0".force_encoding('ISO-8859-1').unicode_normalized? * #=> Encoding::CompatibilityError raised */ static VALUE rb_str_unicode_normalized_p(int argc, VALUE *argv, VALUE str) { return unicode_normalize_common(argc, argv, str, id_normalized_p); } /********************************************************************** * Document-class: Symbol * * Symbol objects represent names inside the Ruby interpreter. They * are generated using the :name and * :"string" literals syntax, and by the various * to_sym methods. The same Symbol object will be * created for a given name or string for the duration of a program's * execution, regardless of the context or meaning of that name. Thus * if Fred is a constant in one context, a method in * another, and a class in a third, the Symbol :Fred * will be the same object in all three contexts. * * module One * class Fred * end * $f1 = :Fred * end * module Two * Fred = 1 * $f2 = :Fred * end * def Fred() * end * $f3 = :Fred * $f1.object_id #=> 2514190 * $f2.object_id #=> 2514190 * $f3.object_id #=> 2514190 * */ /* * call-seq: * sym == obj -> true or false * * Equality---If sym and obj are exactly the same * symbol, returns true. */ #define sym_equal rb_obj_equal static int sym_printable(const char *s, const char *send, rb_encoding *enc) { while (s < send) { int n; int c = rb_enc_precise_mbclen(s, send, enc); if (!MBCLEN_CHARFOUND_P(c)) return FALSE; n = MBCLEN_CHARFOUND_LEN(c); c = rb_enc_mbc_to_codepoint(s, send, enc); if (!rb_enc_isprint(c, enc)) return FALSE; s += n; } return TRUE; } int rb_str_symname_p(VALUE sym) { rb_encoding *enc; const char *ptr; long len; rb_encoding *resenc = rb_default_internal_encoding(); if (resenc == NULL) resenc = rb_default_external_encoding(); enc = STR_ENC_GET(sym); ptr = RSTRING_PTR(sym); len = RSTRING_LEN(sym); if ((resenc != enc && !rb_str_is_ascii_only_p(sym)) || len != (long)strlen(ptr) || !rb_enc_symname2_p(ptr, len, enc) || !sym_printable(ptr, ptr + len, enc)) { return FALSE; } return TRUE; } VALUE rb_str_quote_unprintable(VALUE str) { rb_encoding *enc; const char *ptr; long len; rb_encoding *resenc; Check_Type(str, T_STRING); resenc = rb_default_internal_encoding(); if (resenc == NULL) resenc = rb_default_external_encoding(); enc = STR_ENC_GET(str); ptr = RSTRING_PTR(str); len = RSTRING_LEN(str); if ((resenc != enc && !rb_str_is_ascii_only_p(str)) || !sym_printable(ptr, ptr + len, enc)) { return rb_str_inspect(str); } return str; } MJIT_FUNC_EXPORTED VALUE rb_id_quote_unprintable(ID id) { VALUE str = rb_id2str(id); if (!rb_str_symname_p(str)) { return rb_str_inspect(str); } return str; } /* * call-seq: * sym.inspect -> string * * Returns the representation of sym as a symbol literal. * * :fred.inspect #=> ":fred" */ static VALUE sym_inspect(VALUE sym) { VALUE str = rb_sym2str(sym); const char *ptr; long len; char *dest; if (!rb_str_symname_p(str)) { str = rb_str_inspect(str); len = RSTRING_LEN(str); rb_str_resize(str, len + 1); dest = RSTRING_PTR(str); memmove(dest + 1, dest, len); } else { rb_encoding *enc = STR_ENC_GET(str); RSTRING_GETMEM(str, ptr, len); str = rb_enc_str_new(0, len + 1, enc); dest = RSTRING_PTR(str); memcpy(dest + 1, ptr, len); } dest[0] = ':'; return str; } /* * call-seq: * sym.id2name -> string * sym.to_s -> string * * Returns the name or string corresponding to sym. * * :fred.id2name #=> "fred" * :ginger.to_s #=> "ginger" */ VALUE rb_sym_to_s(VALUE sym) { return str_new_shared(rb_cString, rb_sym2str(sym)); } /* * call-seq: * sym.to_sym -> sym * sym.intern -> sym * * In general, to_sym returns the Symbol corresponding * to an object. As sym is already a symbol, self is returned * in this case. */ static VALUE sym_to_sym(VALUE sym) { return sym; } MJIT_FUNC_EXPORTED VALUE rb_sym_proc_call(ID mid, int argc, const VALUE *argv, int kw_splat, VALUE passed_proc) { VALUE obj; if (argc < 1) { rb_raise(rb_eArgError, "no receiver given"); } obj = argv[0]; return rb_funcall_with_block_kw(obj, mid, argc - 1, argv + 1, passed_proc, kw_splat); } #if 0 /* * call-seq: * sym.to_proc * * Returns a _Proc_ object which responds to the given method by _sym_. * * (1..3).collect(&:to_s) #=> ["1", "2", "3"] */ VALUE rb_sym_to_proc(VALUE sym) { } #endif /* * call-seq: * * sym.succ * * Same as sym.to_s.succ.intern. */ static VALUE sym_succ(VALUE sym) { return rb_str_intern(rb_str_succ(rb_sym2str(sym))); } /* * call-seq: * * symbol <=> other_symbol -> -1, 0, +1, or nil * * Compares +symbol+ with +other_symbol+ after calling #to_s on each of the * symbols. Returns -1, 0, +1, or +nil+ depending on whether +symbol+ is * less than, equal to, or greater than +other_symbol+. * * +nil+ is returned if the two values are incomparable. * * See String#<=> for more information. */ static VALUE sym_cmp(VALUE sym, VALUE other) { if (!SYMBOL_P(other)) { return Qnil; } return rb_str_cmp_m(rb_sym2str(sym), rb_sym2str(other)); } /* * call-seq: * sym.casecmp(other_symbol) -> -1, 0, +1, or nil * * Case-insensitive version of Symbol#<=>. * Currently, case-insensitivity only works on characters A-Z/a-z, * not all of Unicode. This is different from Symbol#casecmp?. * * :aBcDeF.casecmp(:abcde) #=> 1 * :aBcDeF.casecmp(:abcdef) #=> 0 * :aBcDeF.casecmp(:abcdefg) #=> -1 * :abcdef.casecmp(:ABCDEF) #=> 0 * * +nil+ is returned if the two symbols have incompatible encodings, * or if +other_symbol+ is not a symbol. * * :foo.casecmp(2) #=> nil * "\u{e4 f6 fc}".encode("ISO-8859-1").to_sym.casecmp(:"\u{c4 d6 dc}") #=> nil */ static VALUE sym_casecmp(VALUE sym, VALUE other) { if (!SYMBOL_P(other)) { return Qnil; } return str_casecmp(rb_sym2str(sym), rb_sym2str(other)); } /* * call-seq: * sym.casecmp?(other_symbol) -> true, false, or nil * * Returns +true+ if +sym+ and +other_symbol+ are equal after * Unicode case folding, +false+ if they are not equal. * * :aBcDeF.casecmp?(:abcde) #=> false * :aBcDeF.casecmp?(:abcdef) #=> true * :aBcDeF.casecmp?(:abcdefg) #=> false * :abcdef.casecmp?(:ABCDEF) #=> true * :"\u{e4 f6 fc}".casecmp?(:"\u{c4 d6 dc}") #=> true * * +nil+ is returned if the two symbols have incompatible encodings, * or if +other_symbol+ is not a symbol. * * :foo.casecmp?(2) #=> nil * "\u{e4 f6 fc}".encode("ISO-8859-1").to_sym.casecmp?(:"\u{c4 d6 dc}") #=> nil */ static VALUE sym_casecmp_p(VALUE sym, VALUE other) { if (!SYMBOL_P(other)) { return Qnil; } return str_casecmp_p(rb_sym2str(sym), rb_sym2str(other)); } /* * call-seq: * sym =~ obj -> integer or nil * * Returns sym.to_s =~ obj. */ static VALUE sym_match(VALUE sym, VALUE other) { return rb_str_match(rb_sym2str(sym), other); } /* * call-seq: * sym.match(pattern) -> matchdata or nil * sym.match(pattern, pos) -> matchdata or nil * * Returns sym.to_s.match. */ static VALUE sym_match_m(int argc, VALUE *argv, VALUE sym) { return rb_str_match_m(argc, argv, rb_sym2str(sym)); } /* * call-seq: * sym.match?(pattern) -> true or false * sym.match?(pattern, pos) -> true or false * * Returns sym.to_s.match?. */ static VALUE sym_match_m_p(int argc, VALUE *argv, VALUE sym) { return rb_str_match_m_p(argc, argv, sym); } /* * call-seq: * sym[idx] -> char * sym[b, n] -> string * sym.slice(idx) -> char * sym.slice(b, n) -> string * * Returns sym.to_s[]. */ static VALUE sym_aref(int argc, VALUE *argv, VALUE sym) { return rb_str_aref_m(argc, argv, rb_sym2str(sym)); } /* * call-seq: * sym.length -> integer * sym.size -> integer * * Same as sym.to_s.length. */ static VALUE sym_length(VALUE sym) { return rb_str_length(rb_sym2str(sym)); } /* * call-seq: * sym.empty? -> true or false * * Returns whether _sym_ is :"" or not. */ static VALUE sym_empty(VALUE sym) { return rb_str_empty(rb_sym2str(sym)); } /* * call-seq: * sym.upcase -> symbol * sym.upcase([options]) -> symbol * * Same as sym.to_s.upcase.intern. */ static VALUE sym_upcase(int argc, VALUE *argv, VALUE sym) { return rb_str_intern(rb_str_upcase(argc, argv, rb_sym2str(sym))); } /* * call-seq: * sym.downcase -> symbol * sym.downcase([options]) -> symbol * * Same as sym.to_s.downcase.intern. */ static VALUE sym_downcase(int argc, VALUE *argv, VALUE sym) { return rb_str_intern(rb_str_downcase(argc, argv, rb_sym2str(sym))); } /* * call-seq: * sym.capitalize -> symbol * sym.capitalize([options]) -> symbol * * Same as sym.to_s.capitalize.intern. */ static VALUE sym_capitalize(int argc, VALUE *argv, VALUE sym) { return rb_str_intern(rb_str_capitalize(argc, argv, rb_sym2str(sym))); } /* * call-seq: * sym.swapcase -> symbol * sym.swapcase([options]) -> symbol * * Same as sym.to_s.swapcase.intern. */ static VALUE sym_swapcase(int argc, VALUE *argv, VALUE sym) { return rb_str_intern(rb_str_swapcase(argc, argv, rb_sym2str(sym))); } /* * call-seq: * sym.encoding -> encoding * * Returns the Encoding object that represents the encoding of _sym_. */ static VALUE sym_encoding(VALUE sym) { return rb_obj_encoding(rb_sym2str(sym)); } static VALUE string_for_symbol(VALUE name) { if (!RB_TYPE_P(name, T_STRING)) { VALUE tmp = rb_check_string_type(name); if (NIL_P(tmp)) { rb_raise(rb_eTypeError, "%+"PRIsVALUE" is not a symbol", name); } name = tmp; } return name; } ID rb_to_id(VALUE name) { if (SYMBOL_P(name)) { return SYM2ID(name); } name = string_for_symbol(name); return rb_intern_str(name); } VALUE rb_to_symbol(VALUE name) { if (SYMBOL_P(name)) { return name; } name = string_for_symbol(name); return rb_str_intern(name); } /* * call-seq: * Symbol.all_symbols => array * * Returns an array of all the symbols currently in Ruby's symbol * table. * * Symbol.all_symbols.size #=> 903 * Symbol.all_symbols[1,20] #=> [:floor, :ARGV, :Binding, :symlink, * :chown, :EOFError, :$;, :String, * :LOCK_SH, :"setuid?", :$<, * :default_proc, :compact, :extend, * :Tms, :getwd, :$=, :ThreadGroup, * :wait2, :$>] */ static VALUE sym_all_symbols(VALUE _) { return rb_sym_all_symbols(); } /* * A String object holds and manipulates an arbitrary sequence of * bytes, typically representing characters. String objects may be created * using String::new or as literals. * * Because of aliasing issues, users of strings should be aware of the methods * that modify the contents of a String object. Typically, * methods with names ending in ``!'' modify their receiver, while those * without a ``!'' return a new String. However, there are * exceptions, such as String#[]=. * */ void Init_String(void) { #undef rb_intern #define rb_intern(str) rb_intern_const(str) rb_cString = rb_define_class("String", rb_cObject); assert(rb_vm_fstring_table()); st_foreach(rb_vm_fstring_table(), fstring_set_class_i, rb_cString); rb_include_module(rb_cString, rb_mComparable); rb_define_alloc_func(rb_cString, empty_str_alloc); rb_define_singleton_method(rb_cString, "try_convert", rb_str_s_try_convert, 1); rb_define_method(rb_cString, "initialize", rb_str_init, -1); rb_define_method(rb_cString, "initialize_copy", rb_str_replace, 1); rb_define_method(rb_cString, "<=>", rb_str_cmp_m, 1); rb_define_method(rb_cString, "==", rb_str_equal, 1); rb_define_method(rb_cString, "===", rb_str_equal, 1); rb_define_method(rb_cString, "eql?", rb_str_eql, 1); rb_define_method(rb_cString, "hash", rb_str_hash_m, 0); rb_define_method(rb_cString, "casecmp", rb_str_casecmp, 1); rb_define_method(rb_cString, "casecmp?", rb_str_casecmp_p, 1); rb_define_method(rb_cString, "+", rb_str_plus, 1); rb_define_method(rb_cString, "*", rb_str_times, 1); rb_define_method(rb_cString, "%", rb_str_format_m, 1); rb_define_method(rb_cString, "[]", rb_str_aref_m, -1); rb_define_method(rb_cString, "[]=", rb_str_aset_m, -1); rb_define_method(rb_cString, "insert", rb_str_insert, 2); rb_define_method(rb_cString, "length", rb_str_length, 0); rb_define_method(rb_cString, "size", rb_str_length, 0); rb_define_method(rb_cString, "bytesize", rb_str_bytesize, 0); rb_define_method(rb_cString, "empty?", rb_str_empty, 0); rb_define_method(rb_cString, "=~", rb_str_match, 1); rb_define_method(rb_cString, "match", rb_str_match_m, -1); rb_define_method(rb_cString, "match?", rb_str_match_m_p, -1); rb_define_method(rb_cString, "succ", rb_str_succ, 0); rb_define_method(rb_cString, "succ!", rb_str_succ_bang, 0); rb_define_method(rb_cString, "next", rb_str_succ, 0); rb_define_method(rb_cString, "next!", rb_str_succ_bang, 0); rb_define_method(rb_cString, "upto", rb_str_upto, -1); rb_define_method(rb_cString, "index", rb_str_index_m, -1); rb_define_method(rb_cString, "rindex", rb_str_rindex_m, -1); rb_define_method(rb_cString, "replace", rb_str_replace, 1); rb_define_method(rb_cString, "clear", rb_str_clear, 0); rb_define_method(rb_cString, "chr", rb_str_chr, 0); rb_define_method(rb_cString, "getbyte", rb_str_getbyte, 1); rb_define_method(rb_cString, "setbyte", rb_str_setbyte, 2); rb_define_method(rb_cString, "byteslice", rb_str_byteslice, -1); rb_define_method(rb_cString, "scrub", str_scrub, -1); rb_define_method(rb_cString, "scrub!", str_scrub_bang, -1); rb_define_method(rb_cString, "freeze", rb_str_freeze, 0); rb_define_method(rb_cString, "+@", str_uplus, 0); rb_define_method(rb_cString, "-@", str_uminus, 0); rb_define_method(rb_cString, "to_i", rb_str_to_i, -1); rb_define_method(rb_cString, "to_f", rb_str_to_f, 0); rb_define_method(rb_cString, "to_s", rb_str_to_s, 0); rb_define_method(rb_cString, "to_str", rb_str_to_s, 0); rb_define_method(rb_cString, "inspect", rb_str_inspect, 0); rb_define_method(rb_cString, "dump", rb_str_dump, 0); rb_define_method(rb_cString, "undump", str_undump, 0); sym_ascii = ID2SYM(rb_intern("ascii")); sym_turkic = ID2SYM(rb_intern("turkic")); sym_lithuanian = ID2SYM(rb_intern("lithuanian")); sym_fold = ID2SYM(rb_intern("fold")); rb_define_method(rb_cString, "upcase", rb_str_upcase, -1); rb_define_method(rb_cString, "downcase", rb_str_downcase, -1); rb_define_method(rb_cString, "capitalize", rb_str_capitalize, -1); rb_define_method(rb_cString, "swapcase", rb_str_swapcase, -1); rb_define_method(rb_cString, "upcase!", rb_str_upcase_bang, -1); rb_define_method(rb_cString, "downcase!", rb_str_downcase_bang, -1); rb_define_method(rb_cString, "capitalize!", rb_str_capitalize_bang, -1); rb_define_method(rb_cString, "swapcase!", rb_str_swapcase_bang, -1); rb_define_method(rb_cString, "hex", rb_str_hex, 0); rb_define_method(rb_cString, "oct", rb_str_oct, 0); rb_define_method(rb_cString, "split", rb_str_split_m, -1); rb_define_method(rb_cString, "lines", rb_str_lines, -1); rb_define_method(rb_cString, "bytes", rb_str_bytes, 0); rb_define_method(rb_cString, "chars", rb_str_chars, 0); rb_define_method(rb_cString, "codepoints", rb_str_codepoints, 0); rb_define_method(rb_cString, "grapheme_clusters", rb_str_grapheme_clusters, 0); rb_define_method(rb_cString, "reverse", rb_str_reverse, 0); rb_define_method(rb_cString, "reverse!", rb_str_reverse_bang, 0); rb_define_method(rb_cString, "concat", rb_str_concat_multi, -1); rb_define_method(rb_cString, "<<", rb_str_concat, 1); rb_define_method(rb_cString, "prepend", rb_str_prepend_multi, -1); rb_define_method(rb_cString, "crypt", rb_str_crypt, 1); rb_define_method(rb_cString, "intern", rb_str_intern, 0); /* in symbol.c */ rb_define_method(rb_cString, "to_sym", rb_str_intern, 0); /* in symbol.c */ rb_define_method(rb_cString, "ord", rb_str_ord, 0); rb_define_method(rb_cString, "include?", rb_str_include, 1); rb_define_method(rb_cString, "start_with?", rb_str_start_with, -1); rb_define_method(rb_cString, "end_with?", rb_str_end_with, -1); rb_define_method(rb_cString, "scan", rb_str_scan, 1); rb_define_method(rb_cString, "ljust", rb_str_ljust, -1); rb_define_method(rb_cString, "rjust", rb_str_rjust, -1); rb_define_method(rb_cString, "center", rb_str_center, -1); rb_define_method(rb_cString, "sub", rb_str_sub, -1); rb_define_method(rb_cString, "gsub", rb_str_gsub, -1); rb_define_method(rb_cString, "chop", rb_str_chop, 0); rb_define_method(rb_cString, "chomp", rb_str_chomp, -1); rb_define_method(rb_cString, "strip", rb_str_strip, 0); rb_define_method(rb_cString, "lstrip", rb_str_lstrip, 0); rb_define_method(rb_cString, "rstrip", rb_str_rstrip, 0); rb_define_method(rb_cString, "delete_prefix", rb_str_delete_prefix, 1); rb_define_method(rb_cString, "delete_suffix", rb_str_delete_suffix, 1); rb_define_method(rb_cString, "sub!", rb_str_sub_bang, -1); rb_define_method(rb_cString, "gsub!", rb_str_gsub_bang, -1); rb_define_method(rb_cString, "chop!", rb_str_chop_bang, 0); rb_define_method(rb_cString, "chomp!", rb_str_chomp_bang, -1); rb_define_method(rb_cString, "strip!", rb_str_strip_bang, 0); rb_define_method(rb_cString, "lstrip!", rb_str_lstrip_bang, 0); rb_define_method(rb_cString, "rstrip!", rb_str_rstrip_bang, 0); rb_define_method(rb_cString, "delete_prefix!", rb_str_delete_prefix_bang, 1); rb_define_method(rb_cString, "delete_suffix!", rb_str_delete_suffix_bang, 1); rb_define_method(rb_cString, "tr", rb_str_tr, 2); rb_define_method(rb_cString, "tr_s", rb_str_tr_s, 2); rb_define_method(rb_cString, "delete", rb_str_delete, -1); rb_define_method(rb_cString, "squeeze", rb_str_squeeze, -1); rb_define_method(rb_cString, "count", rb_str_count, -1); rb_define_method(rb_cString, "tr!", rb_str_tr_bang, 2); rb_define_method(rb_cString, "tr_s!", rb_str_tr_s_bang, 2); rb_define_method(rb_cString, "delete!", rb_str_delete_bang, -1); rb_define_method(rb_cString, "squeeze!", rb_str_squeeze_bang, -1); rb_define_method(rb_cString, "each_line", rb_str_each_line, -1); rb_define_method(rb_cString, "each_byte", rb_str_each_byte, 0); rb_define_method(rb_cString, "each_char", rb_str_each_char, 0); rb_define_method(rb_cString, "each_codepoint", rb_str_each_codepoint, 0); rb_define_method(rb_cString, "each_grapheme_cluster", rb_str_each_grapheme_cluster, 0); rb_define_method(rb_cString, "sum", rb_str_sum, -1); rb_define_method(rb_cString, "slice", rb_str_aref_m, -1); rb_define_method(rb_cString, "slice!", rb_str_slice_bang, -1); rb_define_method(rb_cString, "partition", rb_str_partition, 1); rb_define_method(rb_cString, "rpartition", rb_str_rpartition, 1); rb_define_method(rb_cString, "encoding", rb_obj_encoding, 0); /* in encoding.c */ rb_define_method(rb_cString, "force_encoding", rb_str_force_encoding, 1); rb_define_method(rb_cString, "b", rb_str_b, 0); rb_define_method(rb_cString, "valid_encoding?", rb_str_valid_encoding_p, 0); rb_define_method(rb_cString, "ascii_only?", rb_str_is_ascii_only_p, 0); /* define UnicodeNormalize module here so that we don't have to look it up */ mUnicodeNormalize = rb_define_module("UnicodeNormalize"); id_normalize = rb_intern("normalize"); id_normalized_p = rb_intern("normalized?"); rb_define_method(rb_cString, "unicode_normalize", rb_str_unicode_normalize, -1); rb_define_method(rb_cString, "unicode_normalize!", rb_str_unicode_normalize_bang, -1); rb_define_method(rb_cString, "unicode_normalized?", rb_str_unicode_normalized_p, -1); rb_fs = Qnil; rb_define_hooked_variable("$;", &rb_fs, 0, rb_fs_setter); rb_define_hooked_variable("$-F", &rb_fs, 0, rb_fs_setter); rb_gc_register_address(&rb_fs); rb_cSymbol = rb_define_class("Symbol", rb_cObject); rb_include_module(rb_cSymbol, rb_mComparable); rb_undef_alloc_func(rb_cSymbol); rb_undef_method(CLASS_OF(rb_cSymbol), "new"); rb_define_singleton_method(rb_cSymbol, "all_symbols", sym_all_symbols, 0); rb_define_method(rb_cSymbol, "==", sym_equal, 1); rb_define_method(rb_cSymbol, "===", sym_equal, 1); rb_define_method(rb_cSymbol, "inspect", sym_inspect, 0); rb_define_method(rb_cSymbol, "to_s", rb_sym_to_s, 0); rb_define_method(rb_cSymbol, "id2name", rb_sym_to_s, 0); rb_define_method(rb_cSymbol, "intern", sym_to_sym, 0); rb_define_method(rb_cSymbol, "to_sym", sym_to_sym, 0); rb_define_method(rb_cSymbol, "to_proc", rb_sym_to_proc, 0); rb_define_method(rb_cSymbol, "succ", sym_succ, 0); rb_define_method(rb_cSymbol, "next", sym_succ, 0); rb_define_method(rb_cSymbol, "<=>", sym_cmp, 1); rb_define_method(rb_cSymbol, "casecmp", sym_casecmp, 1); rb_define_method(rb_cSymbol, "casecmp?", sym_casecmp_p, 1); rb_define_method(rb_cSymbol, "=~", sym_match, 1); rb_define_method(rb_cSymbol, "[]", sym_aref, -1); rb_define_method(rb_cSymbol, "slice", sym_aref, -1); rb_define_method(rb_cSymbol, "length", sym_length, 0); rb_define_method(rb_cSymbol, "size", sym_length, 0); rb_define_method(rb_cSymbol, "empty?", sym_empty, 0); rb_define_method(rb_cSymbol, "match", sym_match_m, -1); rb_define_method(rb_cSymbol, "match?", sym_match_m_p, -1); rb_define_method(rb_cSymbol, "upcase", sym_upcase, -1); rb_define_method(rb_cSymbol, "downcase", sym_downcase, -1); rb_define_method(rb_cSymbol, "capitalize", sym_capitalize, -1); rb_define_method(rb_cSymbol, "swapcase", sym_swapcase, -1); rb_define_method(rb_cSymbol, "encoding", sym_encoding, 0); } width: 0.0%;'/> -rw-r--r--doc/forwardable.rd84
-rw-r--r--doc/forwardable.rd.ja49
-rw-r--r--doc/images/boottime-classes.pngbin0 -> 28677 bytes-rw-r--r--doc/index.md65
-rw-r--r--doc/irb/irb-tools.rd.ja185
-rw-r--r--doc/irb/irb.rd392
-rw-r--r--doc/irb/irb.rd.ja411
-rw-r--r--doc/jit/yjit.md544
-rw-r--r--doc/jit/zjit.md397
-rw-r--r--doc/language/box.md361
-rw-r--r--doc/language/bsearch.rdoc120
-rw-r--r--doc/language/calendars.rdoc62
-rw-r--r--doc/language/case_mapping.rdoc106
-rw-r--r--doc/language/character_selectors.rdoc100
-rw-r--r--doc/language/dig_methods.rdoc82
-rw-r--r--doc/language/encodings.rdoc482
-rw-r--r--doc/language/exceptions.md521
-rw-r--r--doc/language/fiber.md290
-rw-r--r--doc/language/format_specifications.rdoc354
-rw-r--r--doc/language/globals.md610
-rw-r--r--doc/language/hash_inclusion.rdoc31
-rw-r--r--doc/language/implicit_conversion.rdoc221
-rw-r--r--doc/language/marshal.rdoc318
-rw-r--r--doc/language/option_dump.md265
-rw-r--r--doc/language/options.md688
-rw-r--r--doc/language/packed_data.rdoc722
-rw-r--r--doc/language/ractor.md797
-rw-r--r--doc/language/regexp/methods.rdoc41
-rw-r--r--doc/language/regexp/unicode_properties.rdoc718
-rw-r--r--doc/language/signals.rdoc106
-rw-r--r--doc/language/strftime_formatting.rdoc525
-rw-r--r--doc/maintainers.md718
-rw-r--r--doc/matchdata/begin.rdoc30
-rw-r--r--doc/matchdata/bytebegin.rdoc30
-rw-r--r--doc/matchdata/byteend.rdoc30
-rw-r--r--doc/matchdata/end.rdoc30
-rw-r--r--doc/matchdata/offset.rdoc31
-rw-r--r--doc/math/math.rdoc117
-rw-r--r--doc/net-http/examples.rdoc31
-rw-r--r--doc/net-http/included_getters.rdoc3
-rw-r--r--doc/optparse/.document1
-rw-r--r--doc/optparse/argument_converters.rdoc380
-rw-r--r--doc/optparse/creates_option.rdoc7
-rw-r--r--doc/optparse/option_params.rdoc520
-rw-r--r--doc/optparse/ruby/argument_abbreviation.rb9
-rw-r--r--doc/optparse/ruby/argument_keywords.rb6
-rw-r--r--doc/optparse/ruby/argument_strings.rb6
-rw-r--r--doc/optparse/ruby/argv.rb2
-rw-r--r--doc/optparse/ruby/array.rb6
-rw-r--r--doc/optparse/ruby/basic.rb17
-rw-r--r--doc/optparse/ruby/block.rb9
-rw-r--r--doc/optparse/ruby/collected_options.rb8
-rw-r--r--doc/optparse/ruby/custom_converter.rb9
-rw-r--r--doc/optparse/ruby/date.rb6
-rw-r--r--doc/optparse/ruby/datetime.rb6
-rw-r--r--doc/optparse/ruby/decimal_integer.rb7
-rw-r--r--doc/optparse/ruby/decimal_numeric.rb7
-rw-r--r--doc/optparse/ruby/default_values.rb8
-rw-r--r--doc/optparse/ruby/descriptions.rb15
-rw-r--r--doc/optparse/ruby/explicit_array_values.rb9
-rw-r--r--doc/optparse/ruby/explicit_hash_values.rb9
-rw-r--r--doc/optparse/ruby/false_class.rb6
-rw-r--r--doc/optparse/ruby/float.rb6
-rw-r--r--doc/optparse/ruby/help.rb18
-rw-r--r--doc/optparse/ruby/help_banner.rb7
-rw-r--r--doc/optparse/ruby/help_format.rb25
-rw-r--r--doc/optparse/ruby/help_program_name.rb7
-rw-r--r--doc/optparse/ruby/integer.rb6
-rw-r--r--doc/optparse/ruby/long_names.rb9
-rw-r--r--doc/optparse/ruby/long_optional.rb6
-rw-r--r--doc/optparse/ruby/long_required.rb6
-rw-r--r--doc/optparse/ruby/long_simple.rb9
-rw-r--r--doc/optparse/ruby/long_with_negation.rb6
-rw-r--r--doc/optparse/ruby/match_converter.rb9
-rw-r--r--doc/optparse/ruby/matched_values.rb12
-rw-r--r--doc/optparse/ruby/method.rb11
-rw-r--r--doc/optparse/ruby/missing_options.rb12
-rw-r--r--doc/optparse/ruby/mixed_names.rb12
-rw-r--r--doc/optparse/ruby/name_abbrev.rb9
-rw-r--r--doc/optparse/ruby/no_abbreviation.rb10
-rw-r--r--doc/optparse/ruby/numeric.rb6
-rw-r--r--doc/optparse/ruby/object.rb6
-rw-r--r--doc/optparse/ruby/octal_integer.rb7
-rw-r--r--doc/optparse/ruby/optional_argument.rb9
-rw-r--r--doc/optparse/ruby/parse.rb13
-rw-r--r--doc/optparse/ruby/parse_bang.rb13
-rw-r--r--doc/optparse/ruby/proc.rb13
-rw-r--r--doc/optparse/ruby/regexp.rb6
-rw-r--r--doc/optparse/ruby/required_argument.rb9
-rw-r--r--doc/optparse/ruby/shellwords.rb6
-rw-r--r--doc/optparse/ruby/short_names.rb9
-rw-r--r--doc/optparse/ruby/short_optional.rb6
-rw-r--r--doc/optparse/ruby/short_range.rb6
-rw-r--r--doc/optparse/ruby/short_required.rb6
-rw-r--r--doc/optparse/ruby/short_simple.rb9
-rw-r--r--doc/optparse/ruby/string.rb6
-rw-r--r--doc/optparse/ruby/terminator.rb6
-rw-r--r--doc/optparse/ruby/time.rb6
-rw-r--r--doc/optparse/ruby/true_class.rb6
-rw-r--r--doc/optparse/ruby/uri.rb6
-rw-r--r--doc/optparse/tutorial.rdoc858
-rw-r--r--doc/pty/README.expect.ja23
-rw-r--r--doc/pty/README.ja70
-rw-r--r--doc/security/command_injection.rdoc15
-rw-r--r--doc/security/security.rdoc127
-rw-r--r--doc/shell.rd348
-rw-r--r--doc/shell.rd.ja336
-rw-r--r--doc/standard_library.md225
-rw-r--r--doc/string.rb421
-rw-r--r--doc/string/aref.rdoc96
-rw-r--r--doc/string/aset.rdoc179
-rw-r--r--doc/string/b.rdoc16
-rw-r--r--doc/string/bytes.rdoc7
-rw-r--r--doc/string/bytesize.rdoc12
-rw-r--r--doc/string/byteslice.rdoc54
-rw-r--r--doc/string/bytesplice.rdoc66
-rw-r--r--doc/string/capitalize.rdoc26
-rw-r--r--doc/string/center.rdoc19
-rw-r--r--doc/string/chars.rdoc7
-rw-r--r--doc/string/chomp.rdoc31
-rw-r--r--doc/string/chop.rdoc17
-rw-r--r--doc/string/chr.rdoc7
-rw-r--r--doc/string/codepoints.rdoc8
-rw-r--r--doc/string/concat.rdoc11
-rw-r--r--doc/string/count.rdoc74
-rw-r--r--doc/string/delete.rdoc75
-rw-r--r--doc/string/delete_prefix.rdoc9
-rw-r--r--doc/string/delete_suffix.rdoc10
-rw-r--r--doc/string/downcase.rdoc20
-rw-r--r--doc/string/dump.rdoc89
-rw-r--r--doc/string/each_byte.rdoc15
-rw-r--r--doc/string/each_char.rdoc17
-rw-r--r--doc/string/each_codepoint.rdoc18
-rw-r--r--doc/string/each_grapheme_cluster.rdoc19
-rw-r--r--doc/string/each_line.rdoc66
-rw-r--r--doc/string/encode.rdoc50
-rw-r--r--doc/string/end_with_p.rdoc9
-rw-r--r--doc/string/eql_p.rdoc18
-rw-r--r--doc/string/force_encoding.rdoc21
-rw-r--r--doc/string/getbyte.rdoc23
-rw-r--r--doc/string/grapheme_clusters.rdoc19
-rw-r--r--doc/string/hash.rdoc19
-rw-r--r--doc/string/index.rdoc38
-rw-r--r--doc/string/insert.rdoc15
-rw-r--r--doc/string/inspect.rdoc38
-rw-r--r--doc/string/intern.rdoc8
-rw-r--r--doc/string/length.rdoc11
-rw-r--r--doc/string/ljust.rdoc13
-rw-r--r--doc/string/new.rdoc51
-rw-r--r--doc/string/ord.rdoc7
-rw-r--r--doc/string/partition.rdoc43
-rw-r--r--doc/string/rindex.rdoc51
-rw-r--r--doc/string/rjust.rdoc17
-rw-r--r--doc/string/rpartition.rdoc47
-rw-r--r--doc/string/scan.rdoc35
-rw-r--r--doc/string/scrub.rdoc22
-rw-r--r--doc/string/split.rdoc101
-rw-r--r--doc/string/squeeze.rdoc33
-rw-r--r--doc/string/start_with_p.rdoc16
-rw-r--r--doc/string/sub.rdoc33
-rw-r--r--doc/string/succ.rdoc52
-rw-r--r--doc/string/sum.rdoc12
-rw-r--r--doc/string/swapcase.rdoc31
-rw-r--r--doc/string/unicode_normalize.rdoc28
-rw-r--r--doc/string/upcase.rdoc27
-rw-r--r--doc/string/upto.rdoc38
-rw-r--r--doc/string/valid_encoding_p.rdoc8
-rw-r--r--doc/stringio/each_byte.rdoc34
-rw-r--r--doc/stringio/each_char.rdoc34
-rw-r--r--doc/stringio/each_codepoint.rdoc36
-rw-r--r--doc/stringio/each_line.md189
-rw-r--r--doc/stringio/getbyte.rdoc31
-rw-r--r--doc/stringio/getc.rdoc34
-rw-r--r--doc/stringio/gets.rdoc99
-rw-r--r--doc/stringio/pread.rdoc65
-rw-r--r--doc/stringio/putc.rdoc82
-rw-r--r--doc/stringio/read.rdoc83
-rw-r--r--doc/stringio/size.rdoc5
-rw-r--r--doc/stringio/stringio.md700
-rw-r--r--doc/strscan/helper_methods.md124
-rw-r--r--doc/strscan/link_refs.txt17
-rw-r--r--doc/strscan/methods/get_byte.md30
-rw-r--r--doc/strscan/methods/get_charpos.md19
-rw-r--r--doc/strscan/methods/get_pos.md14
-rw-r--r--doc/strscan/methods/getch.md43
-rw-r--r--doc/strscan/methods/scan.md51
-rw-r--r--doc/strscan/methods/scan_until.md52
-rw-r--r--doc/strscan/methods/set_pos.md27
-rw-r--r--doc/strscan/methods/skip.md43
-rw-r--r--doc/strscan/methods/skip_until.md49
-rw-r--r--doc/strscan/methods/terminate.md30
-rw-r--r--doc/strscan/strscan.md544
-rw-r--r--doc/symbol/casecmp.rdoc27
-rw-r--r--doc/symbol/casecmp_p.rdoc26
-rw-r--r--doc/syntax.rdoc45
-rw-r--r--doc/syntax/assignment.rdoc485
-rw-r--r--doc/syntax/calling_methods.rdoc500
-rw-r--r--doc/syntax/comments.rdoc253
-rw-r--r--doc/syntax/control_expressions.rdoc639
-rw-r--r--doc/syntax/exceptions.rdoc106
-rw-r--r--doc/syntax/keywords.rdoc162
-rw-r--r--doc/syntax/layout.rdoc118
-rw-r--r--doc/syntax/literals.rdoc625
-rw-r--r--doc/syntax/methods.rdoc653
-rw-r--r--doc/syntax/miscellaneous.rdoc136
-rw-r--r--doc/syntax/modules_and_classes.rdoc398
-rw-r--r--doc/syntax/operators.rdoc75
-rw-r--r--doc/syntax/pattern_matching.rdoc528
-rw-r--r--doc/syntax/precedence.rdoc64
-rw-r--r--doc/syntax/refinements.rdoc281
-rw-r--r--doc/yarvarch.en7
-rw-r--r--doc/yarvarch.ja454
-rw-r--r--enc/Makefile.in95
-rw-r--r--enc/ascii.c110
-rw-r--r--enc/big5.c388
-rw-r--r--enc/cesu_8.c469
-rw-r--r--enc/cp949.c226
-rw-r--r--enc/depend10912
-rw-r--r--enc/ebcdic.h11
-rw-r--r--enc/emacs_mule.c346
-rw-r--r--enc/encdb.c26
-rw-r--r--enc/encinit.c.erb41
-rw-r--r--enc/euc_jp.c620
-rw-r--r--enc/euc_kr.c228
-rw-r--r--enc/euc_tw.c232
-rw-r--r--enc/gb18030.c607
-rw-r--r--enc/gb2312.c11
-rw-r--r--enc/gbk.c229
-rw-r--r--enc/iso_2022_jp.h47
-rw-r--r--enc/iso_8859.h1
-rw-r--r--enc/iso_8859_1.c328
-rw-r--r--enc/iso_8859_10.c300
-rw-r--r--enc/iso_8859_11.c118
-rw-r--r--enc/iso_8859_13.c295
-rw-r--r--enc/iso_8859_14.c311
-rw-r--r--enc/iso_8859_15.c302
-rw-r--r--enc/iso_8859_16.c306
-rw-r--r--enc/iso_8859_2.c297
-rw-r--r--enc/iso_8859_3.c307
-rw-r--r--enc/iso_8859_4.c303
-rw-r--r--enc/iso_8859_5.c271
-rw-r--r--enc/iso_8859_6.c114
-rw-r--r--enc/iso_8859_7.c290
-rw-r--r--enc/iso_8859_8.c114
-rw-r--r--enc/iso_8859_9.c296
-rw-r--r--enc/jis/props.h.blt216
-rw-r--r--enc/jis/props.kwd52
-rw-r--r--enc/jis/props.src52
-rw-r--r--enc/koi8_r.c225
-rw-r--r--enc/koi8_u.c228
-rwxr-xr-xenc/make_encmake.rb152
-rw-r--r--enc/mktable.c1184
-rw-r--r--enc/shift_jis.c71
-rw-r--r--enc/shift_jis.h546
-rw-r--r--enc/trans/CP/CP932UDA%UCS.src1912
-rw-r--r--enc/trans/CP/CP932VDC@IBM%UCS.src420
-rw-r--r--enc/trans/CP/CP932VDC@NEC_IBM%UCS.src406
-rw-r--r--enc/trans/CP/UCS%CP932UDA.src1912
-rw-r--r--enc/trans/CP/UCS%CP932VDC@IBM.src420
-rw-r--r--enc/trans/CP/UCS%CP932VDC@NEC_IBM.src406
-rw-r--r--enc/trans/EMOJI/EMOJI_ISO-2022-JP-KDDI%UCS.src658
-rw-r--r--enc/trans/EMOJI/EMOJI_SHIFT_JIS-DOCOMO%UCS.src293
-rw-r--r--enc/trans/EMOJI/EMOJI_SHIFT_JIS-KDDI%UCS.src658
-rw-r--r--enc/trans/EMOJI/EMOJI_SHIFT_JIS-KDDI-UNDOC%UCS.src658
-rw-r--r--enc/trans/EMOJI/EMOJI_SHIFT_JIS-SOFTBANK%UCS.src496
-rw-r--r--enc/trans/EMOJI/UCS%EMOJI_ISO-2022-JP-KDDI-UNDOC.src658
-rw-r--r--enc/trans/EMOJI/UCS%EMOJI_ISO-2022-JP-KDDI.src658
-rw-r--r--enc/trans/EMOJI/UCS%EMOJI_SHIFT_JIS-DOCOMO.src293
-rw-r--r--enc/trans/EMOJI/UCS%EMOJI_SHIFT_JIS-KDDI-UNDOC.src658
-rw-r--r--enc/trans/EMOJI/UCS%EMOJI_SHIFT_JIS-KDDI.src658
-rw-r--r--enc/trans/EMOJI/UCS%EMOJI_SHIFT_JIS-SOFTBANK.src496
-rw-r--r--enc/trans/GB/GB12345%UCS.src7567
-rw-r--r--enc/trans/GB/GB2312%UCS.src7470
-rw-r--r--enc/trans/GB/UCS%GB12345.src7569
-rw-r--r--enc/trans/GB/UCS%GB2312.src7466
-rw-r--r--enc/trans/JIS/JISX0201-KANA%UCS.src124
-rw-r--r--enc/trans/JIS/JISX0208@1990%UCS.src6964
-rw-r--r--enc/trans/JIS/JISX0208@MS%UCS.src6893
-rw-r--r--enc/trans/JIS/JISX0208UDC%UCS.src954
-rw-r--r--enc/trans/JIS/JISX0208VDC@NEC%UCS.src97
-rw-r--r--enc/trans/JIS/JISX0212%UCS.src6159
-rw-r--r--enc/trans/JIS/JISX0212@MS%UCS.src6081
-rw-r--r--enc/trans/JIS/JISX0212UDC%UCS.src954
-rw-r--r--enc/trans/JIS/JISX0212VDC@IBM%UCS.src120
-rw-r--r--enc/trans/JIS/JISX0213-1%UCS@BMP.src1926
-rw-r--r--enc/trans/JIS/JISX0213-1%UCS@SIP.src60
-rw-r--r--enc/trans/JIS/JISX0213-2%UCS@BMP.src2193
-rw-r--r--enc/trans/JIS/JISX0213-2%UCS@SIP.src311
-rw-r--r--enc/trans/JIS/UCS%JISX0201-KANA.src125
-rw-r--r--enc/trans/JIS/UCS%JISX0208@1990.src6965
-rw-r--r--enc/trans/JIS/UCS%JISX0208@MS.src6894
-rw-r--r--enc/trans/JIS/UCS%JISX0208UDC.src955
-rw-r--r--enc/trans/JIS/UCS%JISX0208VDC@NEC.src98
-rw-r--r--enc/trans/JIS/UCS%JISX0212.src6163
-rw-r--r--enc/trans/JIS/UCS%JISX0212@MS.src6082
-rw-r--r--enc/trans/JIS/UCS%JISX0212UDC.src955
-rw-r--r--enc/trans/JIS/UCS%JISX0212VDC@IBM.src121
-rw-r--r--enc/trans/JIS/UCS@BMP%JISX0213-1.src1922
-rw-r--r--enc/trans/JIS/UCS@BMP%JISX0213-2.src2189
-rw-r--r--enc/trans/JIS/UCS@SIP%JISX0213-1.src56
-rw-r--r--enc/trans/JIS/UCS@SIP%JISX0213-2.src307
-rw-r--r--enc/trans/big5-hkscs-tbl.rb37302
-rw-r--r--enc/trans/big5-uao-tbl.rb19784
-rw-r--r--enc/trans/big5.trans32
-rw-r--r--enc/trans/cesu_8.trans85
-rw-r--r--enc/trans/chinese.trans31
-rw-r--r--enc/trans/cp850-tbl.rb130
-rw-r--r--enc/trans/cp852-tbl.rb130
-rw-r--r--enc/trans/cp855-tbl.rb130
-rw-r--r--enc/trans/cp949-tbl.rb8831
-rw-r--r--enc/trans/ebcdic.trans278
-rw-r--r--enc/trans/emoji-exchange-tbl.rb8407
-rw-r--r--enc/trans/emoji.trans36
-rw-r--r--enc/trans/emoji_iso2022_kddi.trans216
-rw-r--r--enc/trans/emoji_sjis_docomo.trans32
-rw-r--r--enc/trans/emoji_sjis_kddi.trans33
-rw-r--r--enc/trans/emoji_sjis_softbank.trans32
-rw-r--r--enc/trans/escape.trans94
-rw-r--r--enc/trans/euckr-tbl.rb8230
-rw-r--r--enc/trans/gb18030-tbl.rb63362
-rw-r--r--enc/trans/gb18030.trans183
-rw-r--r--enc/trans/gbk-tbl.rb21794
-rw-r--r--enc/trans/gbk.trans15
-rw-r--r--enc/trans/ibm437-tbl.rb130
-rw-r--r--enc/trans/ibm720-tbl.rb122
-rw-r--r--enc/trans/ibm737-tbl.rb130
-rw-r--r--enc/trans/ibm775-tbl.rb130
-rw-r--r--enc/trans/ibm852-tbl.rb130
-rw-r--r--enc/trans/ibm855-tbl.rb130
-rw-r--r--enc/trans/ibm857-tbl.rb127
-rw-r--r--enc/trans/ibm860-tbl.rb130
-rw-r--r--enc/trans/ibm861-tbl.rb130
-rw-r--r--enc/trans/ibm862-tbl.rb130
-rw-r--r--enc/trans/ibm863-tbl.rb130
-rw-r--r--enc/trans/ibm864-tbl.rb126
-rw-r--r--enc/trans/ibm865-tbl.rb130
-rw-r--r--enc/trans/ibm866-tbl.rb130
-rw-r--r--enc/trans/ibm869-tbl.rb121
-rw-r--r--enc/trans/iso-8859-1-tbl.rb98
-rw-r--r--enc/trans/iso-8859-10-tbl.rb98
-rw-r--r--enc/trans/iso-8859-11-tbl.rb90
-rw-r--r--enc/trans/iso-8859-13-tbl.rb98
-rw-r--r--enc/trans/iso-8859-14-tbl.rb98
-rw-r--r--enc/trans/iso-8859-15-tbl.rb98
-rw-r--r--enc/trans/iso-8859-16-tbl.rb98
-rw-r--r--enc/trans/iso-8859-2-tbl.rb98
-rw-r--r--enc/trans/iso-8859-3-tbl.rb91
-rw-r--r--enc/trans/iso-8859-4-tbl.rb98
-rw-r--r--enc/trans/iso-8859-5-tbl.rb98
-rw-r--r--enc/trans/iso-8859-6-tbl.rb53
-rw-r--r--enc/trans/iso-8859-7-tbl.rb95
-rw-r--r--enc/trans/iso-8859-8-tbl.rb62
-rw-r--r--enc/trans/iso-8859-9-tbl.rb98
-rw-r--r--enc/trans/iso2022.trans565
-rw-r--r--enc/trans/japanese.trans97
-rw-r--r--enc/trans/japanese_euc.trans57
-rw-r--r--enc/trans/japanese_sjis.trans33
-rw-r--r--enc/trans/koi8-r-tbl.rb130
-rw-r--r--enc/trans/koi8-u-tbl.rb130
-rw-r--r--enc/trans/korean.trans18
-rw-r--r--enc/trans/maccroatian-tbl.rb129
-rw-r--r--enc/trans/maccyrillic-tbl.rb130
-rw-r--r--enc/trans/macgreek-tbl.rb129
-rw-r--r--enc/trans/maciceland-tbl.rb129
-rw-r--r--enc/trans/macroman-tbl.rb129
-rw-r--r--enc/trans/macromania-tbl.rb129
-rw-r--r--enc/trans/macturkish-tbl.rb128
-rw-r--r--enc/trans/macukraine-tbl.rb130
-rw-r--r--enc/trans/newline.trans155
-rw-r--r--enc/trans/single_byte.trans90
-rw-r--r--enc/trans/tis-620-tbl.rb89
-rw-r--r--enc/trans/transdb.c20
-rw-r--r--enc/trans/ucm/glibc-BIG5-2.3.3.ucm14087
-rw-r--r--enc/trans/ucm/glibc-BIG5HKSCS-2.3.3.ucm18332
-rw-r--r--enc/trans/ucm/windows-950-2000.ucm20379
-rw-r--r--enc/trans/ucm/windows-950_hkscs-2001.ucm23446
-rw-r--r--enc/trans/utf8_mac-tbl.rb23154
-rw-r--r--enc/trans/utf8_mac.trans256
-rw-r--r--enc/trans/utf_16_32.trans556
-rw-r--r--enc/trans/windows-1250-tbl.rb125
-rw-r--r--enc/trans/windows-1251-tbl.rb129
-rw-r--r--enc/trans/windows-1252-tbl.rb125
-rw-r--r--enc/trans/windows-1253-tbl.rb113
-rw-r--r--enc/trans/windows-1254-tbl.rb123
-rw-r--r--enc/trans/windows-1255-tbl.rb142
-rw-r--r--enc/trans/windows-1256-tbl.rb130
-rw-r--r--enc/trans/windows-1257-tbl.rb118
-rw-r--r--enc/trans/windows-874-tbl.rb99
-rw-r--r--enc/unicode.c818
-rw-r--r--enc/unicode/17.0.0/casefold.h8013
-rw-r--r--enc/unicode/17.0.0/name2ctype.h49725
-rw-r--r--enc/us_ascii.c45
-rw-r--r--enc/utf_16_32.h5
-rw-r--r--enc/utf_16be.c260
-rw-r--r--enc/utf_16le.c252
-rw-r--r--enc/utf_32be.c210
-rw-r--r--enc/utf_32le.c210
-rw-r--r--enc/utf_7.h5
-rw-r--r--enc/utf_8.c453
-rw-r--r--enc/windows_1250.c277
-rw-r--r--enc/windows_1251.c259
-rw-r--r--enc/windows_1252.c266
-rw-r--r--enc/windows_1253.c303
-rw-r--r--enc/windows_1254.c308
-rw-r--r--enc/windows_1257.c310
-rw-r--r--enc/windows_31j.c85
-rw-r--r--enc/x_emoji.h26
-rw-r--r--encindex.h70
-rw-r--r--encoding.c2062
-rw-r--r--enum.c5453
-rw-r--r--enumerator.c4777
-rw-r--r--env.h60
-rw-r--r--error.c4725
-rw-r--r--eval.c13284
-rw-r--r--eval_error.c557
-rw-r--r--eval_intern.h331
-rw-r--r--eval_jump.c138
-rw-r--r--ext/-test-/RUBY_ALIGNOF/c.c15
-rw-r--r--ext/-test-/RUBY_ALIGNOF/cpp.cpp9
-rw-r--r--ext/-test-/RUBY_ALIGNOF/depend163
-rw-r--r--ext/-test-/RUBY_ALIGNOF/extconf.rb6
-rw-r--r--ext/-test-/abi/abi.c11
-rw-r--r--ext/-test-/abi/depend3
-rw-r--r--ext/-test-/abi/extconf.rb4
-rw-r--r--ext/-test-/arith_seq/beg_len_step/beg_len_step.c19
-rw-r--r--ext/-test-/arith_seq/beg_len_step/depend162
-rw-r--r--ext/-test-/arith_seq/beg_len_step/extconf.rb2
-rw-r--r--ext/-test-/arith_seq/extract/depend162
-rw-r--r--ext/-test-/arith_seq/extract/extconf.rb2
-rw-r--r--ext/-test-/arith_seq/extract/extract.c27
-rw-r--r--ext/-test-/array/concat/depend163
-rw-r--r--ext/-test-/array/concat/extconf.rb2
-rw-r--r--ext/-test-/array/concat/to_ary_concat.c38
-rw-r--r--ext/-test-/array/resize/depend162
-rw-r--r--ext/-test-/array/resize/extconf.rb2
-rw-r--r--ext/-test-/array/resize/resize.c16
-rw-r--r--ext/-test-/auto_ext.rb11
-rw-r--r--ext/-test-/bignum/big2str.c53
-rw-r--r--ext/-test-/bignum/bigzero.c26
-rw-r--r--ext/-test-/bignum/depend1141
-rw-r--r--ext/-test-/bignum/div.c35
-rw-r--r--ext/-test-/bignum/extconf.rb3
-rw-r--r--ext/-test-/bignum/init.c11
-rw-r--r--ext/-test-/bignum/intpack.c87
-rw-r--r--ext/-test-/bignum/mul.c65
-rw-r--r--ext/-test-/bignum/str2big.c38
-rw-r--r--ext/-test-/box/yay1/extconf.rb1
-rw-r--r--ext/-test-/box/yay1/yay1.c28
-rw-r--r--ext/-test-/box/yay1/yay1.def3
-rw-r--r--ext/-test-/box/yay1/yay1.h4
-rw-r--r--ext/-test-/box/yay2/extconf.rb1
-rw-r--r--ext/-test-/box/yay2/yay2.c28
-rw-r--r--ext/-test-/box/yay2/yay2.def3
-rw-r--r--ext/-test-/box/yay2/yay2.h4
-rw-r--r--ext/-test-/bug-14834/bug-14834.c39
-rw-r--r--ext/-test-/bug-14834/depend163
-rw-r--r--ext/-test-/bug-14834/extconf.rb2
-rw-r--r--ext/-test-/bug-3571/bug.c23
-rw-r--r--ext/-test-/bug-3571/depend163
-rw-r--r--ext/-test-/bug-3571/extconf.rb2
-rw-r--r--ext/-test-/bug-5832/bug.c14
-rw-r--r--ext/-test-/bug-5832/depend163
-rw-r--r--ext/-test-/bug-5832/extconf.rb2
-rw-r--r--ext/-test-/bug_reporter/bug_reporter.c24
-rw-r--r--ext/-test-/bug_reporter/depend163
-rw-r--r--ext/-test-/bug_reporter/extconf.rb2
-rw-r--r--ext/-test-/class/class2name.c14
-rw-r--r--ext/-test-/class/depend323
-rw-r--r--ext/-test-/class/extconf.rb3
-rw-r--r--ext/-test-/class/init.c12
-rw-r--r--ext/-test-/cxxanyargs/cxxanyargs.cpp935
-rw-r--r--ext/-test-/cxxanyargs/depend13
-rw-r--r--ext/-test-/cxxanyargs/extconf.rb46
-rw-r--r--ext/-test-/cxxanyargs/failure.cpp13
-rw-r--r--ext/-test-/cxxanyargs/failurem1.cpp13
-rw-r--r--ext/-test-/debug/depend485
-rw-r--r--ext/-test-/debug/extconf.rb3
-rw-r--r--ext/-test-/debug/init.c11
-rw-r--r--ext/-test-/debug/inspector.c32
-rw-r--r--ext/-test-/debug/profile_frames.c65
-rw-r--r--ext/-test-/dln/empty/depend163
-rw-r--r--ext/-test-/dln/empty/empty.c6
-rw-r--r--ext/-test-/dln/empty/extconf.rb2
-rw-r--r--ext/-test-/econv/append.c17
-rw-r--r--ext/-test-/econv/depend336
-rw-r--r--ext/-test-/econv/extconf.rb3
-rw-r--r--ext/-test-/econv/init.c11
-rw-r--r--ext/-test-/ensure_and_callcc/depend163
-rw-r--r--ext/-test-/ensure_and_callcc/ensure_and_callcc.c58
-rw-r--r--ext/-test-/ensure_and_callcc/extconf.rb5
-rw-r--r--ext/-test-/enumerator_kw/depend163
-rw-r--r--ext/-test-/enumerator_kw/enumerator_kw.c22
-rw-r--r--ext/-test-/enumerator_kw/extconf.rb1
-rw-r--r--ext/-test-/eval/depend162
-rw-r--r--ext/-test-/eval/eval.c13
-rw-r--r--ext/-test-/eval/extconf.rb2
-rw-r--r--ext/-test-/exception/dataerror.c31
-rw-r--r--ext/-test-/exception/depend657
-rw-r--r--ext/-test-/exception/enc_raise.c15
-rw-r--r--ext/-test-/exception/ensured.c39
-rw-r--r--ext/-test-/exception/extconf.rb3
-rw-r--r--ext/-test-/exception/init.c11
-rw-r--r--ext/-test-/fatal/depend486
-rw-r--r--ext/-test-/fatal/extconf.rb3
-rw-r--r--ext/-test-/fatal/init.c10
-rw-r--r--ext/-test-/fatal/invalid.c22
-rw-r--r--ext/-test-/fatal/rb_fatal.c19
-rw-r--r--ext/-test-/file/depend682
-rw-r--r--ext/-test-/file/extconf.rb18
-rw-r--r--ext/-test-/file/fs.c111
-rw-r--r--ext/-test-/file/init.c11
-rw-r--r--ext/-test-/file/newline_conv.c73
-rw-r--r--ext/-test-/file/stat.c27
-rw-r--r--ext/-test-/float/depend328
-rw-r--r--ext/-test-/float/extconf.rb3
-rw-r--r--ext/-test-/float/init.c11
-rw-r--r--ext/-test-/float/nextafter.c36
-rw-r--r--ext/-test-/funcall/depend163
-rw-r--r--ext/-test-/funcall/extconf.rb3
-rw-r--r--ext/-test-/funcall/funcall.c72
-rw-r--r--ext/-test-/gvl/call_without_gvl/call_without_gvl.c78
-rw-r--r--ext/-test-/gvl/call_without_gvl/depend163
-rw-r--r--ext/-test-/gvl/call_without_gvl/extconf.rb2
-rw-r--r--ext/-test-/hash/delete.c16
-rw-r--r--ext/-test-/hash/depend324
-rw-r--r--ext/-test-/hash/extconf.rb3
-rw-r--r--ext/-test-/hash/init.c11
-rw-r--r--ext/-test-/integer/core_ext.c36
-rw-r--r--ext/-test-/integer/depend493
-rw-r--r--ext/-test-/integer/extconf.rb3
-rw-r--r--ext/-test-/integer/init.c11
-rw-r--r--ext/-test-/integer/my_integer.c20
-rw-r--r--ext/-test-/iseq_load/depend163
-rw-r--r--ext/-test-/iseq_load/extconf.rb2
-rw-r--r--ext/-test-/iseq_load/iseq_load.c21
-rw-r--r--ext/-test-/iter/break.c25
-rw-r--r--ext/-test-/iter/depend485
-rw-r--r--ext/-test-/iter/extconf.rb3
-rw-r--r--ext/-test-/iter/init.c11
-rw-r--r--ext/-test-/iter/yield.c16
-rw-r--r--ext/-test-/load/dot.dot/depend163
-rw-r--r--ext/-test-/load/dot.dot/dot.dot.c3
-rw-r--r--ext/-test-/load/dot.dot/extconf.rb2
-rw-r--r--ext/-test-/load/protect/depend163
-rw-r--r--ext/-test-/load/protect/extconf.rb1
-rw-r--r--ext/-test-/load/protect/protect.c19
-rw-r--r--ext/-test-/load/resolve_symbol_resolver/depend163
-rw-r--r--ext/-test-/load/resolve_symbol_resolver/extconf.rb1
-rw-r--r--ext/-test-/load/resolve_symbol_resolver/resolve_symbol_resolver.c56
-rw-r--r--ext/-test-/load/resolve_symbol_target/depend164
-rw-r--r--ext/-test-/load/resolve_symbol_target/extconf.rb1
-rw-r--r--ext/-test-/load/resolve_symbol_target/resolve_symbol_target.c15
-rw-r--r--ext/-test-/load/resolve_symbol_target/resolve_symbol_target.h4
-rw-r--r--ext/-test-/load/stringify_symbols/depend164
-rw-r--r--ext/-test-/load/stringify_symbols/extconf.rb1
-rw-r--r--ext/-test-/load/stringify_symbols/stringify_symbols.c29
-rw-r--r--ext/-test-/load/stringify_target/depend164
-rw-r--r--ext/-test-/load/stringify_target/extconf.rb1
-rw-r--r--ext/-test-/load/stringify_target/stringify_target.c15
-rw-r--r--ext/-test-/load/stringify_target/stringify_target.h4
-rw-r--r--ext/-test-/marshal/compat/depend163
-rw-r--r--ext/-test-/marshal/compat/extconf.rb2
-rw-r--r--ext/-test-/marshal/compat/usrcompat.c32
-rw-r--r--ext/-test-/marshal/internal_ivar/depend163
-rw-r--r--ext/-test-/marshal/internal_ivar/extconf.rb2
-rw-r--r--ext/-test-/marshal/internal_ivar/internal_ivar.c54
-rw-r--r--ext/-test-/marshal/usr/depend163
-rw-r--r--ext/-test-/marshal/usr/extconf.rb2
-rw-r--r--ext/-test-/marshal/usr/usrmarshal.c50
-rw-r--r--ext/-test-/memory_status/depend162
-rw-r--r--ext/-test-/memory_status/extconf.rb12
-rw-r--r--ext/-test-/memory_status/memory_status.c80
-rw-r--r--ext/-test-/memory_view/depend164
-rw-r--r--ext/-test-/memory_view/extconf.rb5
-rw-r--r--ext/-test-/memory_view/memory_view.c450
-rw-r--r--ext/-test-/method/arity.c22
-rw-r--r--ext/-test-/method/depend324
-rw-r--r--ext/-test-/method/extconf.rb3
-rw-r--r--ext/-test-/method/init.c11
-rw-r--r--ext/-test-/notimplement/bug.c18
-rw-r--r--ext/-test-/notimplement/depend163
-rw-r--r--ext/-test-/notimplement/extconf.rb2
-rw-r--r--ext/-test-/num2int/depend163
-rw-r--r--ext/-test-/num2int/extconf.rb2
-rw-r--r--ext/-test-/num2int/num2int.c136
-rw-r--r--ext/-test-/path_to_class/depend163
-rw-r--r--ext/-test-/path_to_class/extconf.rb7
-rw-r--r--ext/-test-/path_to_class/path_to_class.c15
-rw-r--r--ext/-test-/popen_deadlock/depend164
-rw-r--r--ext/-test-/popen_deadlock/extconf.rb6
-rw-r--r--ext/-test-/popen_deadlock/infinite_loop_dlsym.c50
-rw-r--r--ext/-test-/postponed_job/depend164
-rw-r--r--ext/-test-/postponed_job/extconf.rb2
-rw-r--r--ext/-test-/postponed_job/postponed_job.c231
-rw-r--r--ext/-test-/printf/depend175
-rw-r--r--ext/-test-/printf/extconf.rb2
-rw-r--r--ext/-test-/printf/printf.c109
-rw-r--r--ext/-test-/proc/depend485
-rw-r--r--ext/-test-/proc/extconf.rb3
-rw-r--r--ext/-test-/proc/init.c11
-rw-r--r--ext/-test-/proc/receiver.c21
-rw-r--r--ext/-test-/proc/super.c27
-rw-r--r--ext/-test-/public_header_warnings/extconf.rb28
-rw-r--r--ext/-test-/random/bad_version.c135
-rw-r--r--ext/-test-/random/depend485
-rw-r--r--ext/-test-/random/extconf.rb3
-rw-r--r--ext/-test-/random/init.c11
-rw-r--r--ext/-test-/random/loop.c120
-rw-r--r--ext/-test-/rational/depend180
-rw-r--r--ext/-test-/rational/extconf.rb8
-rw-r--r--ext/-test-/rational/rat.c48
-rw-r--r--ext/-test-/rb_call_super_kw/depend163
-rw-r--r--ext/-test-/rb_call_super_kw/extconf.rb1
-rw-r--r--ext/-test-/rb_call_super_kw/rb_call_super_kw.c15
-rw-r--r--ext/-test-/recursion/depend163
-rw-r--r--ext/-test-/recursion/extconf.rb3
-rw-r--r--ext/-test-/recursion/recursion.c28
-rw-r--r--ext/-test-/regexp/depend325
-rw-r--r--ext/-test-/regexp/extconf.rb3
-rw-r--r--ext/-test-/regexp/init.c11
-rw-r--r--ext/-test-/regexp/parse_depth_limit.c23
-rw-r--r--ext/-test-/sanitizers/depend162
-rw-r--r--ext/-test-/sanitizers/extconf.rb2
-rw-r--r--ext/-test-/sanitizers/sanitizers.c36
-rw-r--r--ext/-test-/scan_args/depend163
-rw-r--r--ext/-test-/scan_args/extconf.rb1
-rw-r--r--ext/-test-/scan_args/scan_args.c305
-rw-r--r--ext/-test-/scheduler/extconf.rb2
-rw-r--r--ext/-test-/scheduler/scheduler.c92
-rw-r--r--ext/-test-/st/foreach/depend163
-rw-r--r--ext/-test-/st/foreach/extconf.rb2
-rw-r--r--ext/-test-/st/foreach/foreach.c175
-rw-r--r--ext/-test-/st/numhash/depend163
-rw-r--r--ext/-test-/st/numhash/extconf.rb2
-rw-r--r--ext/-test-/st/numhash/numhash.c137
-rw-r--r--ext/-test-/st/update/depend163
-rw-r--r--ext/-test-/st/update/extconf.rb2
-rw-r--r--ext/-test-/st/update/update.c34
-rw-r--r--ext/-test-/stack/depend179
-rw-r--r--ext/-test-/stack/extconf.rb3
-rw-r--r--ext/-test-/stack/stack.c35
-rw-r--r--ext/-test-/string/capacity.c18
-rw-r--r--ext/-test-/string/coderange.c47
-rw-r--r--ext/-test-/string/cstr.c146
-rw-r--r--ext/-test-/string/depend3030
-rw-r--r--ext/-test-/string/ellipsize.c13
-rw-r--r--ext/-test-/string/enc_associate.c22
-rw-r--r--ext/-test-/string/enc_dummy.c15
-rw-r--r--ext/-test-/string/enc_str_buf_cat.c28
-rw-r--r--ext/-test-/string/extconf.rb3
-rw-r--r--ext/-test-/string/fstring.c38
-rw-r--r--ext/-test-/string/init.c11
-rw-r--r--ext/-test-/string/modify.c22
-rw-r--r--ext/-test-/string/new.c21
-rw-r--r--ext/-test-/string/nofree.c13
-rw-r--r--ext/-test-/string/normalize.c17
-rw-r--r--ext/-test-/string/qsort.c61
-rw-r--r--ext/-test-/string/rb_interned_str.c14
-rw-r--r--ext/-test-/string/rb_str_dup.c35
-rw-r--r--ext/-test-/string/set_len.c32
-rw-r--r--ext/-test-/struct/data.c13
-rw-r--r--ext/-test-/struct/depend807
-rw-r--r--ext/-test-/struct/duplicate.c24
-rw-r--r--ext/-test-/struct/extconf.rb3
-rw-r--r--ext/-test-/struct/init.c11
-rw-r--r--ext/-test-/struct/len.c13
-rw-r--r--ext/-test-/struct/member.c18
-rw-r--r--ext/-test-/symbol/depend324
-rw-r--r--ext/-test-/symbol/extconf.rb4
-rw-r--r--ext/-test-/symbol/init.c39
-rw-r--r--ext/-test-/symbol/type.c78
-rw-r--r--ext/-test-/thread/id/depend163
-rw-r--r--ext/-test-/thread/id/extconf.rb3
-rw-r--r--ext/-test-/thread/id/id.c15
-rw-r--r--ext/-test-/thread/instrumentation/depend165
-rw-r--r--ext/-test-/thread/instrumentation/extconf.rb2
-rw-r--r--ext/-test-/thread/instrumentation/instrumentation.c218
-rw-r--r--ext/-test-/thread/lock_native_thread/depend163
-rw-r--r--ext/-test-/thread/lock_native_thread/extconf.rb2
-rw-r--r--ext/-test-/thread/lock_native_thread/lock_native_thread.c50
-rw-r--r--ext/-test-/time/depend490
-rw-r--r--ext/-test-/time/extconf.rb3
-rw-r--r--ext/-test-/time/init.c11
-rw-r--r--ext/-test-/time/new.c34
-rw-r--r--ext/-test-/tracepoint/depend324
-rw-r--r--ext/-test-/tracepoint/extconf.rb2
-rw-r--r--ext/-test-/tracepoint/gc_hook.c89
-rw-r--r--ext/-test-/tracepoint/tracepoint.c98
-rw-r--r--ext/-test-/typeddata/depend163
-rw-r--r--ext/-test-/typeddata/extconf.rb2
-rw-r--r--ext/-test-/typeddata/typeddata.c44
-rw-r--r--ext/-test-/vm/at_exit.c44
-rw-r--r--ext/-test-/vm/depend163
-rw-r--r--ext/-test-/vm/extconf.rb1
-rw-r--r--ext/-test-/wait/depend175
-rw-r--r--ext/-test-/wait/extconf.rb2
-rw-r--r--ext/-test-/wait/wait.c39
-rw-r--r--ext/-test-/win32/console/attribute.c69
-rw-r--r--ext/-test-/win32/console/depend1
-rw-r--r--ext/-test-/win32/console/extconf.rb5
-rw-r--r--ext/-test-/win32/console/init.c11
-rw-r--r--ext/-test-/win32/dln/depend9
-rw-r--r--ext/-test-/win32/dln/dlntest.c17
-rw-r--r--ext/-test-/win32/dln/extconf.rb34
-rw-r--r--ext/-test-/win32/dln/libdlntest.c4
-rw-r--r--ext/-test-/win32/dln/libdlntest.def2
-rw-r--r--ext/-test-/win32/fd_setsize/depend1
-rw-r--r--ext/-test-/win32/fd_setsize/extconf.rb4
-rw-r--r--ext/-test-/win32/fd_setsize/fd_setsize.c55
-rw-r--r--ext/.cvsignore2
-rw-r--r--ext/.document101
-rw-r--r--ext/Setup30
-rw-r--r--ext/Setup.atheos17
-rw-r--r--ext/Setup.dj33
-rw-r--r--ext/Setup.emx33
-rw-r--r--ext/Setup.nt18
-rw-r--r--ext/Setup.x6833
-rw-r--r--ext/Win32API/.cvsignore3
-rw-r--r--ext/Win32API/MANIFEST8
-rw-r--r--ext/Win32API/Win32API.c212
-rw-r--r--ext/Win32API/depend1
-rw-r--r--ext/Win32API/extconf.rb5
-rw-r--r--ext/Win32API/getch.rb5
-rw-r--r--ext/Win32API/lib/win32/registry.rb831
-rw-r--r--ext/Win32API/lib/win32/resolv.rb366
-rw-r--r--ext/Win32API/point.rb18
-rw-r--r--ext/bigdecimal/.cvsignore3
-rw-r--r--ext/bigdecimal/MANIFEST18
-rw-r--r--ext/bigdecimal/README60
-rw-r--r--ext/bigdecimal/bigdecimal.c4057
-rw-r--r--ext/bigdecimal/bigdecimal.def2
-rw-r--r--ext/bigdecimal/bigdecimal.h216
-rw-r--r--ext/bigdecimal/bigdecimal_en.html797
-rw-r--r--ext/bigdecimal/bigdecimal_ja.html798
-rw-r--r--ext/bigdecimal/depend1
-rw-r--r--ext/bigdecimal/extconf.rb2
-rw-r--r--ext/bigdecimal/lib/bigdecimal/jacobian.rb63
-rw-r--r--ext/bigdecimal/lib/bigdecimal/ludcmp.rb77
-rw-r--r--ext/bigdecimal/lib/bigdecimal/math.rb196
-rw-r--r--ext/bigdecimal/lib/bigdecimal/newton.rb75
-rw-r--r--ext/bigdecimal/lib/bigdecimal/nlsolve.rb38
-rw-r--r--ext/bigdecimal/lib/bigdecimal/util.rb68
-rw-r--r--ext/bigdecimal/sample/linear.rb71
-rw-r--r--ext/bigdecimal/sample/nlsolve.rb38
-rw-r--r--ext/bigdecimal/sample/pi.rb20
-rw-r--r--ext/cgi/escape/depend175
-rw-r--r--ext/cgi/escape/escape.c487
-rw-r--r--ext/cgi/escape/extconf.rb7
-rw-r--r--ext/continuation/continuation.c13
-rw-r--r--ext/continuation/depend162
-rw-r--r--ext/continuation/extconf.rb4
-rw-r--r--ext/coverage/coverage.c632
-rw-r--r--ext/coverage/depend210
-rw-r--r--ext/coverage/extconf.rb5
-rw-r--r--ext/coverage/lib/coverage.rb19
-rw-r--r--ext/curses/.cvsignore3
-rw-r--r--ext/curses/MANIFEST9
-rw-r--r--ext/curses/curses.c2023
-rw-r--r--ext/curses/depend1
-rw-r--r--ext/curses/extconf.rb31
-rw-r--r--ext/curses/hello.rb30
-rw-r--r--ext/curses/mouse.rb53
-rw-r--r--ext/curses/rain.rb76
-rw-r--r--ext/curses/view.rb91
-rw-r--r--ext/curses/view2.rb115
-rw-r--r--ext/date/date.gemspec36
-rw-r--r--ext/date/date_core.c10258
-rw-r--r--ext/date/date_parse.c3086
-rw-r--r--ext/date/date_strftime.c638
-rw-r--r--ext/date/date_strptime.c704
-rw-r--r--ext/date/date_tmx.h56
-rw-r--r--ext/date/depend692
-rw-r--r--ext/date/extconf.rb13
-rw-r--r--ext/date/lib/date.rb70
-rw-r--r--ext/date/prereq.mk19
-rw-r--r--ext/date/update-abbr52
-rw-r--r--ext/date/zonetab.h1564
-rw-r--r--ext/date/zonetab.list330
-rw-r--r--ext/dbm/.cvsignore3
-rw-r--r--ext/dbm/MANIFEST5
-rw-r--r--ext/dbm/dbm.c811
-rw-r--r--ext/dbm/depend1
-rw-r--r--ext/dbm/extconf.rb61
-rw-r--r--ext/dbm/testdbm.rb593
-rw-r--r--ext/digest/.cvsignore3
-rw-r--r--ext/digest/.document3
-rw-r--r--ext/digest/MANIFEST11
-rw-r--r--ext/digest/bubblebabble/bubblebabble.c146
-rw-r--r--ext/digest/bubblebabble/depend164
-rw-r--r--ext/digest/bubblebabble/extconf.rb4
-rw-r--r--ext/digest/defs.h36
-rw-r--r--ext/digest/depend166
-rw-r--r--ext/digest/digest.c909
-rw-r--r--ext/digest/digest.gemspec44
-rw-r--r--ext/digest/digest.h100
-rw-r--r--ext/digest/digest.txt113
-rw-r--r--ext/digest/digest.txt.ja111
-rw-r--r--ext/digest/digest_conf.rb19
-rw-r--r--ext/digest/extconf.rb5
-rw-r--r--ext/digest/lib/digest.rb123
-rw-r--r--ext/digest/lib/digest/loader.rb3
-rw-r--r--ext/digest/lib/digest/version.rb6
-rw-r--r--ext/digest/lib/md5.rb14
-rw-r--r--ext/digest/lib/sha1.rb14
-rw-r--r--ext/digest/md5/.cvsignore3
-rw-r--r--ext/digest/md5/MANIFEST8
-rw-r--r--ext/digest/md5/depend339
-rw-r--r--ext/digest/md5/extconf.rb19
-rw-r--r--ext/digest/md5/md5.c42
-rw-r--r--ext/digest/md5/md5.h13
-rw-r--r--ext/digest/md5/md5cc.h27
-rw-r--r--ext/digest/md5/md5init.c60
-rw-r--r--ext/digest/md5/md5ossl.c30
-rw-r--r--ext/digest/md5/md5ossl.h11
-rw-r--r--ext/digest/rmd160/.cvsignore3
-rw-r--r--ext/digest/rmd160/MANIFEST9
-rw-r--r--ext/digest/rmd160/depend340
-rw-r--r--ext/digest/rmd160/extconf.rb20
-rw-r--r--ext/digest/rmd160/rmd160.c25
-rw-r--r--ext/digest/rmd160/rmd160.h22
-rw-r--r--ext/digest/rmd160/rmd160hl.c96
-rw-r--r--ext/digest/rmd160/rmd160init.c62
-rw-r--r--ext/digest/rmd160/rmd160ossl.c45
-rw-r--r--ext/digest/rmd160/rmd160ossl.h20
-rw-r--r--ext/digest/sha1/.cvsignore3
-rw-r--r--ext/digest/sha1/MANIFEST9
-rw-r--r--ext/digest/sha1/depend341
-rw-r--r--ext/digest/sha1/extconf.rb18
-rw-r--r--ext/digest/sha1/sha1.c32
-rw-r--r--ext/digest/sha1/sha1.h25
-rw-r--r--ext/digest/sha1/sha1cc.h22
-rw-r--r--ext/digest/sha1/sha1hl.c102
-rw-r--r--ext/digest/sha1/sha1init.c64
-rw-r--r--ext/digest/sha1/sha1ossl.c45
-rw-r--r--ext/digest/sha1/sha1ossl.h16
-rw-r--r--ext/digest/sha2/.cvsignore3
-rw-r--r--ext/digest/sha2/MANIFEST7
-rw-r--r--ext/digest/sha2/depend339
-rw-r--r--ext/digest/sha2/extconf.rb27
-rw-r--r--ext/digest/sha2/lib/sha2.rb142
-rw-r--r--ext/digest/sha2/lib/sha2/loader.rb3
-rw-r--r--ext/digest/sha2/sha2.c318
-rw-r--r--ext/digest/sha2/sha2.h194
-rw-r--r--ext/digest/sha2/sha2cc.h70
-rw-r--r--ext/digest/sha2/sha2hl.c252
-rw-r--r--ext/digest/sha2/sha2init.c79
-rw-r--r--ext/digest/test.sh33
-rw-r--r--ext/dl/.cvsignore8
-rw-r--r--ext/dl/MANIFEST31
-rw-r--r--ext/dl/depend46
-rw-r--r--ext/dl/dl.c714
-rw-r--r--ext/dl/dl.def59
-rw-r--r--ext/dl/dl.h313
-rw-r--r--ext/dl/doc/dl.txt266
-rw-r--r--ext/dl/extconf.rb193
-rw-r--r--ext/dl/h2rb500
-rw-r--r--ext/dl/handle.c215
-rw-r--r--ext/dl/install.rb49
-rw-r--r--ext/dl/lib/dl/import.rb219
-rw-r--r--ext/dl/lib/dl/struct.rb146
-rw-r--r--ext/dl/lib/dl/types.rb179
-rw-r--r--ext/dl/lib/dl/win32.rb25
-rw-r--r--ext/dl/mkcall.rb62
-rw-r--r--ext/dl/mkcallback.rb53
-rw-r--r--ext/dl/mkcbtable.rb18
-rw-r--r--ext/dl/ptr.c1065
-rw-r--r--ext/dl/sample/c++sample.C35
-rw-r--r--ext/dl/sample/c++sample.rb60
-rw-r--r--ext/dl/sample/drives.rb70
-rw-r--r--ext/dl/sample/getch.rb5
-rw-r--r--ext/dl/sample/libc.rb69
-rw-r--r--ext/dl/sample/msgbox.rb19
-rw-r--r--ext/dl/sample/msgbox2.rb18
-rw-r--r--ext/dl/sample/stream.rb87
-rw-r--r--ext/dl/sym.c990
-rw-r--r--ext/dl/test/libtest.def28
-rw-r--r--ext/dl/test/test.c247
-rw-r--r--ext/dl/test/test.rb295
-rw-r--r--ext/dl/type.rb115
-rw-r--r--ext/enumerator/.cvsignore2
-rw-r--r--ext/enumerator/MANIFEST3
-rw-r--r--ext/enumerator/enumerator.c201
-rw-r--r--ext/enumerator/enumerator.txt102
-rw-r--r--ext/erb/escape/escape.c114
-rw-r--r--ext/erb/escape/extconf.rb9
-rw-r--r--ext/etc/.cvsignore3
-rw-r--r--ext/etc/.document2
-rw-r--r--ext/etc/MANIFEST6
-rw-r--r--ext/etc/depend183
-rw-r--r--ext/etc/etc.c1170
-rw-r--r--ext/etc/etc.gemspec44
-rw-r--r--ext/etc/etc.txt72
-rw-r--r--ext/etc/etc.txt.ja72
-rw-r--r--ext/etc/extconf.rb61
-rw-r--r--ext/etc/mkconstants.rb352
-rwxr-xr-x[-rw-r--r--]ext/extmk.rb890
-rw-r--r--ext/fcntl/.cvsignore3
-rw-r--r--ext/fcntl/MANIFEST3
-rw-r--r--ext/fcntl/depend164
-rw-r--r--ext/fcntl/extconf.rb3
-rw-r--r--ext/fcntl/fcntl.c210
-rw-r--r--ext/fcntl/fcntl.gemspec32
-rw-r--r--ext/gdbm/.cvsignore3
-rw-r--r--ext/gdbm/MANIFEST6
-rw-r--r--ext/gdbm/README1
-rw-r--r--ext/gdbm/depend1
-rw-r--r--ext/gdbm/extconf.rb7
-rw-r--r--ext/gdbm/gdbm.c1030
-rw-r--r--ext/gdbm/testgdbm.rb663
-rw-r--r--ext/iconv/.cvsignore5
-rw-r--r--ext/iconv/MANIFEST5
-rw-r--r--ext/iconv/charset_alias.rb52
-rw-r--r--ext/iconv/depend2
-rw-r--r--ext/iconv/extconf.rb49
-rw-r--r--ext/iconv/iconv.c885
-rw-r--r--ext/io/console/.document2
-rwxr-xr-xext/io/console/buildgem.sh5
-rw-r--r--ext/io/console/console.c2022
-rw-r--r--ext/io/console/depend199
-rw-r--r--ext/io/console/extconf.rb61
-rw-r--r--ext/io/console/io-console.gemspec53
-rw-r--r--ext/io/console/lib/console/size.rb23
-rw-r--r--ext/io/console/win32_vk.chksum1
-rw-r--r--ext/io/console/win32_vk.inc1390
-rw-r--r--ext/io/console/win32_vk.list166
-rw-r--r--ext/io/nonblock/depend176
-rw-r--r--ext/io/nonblock/extconf.rb16
-rw-r--r--ext/io/nonblock/io-nonblock.gemspec25
-rw-r--r--ext/io/nonblock/nonblock.c210
-rw-r--r--ext/io/wait/.cvsignore2
-rw-r--r--ext/io/wait/MANIFEST4
-rw-r--r--ext/io/wait/depend176
-rw-r--r--ext/io/wait/extconf.rb12
-rw-r--r--ext/io/wait/io-wait.gemspec39
-rw-r--r--ext/io/wait/lib/nonblock.rb23
-rw-r--r--ext/io/wait/wait.c91
-rw-r--r--ext/json/depend2
-rw-r--r--ext/json/extconf.rb3
-rw-r--r--ext/json/fbuffer/fbuffer.h247
-rw-r--r--ext/json/generator/depend186
-rw-r--r--ext/json/generator/extconf.rb16
-rw-r--r--ext/json/generator/generator.c2222
-rw-r--r--ext/json/json.gemspec62
-rw-r--r--ext/json/json.h101
-rw-r--r--ext/json/lib/json.rb654
-rw-r--r--ext/json/lib/json/add/bigdecimal.rb58
-rw-r--r--ext/json/lib/json/add/complex.rb51
-rw-r--r--ext/json/lib/json/add/core.rb13
-rw-r--r--ext/json/lib/json/add/date.rb54
-rw-r--r--ext/json/lib/json/add/date_time.rb67
-rw-r--r--ext/json/lib/json/add/exception.rb49
-rw-r--r--ext/json/lib/json/add/ostruct.rb54
-rw-r--r--ext/json/lib/json/add/range.rb54
-rw-r--r--ext/json/lib/json/add/rational.rb49
-rw-r--r--ext/json/lib/json/add/regexp.rb48
-rw-r--r--ext/json/lib/json/add/set.rb48
-rw-r--r--ext/json/lib/json/add/string.rb35
-rw-r--r--ext/json/lib/json/add/struct.rb52
-rw-r--r--ext/json/lib/json/add/symbol.rb52
-rw-r--r--ext/json/lib/json/add/time.rb52
-rw-r--r--ext/json/lib/json/common.rb1142
-rw-r--r--ext/json/lib/json/ext.rb45
-rw-r--r--ext/json/lib/json/ext/generator/state.rb103
-rw-r--r--ext/json/lib/json/generic_object.rb67
-rw-r--r--ext/json/lib/json/version.rb5
-rw-r--r--ext/json/parser/depend182
-rw-r--r--ext/json/parser/extconf.rb16
-rw-r--r--ext/json/parser/parser.c1672
-rw-r--r--ext/json/simd/conf.rb24
-rw-r--r--ext/json/simd/simd.h218
-rw-r--r--ext/json/vendor/fpconv.c480
-rw-r--r--ext/json/vendor/jeaiii-ltoa.h267
-rw-r--r--ext/json/vendor/ryu.h819
-rw-r--r--ext/monitor/depend162
-rw-r--r--ext/monitor/extconf.rb2
-rw-r--r--ext/monitor/lib/monitor.rb289
-rw-r--r--ext/monitor/monitor.c301
-rw-r--r--ext/nkf/.cvsignore3
-rw-r--r--ext/nkf/MANIFEST7
-rw-r--r--ext/nkf/depend1
-rw-r--r--ext/nkf/extconf.rb2
-rw-r--r--ext/nkf/lib/kconv.rb73
-rw-r--r--ext/nkf/nkf.c198
-rw-r--r--ext/nkf/nkf1.7/nkf.c1900
-rw-r--r--ext/nkf/test.rb318
-rw-r--r--ext/objspace/depend642
-rw-r--r--ext/objspace/extconf.rb4
-rw-r--r--ext/objspace/lib/objspace.rb135
-rw-r--r--ext/objspace/lib/objspace/trace.rb45
-rw-r--r--ext/objspace/object_tracing.c607
-rw-r--r--ext/objspace/objspace.c813
-rw-r--r--ext/objspace/objspace.h20
-rw-r--r--ext/objspace/objspace_dump.c927
-rw-r--r--ext/openssl/.cvsignore4
-rw-r--r--ext/openssl/History.md965
-rw-r--r--ext/openssl/MANIFEST62
-rw-r--r--ext/openssl/depend6507
-rw-r--r--ext/openssl/extconf.rb267
-rw-r--r--ext/openssl/lib/net/ftptls.rb43
-rw-r--r--ext/openssl/lib/net/https.rb188
-rw-r--r--ext/openssl/lib/net/protocols.rb56
-rw-r--r--ext/openssl/lib/net/telnets.rb250
-rw-r--r--ext/openssl/lib/openssl.rb41
-rw-r--r--ext/openssl/lib/openssl/bn.rb47
-rw-r--r--ext/openssl/lib/openssl/buffering.rb424
-rw-r--r--ext/openssl/lib/openssl/cipher.rb103
-rw-r--r--ext/openssl/lib/openssl/digest.rb97
-rw-r--r--ext/openssl/lib/openssl/hmac.rb78
-rw-r--r--ext/openssl/lib/openssl/marshal.rb30
-rw-r--r--ext/openssl/lib/openssl/pkcs5.rb22
-rw-r--r--ext/openssl/lib/openssl/pkey.rb493
-rw-r--r--ext/openssl/lib/openssl/ssl.rb479
-rw-r--r--ext/openssl/lib/openssl/version.rb6
-rw-r--r--ext/openssl/lib/openssl/x509.rb375
-rw-r--r--ext/openssl/openssl.gemspec28
-rw-r--r--ext/openssl/openssl_missing.c338
-rw-r--r--ext/openssl/openssl_missing.h120
-rw-r--r--ext/openssl/ossl.c1253
-rw-r--r--ext/openssl/ossl.h222
-rw-r--r--ext/openssl/ossl_asn1.c1935
-rw-r--r--ext/openssl/ossl_asn1.h54
-rw-r--r--ext/openssl/ossl_bio.c60
-rw-r--r--ext/openssl/ossl_bio.h11
-rw-r--r--ext/openssl/ossl_bn.c1450
-rw-r--r--ext/openssl/ossl_bn.h17
-rw-r--r--ext/openssl/ossl_cipher.c1070
-rw-r--r--ext/openssl/ossl_cipher.h21
-rw-r--r--ext/openssl/ossl_config.c643
-rw-r--r--ext/openssl/ossl_config.h18
-rw-r--r--ext/openssl/ossl_digest.c497
-rw-r--r--ext/openssl/ossl_digest.h20
-rw-r--r--ext/openssl/ossl_engine.c429
-rw-r--r--ext/openssl/ossl_engine.h8
-rw-r--r--ext/openssl/ossl_hmac.c318
-rw-r--r--ext/openssl/ossl_hmac.h8
-rw-r--r--ext/openssl/ossl_kdf.c300
-rw-r--r--ext/openssl/ossl_kdf.h6
-rw-r--r--ext/openssl/ossl_ns_spki.c319
-rw-r--r--ext/openssl/ossl_ns_spki.h10
-rw-r--r--ext/openssl/ossl_ocsp.c1741
-rw-r--r--ext/openssl/ossl_ocsp.h12
-rw-r--r--ext/openssl/ossl_pkcs12.c264
-rw-r--r--ext/openssl/ossl_pkcs12.h12
-rw-r--r--ext/openssl/ossl_pkcs7.c816
-rw-r--r--ext/openssl/ossl_pkcs7.h12
-rw-r--r--ext/openssl/ossl_pkey.c1759
-rw-r--r--ext/openssl/ossl_pkey.h224
-rw-r--r--ext/openssl/ossl_pkey_dh.c579
-rw-r--r--ext/openssl/ossl_pkey_dsa.c594
-rw-r--r--ext/openssl/ossl_pkey_ec.c1655
-rw-r--r--ext/openssl/ossl_pkey_rsa.c834
-rw-r--r--ext/openssl/ossl_provider.c204
-rw-r--r--ext/openssl/ossl_provider.h5
-rw-r--r--ext/openssl/ossl_rand.c189
-rw-r--r--ext/openssl/ossl_rand.h9
-rw-r--r--ext/openssl/ossl_ssl.c3384
-rw-r--r--ext/openssl/ossl_ssl.h25
-rw-r--r--ext/openssl/ossl_ssl_session.c327
-rw-r--r--ext/openssl/ossl_ts.c1551
-rw-r--r--ext/openssl/ossl_ts.h16
-rw-r--r--ext/openssl/ossl_version.h16
-rw-r--r--ext/openssl/ossl_x509.c165
-rw-r--r--ext/openssl/ossl_x509.h50
-rw-r--r--ext/openssl/ossl_x509attr.c272
-rw-r--r--ext/openssl/ossl_x509cert.c818
-rw-r--r--ext/openssl/ossl_x509crl.c385
-rw-r--r--ext/openssl/ossl_x509ext.c338
-rw-r--r--ext/openssl/ossl_x509name.c467
-rw-r--r--ext/openssl/ossl_x509req.c317
-rw-r--r--ext/openssl/ossl_x509revoked.c199
-rw-r--r--ext/openssl/ossl_x509store.c857
-rw-r--r--ext/openssl/ruby_missing.h18
-rw-r--r--ext/psych/.gitignore1
-rw-r--r--ext/psych/depend906
-rw-r--r--ext/psych/extconf.rb56
-rw-r--r--ext/psych/lib/psych.rb794
-rw-r--r--ext/psych/lib/psych/class_loader.rb105
-rw-r--r--ext/psych/lib/psych/coder.rb95
-rw-r--r--ext/psych/lib/psych/core_ext.rb36
-rw-r--r--ext/psych/lib/psych/exception.rb28
-rw-r--r--ext/psych/lib/psych/handler.rb255
-rw-r--r--ext/psych/lib/psych/handlers/document_stream.rb23
-rw-r--r--ext/psych/lib/psych/handlers/recorder.rb40
-rw-r--r--ext/psych/lib/psych/json/ruby_events.rb20
-rw-r--r--ext/psych/lib/psych/json/stream.rb17
-rw-r--r--ext/psych/lib/psych/json/tree_builder.rb13
-rw-r--r--ext/psych/lib/psych/json/yaml_events.rb30
-rw-r--r--ext/psych/lib/psych/nodes.rb78
-rw-r--r--ext/psych/lib/psych/nodes/alias.rb21
-rw-r--r--ext/psych/lib/psych/nodes/document.rb63
-rw-r--r--ext/psych/lib/psych/nodes/mapping.rb59
-rw-r--r--ext/psych/lib/psych/nodes/node.rb76
-rw-r--r--ext/psych/lib/psych/nodes/scalar.rb70
-rw-r--r--ext/psych/lib/psych/nodes/sequence.rb84
-rw-r--r--ext/psych/lib/psych/nodes/stream.rb40
-rw-r--r--ext/psych/lib/psych/omap.rb5
-rw-r--r--ext/psych/lib/psych/parser.rb65
-rw-r--r--ext/psych/lib/psych/scalar_scanner.rb142
-rw-r--r--ext/psych/lib/psych/set.rb5
-rw-r--r--ext/psych/lib/psych/stream.rb38
-rw-r--r--ext/psych/lib/psych/streaming.rb28
-rw-r--r--ext/psych/lib/psych/syntax_error.rb22
-rw-r--r--ext/psych/lib/psych/tree_builder.rb137
-rw-r--r--ext/psych/lib/psych/versions.rb10
-rw-r--r--ext/psych/lib/psych/visitors.rb7
-rw-r--r--ext/psych/lib/psych/visitors/depth_first.rb27
-rw-r--r--ext/psych/lib/psych/visitors/emitter.rb52
-rw-r--r--ext/psych/lib/psych/visitors/json_tree.rb25
-rw-r--r--ext/psych/lib/psych/visitors/to_ruby.rb479
-rw-r--r--ext/psych/lib/psych/visitors/visitor.rb34
-rw-r--r--ext/psych/lib/psych/visitors/yaml_tree.rb626
-rw-r--r--ext/psych/lib/psych/y.rb10
-rw-r--r--ext/psych/psych.c36
-rw-r--r--ext/psych/psych.gemspec82
-rw-r--r--ext/psych/psych.h17
-rw-r--r--ext/psych/psych_emitter.c589
-rw-r--r--ext/psych/psych_emitter.h8
-rw-r--r--ext/psych/psych_parser.c564
-rw-r--r--ext/psych/psych_parser.h6
-rw-r--r--ext/psych/psych_to_ruby.c42
-rw-r--r--ext/psych/psych_to_ruby.h8
-rw-r--r--ext/psych/psych_yaml_tree.c11
-rw-r--r--ext/psych/psych_yaml_tree.h8
-rw-r--r--ext/pty/.cvsignore3
-rw-r--r--ext/pty/MANIFEST12
-rw-r--r--ext/pty/README65
-rw-r--r--ext/pty/README.expect22
-rw-r--r--ext/pty/README.expect.ja21
-rw-r--r--ext/pty/README.ja89
-rw-r--r--ext/pty/depend189
-rw-r--r--ext/pty/expect_sample.rb55
-rw-r--r--ext/pty/extconf.rb19
-rw-r--r--ext/pty/lib/expect.rb45
-rw-r--r--ext/pty/pty.c1059
-rw-r--r--ext/pty/script.rb37
-rw-r--r--ext/pty/shl.rb92
-rw-r--r--ext/racc/cparse/.cvsignore3
-rw-r--r--ext/racc/cparse/MANIFEST4
-rw-r--r--ext/racc/cparse/cparse.c824
-rw-r--r--ext/racc/cparse/depend1
-rw-r--r--ext/racc/cparse/extconf.rb4
-rw-r--r--ext/rbconfig/sizeof/depend337
-rw-r--r--ext/rbconfig/sizeof/extconf.rb36
-rw-r--r--ext/readline/.cvsignore3
-rw-r--r--ext/readline/MANIFEST6
-rw-r--r--ext/readline/README62
-rw-r--r--ext/readline/README.ja63
-rw-r--r--ext/readline/depend1
-rw-r--r--ext/readline/extconf.rb27
-rw-r--r--ext/readline/readline.c743
-rw-r--r--ext/ripper/README29
-rw-r--r--ext/ripper/depend836
-rw-r--r--ext/ripper/eventids2.c303
-rw-r--r--ext/ripper/eventids2.h8
-rw-r--r--ext/ripper/extconf.rb18
-rw-r--r--ext/ripper/lib/ripper.rb74
-rw-r--r--ext/ripper/lib/ripper/core.rb74
-rw-r--r--ext/ripper/lib/ripper/filter.rb86
-rw-r--r--ext/ripper/lib/ripper/lexer.rb379
-rw-r--r--ext/ripper/lib/ripper/sexp.rb187
-rw-r--r--ext/ripper/ripper_init.c.tmpl680
-rw-r--r--ext/ripper/ripper_init.h6
-rw-r--r--ext/ripper/tools/dsl.rb181
-rw-r--r--ext/ripper/tools/generate-param-macros.rb15
-rw-r--r--ext/ripper/tools/generate.rb194
-rw-r--r--ext/ripper/tools/preproc.rb124
-rw-r--r--ext/ripper/tools/strip.rb12
-rw-r--r--ext/rubyvm/depend2
-rw-r--r--ext/rubyvm/extconf.rb1
-rw-r--r--ext/rubyvm/lib/forwardable/impl.rb16
-rw-r--r--ext/sdbm/.cvsignore3
-rw-r--r--ext/sdbm/MANIFEST7
-rw-r--r--ext/sdbm/_sdbm.c973
-rw-r--r--ext/sdbm/depend2
-rw-r--r--ext/sdbm/extconf.rb3
-rw-r--r--ext/sdbm/init.c784
-rw-r--r--ext/sdbm/sdbm.h84
-rw-r--r--ext/sdbm/testsdbm.rb556
-rw-r--r--ext/socket/.cvsignore3
-rw-r--r--ext/socket/.document17
-rw-r--r--ext/socket/MANIFEST8
-rw-r--r--ext/socket/addrinfo.h79
-rw-r--r--ext/socket/ancdata.c1742
-rw-r--r--ext/socket/basicsocket.c792
-rw-r--r--ext/socket/constants.c144
-rw-r--r--ext/socket/depend3257
-rw-r--r--ext/socket/extconf.rb881
-rw-r--r--ext/socket/getaddrinfo.c974
-rw-r--r--ext/socket/getnameinfo.c285
-rw-r--r--ext/socket/ifaddr.c480
-rw-r--r--ext/socket/init.c843
-rw-r--r--ext/socket/ipsocket.c1640
-rw-r--r--ext/socket/lib/socket.rb1820
-rw-r--r--ext/socket/mkconstants.rb854
-rw-r--r--ext/socket/option.c1477
-rw-r--r--ext/socket/raddrinfo.c3278
-rw-r--r--ext/socket/rubysocket.h514
-rw-r--r--ext/socket/socket.c4332
-rw-r--r--ext/socket/sockport.h84
-rw-r--r--ext/socket/sockssocket.c75
-rw-r--r--ext/socket/tcpserver.c140
-rw-r--r--ext/socket/tcpsocket.c144
-rw-r--r--ext/socket/udpsocket.c247
-rw-r--r--ext/socket/unixserver.c121
-rw-r--r--ext/socket/unixsocket.c598
-rw-r--r--ext/stringio/.cvsignore3
-rw-r--r--ext/stringio/.document1
-rw-r--r--ext/stringio/MANIFEST4
-rw-r--r--ext/stringio/README19
-rw-r--r--ext/stringio/README.md10
-rw-r--r--ext/stringio/depend179
-rw-r--r--ext/stringio/extconf.rb9
-rw-r--r--ext/stringio/stringio.c1972
-rw-r--r--ext/stringio/stringio.gemspec46
-rw-r--r--ext/strscan/.cvsignore3
-rw-r--r--ext/strscan/MANIFEST4
-rw-r--r--ext/strscan/depend178
-rw-r--r--ext/strscan/extconf.rb11
-rw-r--r--ext/strscan/lib/strscan/strscan.rb25
-rw-r--r--ext/strscan/strscan.c2310
-rw-r--r--ext/strscan/strscan.gemspec49
-rw-r--r--ext/syck/.cvsignore3
-rw-r--r--ext/syck/MANIFEST16
-rw-r--r--ext/syck/bytecode.c1109
-rw-r--r--ext/syck/depend12
-rw-r--r--ext/syck/emitter.c444
-rw-r--r--ext/syck/extconf.rb5
-rw-r--r--ext/syck/gram.c1796
-rw-r--r--ext/syck/gram.h81
-rw-r--r--ext/syck/handler.c156
-rw-r--r--ext/syck/implicit.c2859
-rw-r--r--ext/syck/node.c337
-rw-r--r--ext/syck/rubyext.c1556
-rw-r--r--ext/syck/syck.c506
-rw-r--r--ext/syck/syck.h409
-rw-r--r--ext/syck/token.c2467
-rw-r--r--ext/syck/yaml2byte.c251
-rw-r--r--ext/syck/yamlbyte.h170
-rw-r--r--ext/syslog/.cvsignore3
-rw-r--r--ext/syslog/MANIFEST6
-rw-r--r--ext/syslog/depend2
-rw-r--r--ext/syslog/extconf.rb10
-rw-r--r--ext/syslog/syslog.c394
-rw-r--r--ext/syslog/syslog.txt121
-rw-r--r--ext/syslog/test.rb164
-rw-r--r--ext/tcltklib/.cvsignore3
-rw-r--r--ext/tcltklib/MANIFEST22
-rw-r--r--ext/tcltklib/MANUAL.eng407
-rw-r--r--ext/tcltklib/MANUAL.euc520
-rw-r--r--ext/tcltklib/README.1st53
-rw-r--r--ext/tcltklib/README.ActiveTcl42
-rw-r--r--ext/tcltklib/README.euc159
-rw-r--r--ext/tcltklib/demo/lines0.tcl42
-rw-r--r--ext/tcltklib/demo/lines1.rb50
-rw-r--r--ext/tcltklib/demo/lines2.rb54
-rw-r--r--ext/tcltklib/demo/lines3.rb54
-rw-r--r--ext/tcltklib/demo/lines4.rb54
-rw-r--r--ext/tcltklib/demo/safeTk.rb22
-rw-r--r--ext/tcltklib/depend2
-rw-r--r--ext/tcltklib/extconf.rb234
-rw-r--r--ext/tcltklib/lib/tcltk.rb367
-rw-r--r--ext/tcltklib/sample/batsu.gifbin538 -> 0 bytes-rw-r--r--ext/tcltklib/sample/maru.gifbin481 -> 0 bytes-rw-r--r--ext/tcltklib/sample/sample0.rb39
-rw-r--r--ext/tcltklib/sample/sample1.rb634
-rw-r--r--ext/tcltklib/sample/sample2.rb449
-rw-r--r--ext/tcltklib/stubs.c97
-rw-r--r--ext/tcltklib/tcltklib.c5339
-rw-r--r--ext/tk/.cvsignore3
-rw-r--r--ext/tk/ChangeLog.tkextlib3
-rw-r--r--ext/tk/MANIFEST481
-rw-r--r--ext/tk/README.1st23
-rw-r--r--ext/tk/README.fork34
-rw-r--r--ext/tk/depend1
-rw-r--r--ext/tk/extconf.rb3
-rw-r--r--ext/tk/lib/README30
-rw-r--r--ext/tk/lib/multi-tk.rb1665
-rw-r--r--ext/tk/lib/remote-tk.rb424
-rw-r--r--ext/tk/lib/tk.rb3696
-rw-r--r--ext/tk/lib/tk/after.rb6
-rw-r--r--ext/tk/lib/tk/autoload.rb188
-rw-r--r--ext/tk/lib/tk/bgerror.rb29
-rw-r--r--ext/tk/lib/tk/bindtag.rb79
-rw-r--r--ext/tk/lib/tk/button.rb27
-rw-r--r--ext/tk/lib/tk/canvas.rb703
-rw-r--r--ext/tk/lib/tk/canvastag.rb347
-rw-r--r--ext/tk/lib/tk/checkbutton.rb25
-rw-r--r--ext/tk/lib/tk/clipboard.rb75
-rw-r--r--ext/tk/lib/tk/clock.rb57
-rw-r--r--ext/tk/lib/tk/composite.rb293
-rw-r--r--ext/tk/lib/tk/console.rb29
-rw-r--r--ext/tk/lib/tk/dialog.rb290
-rw-r--r--ext/tk/lib/tk/encodedstr.rb107
-rw-r--r--ext/tk/lib/tk/entry.rb114
-rw-r--r--ext/tk/lib/tk/event.rb159
-rw-r--r--ext/tk/lib/tk/font.rb1464
-rw-r--r--ext/tk/lib/tk/frame.rb123
-rw-r--r--ext/tk/lib/tk/grid.rb210
-rw-r--r--ext/tk/lib/tk/image.rb186
-rw-r--r--ext/tk/lib/tk/itemconfig.rb781
-rw-r--r--ext/tk/lib/tk/itemfont.rb297
-rw-r--r--ext/tk/lib/tk/kinput.rb71
-rw-r--r--ext/tk/lib/tk/label.rb22
-rw-r--r--ext/tk/lib/tk/labelframe.rb20
-rw-r--r--ext/tk/lib/tk/listbox.rb252
-rw-r--r--ext/tk/lib/tk/macpkg.rb68
-rw-r--r--ext/tk/lib/tk/menu.rb480
-rw-r--r--ext/tk/lib/tk/menubar.rb131
-rw-r--r--ext/tk/lib/tk/menuspec.rb243
-rw-r--r--ext/tk/lib/tk/message.rb19
-rw-r--r--ext/tk/lib/tk/mngfocus.rb33
-rw-r--r--ext/tk/lib/tk/msgcat.rb268
-rw-r--r--ext/tk/lib/tk/namespace.rb294
-rw-r--r--ext/tk/lib/tk/optiondb.rb298
-rw-r--r--ext/tk/lib/tk/optionobj.rb212
-rw-r--r--ext/tk/lib/tk/pack.rb89
-rw-r--r--ext/tk/lib/tk/package.rb139
-rw-r--r--ext/tk/lib/tk/palette.rb54
-rw-r--r--ext/tk/lib/tk/panedwindow.rb204
-rw-r--r--ext/tk/lib/tk/place.rb127
-rw-r--r--ext/tk/lib/tk/radiobutton.rb32
-rw-r--r--ext/tk/lib/tk/root.rb86
-rw-r--r--ext/tk/lib/tk/scale.rb78
-rw-r--r--ext/tk/lib/tk/scrollable.rb70
-rw-r--r--ext/tk/lib/tk/scrollbar.rb112
-rw-r--r--ext/tk/lib/tk/scrollbox.rb36
-rw-r--r--ext/tk/lib/tk/selection.rb86
-rw-r--r--ext/tk/lib/tk/spinbox.rb39
-rw-r--r--ext/tk/lib/tk/tagfont.rb43
-rw-r--r--ext/tk/lib/tk/text.rb1247
-rw-r--r--ext/tk/lib/tk/textimage.rb72
-rw-r--r--ext/tk/lib/tk/textmark.rb135
-rw-r--r--ext/tk/lib/tk/texttag.rb253
-rw-r--r--ext/tk/lib/tk/textwindow.rb137
-rw-r--r--ext/tk/lib/tk/timer.rb442
-rw-r--r--ext/tk/lib/tk/toplevel.rb232
-rw-r--r--ext/tk/lib/tk/txtwin_abst.rb38
-rw-r--r--ext/tk/lib/tk/validation.rb235
-rw-r--r--ext/tk/lib/tk/variable.rb928
-rw-r--r--ext/tk/lib/tk/virtevent.rb90
-rw-r--r--ext/tk/lib/tk/winfo.rb384
-rw-r--r--ext/tk/lib/tk/winpkg.rb136
-rw-r--r--ext/tk/lib/tk/wm.rb247
-rw-r--r--ext/tk/lib/tk/xim.rb122
-rw-r--r--ext/tk/lib/tkafter.rb4
-rw-r--r--ext/tk/lib/tkbgerror.rb4
-rw-r--r--ext/tk/lib/tkcanvas.rb4
-rw-r--r--ext/tk/lib/tkclass.rb47
-rw-r--r--ext/tk/lib/tkconsole.rb4
-rw-r--r--ext/tk/lib/tkdialog.rb4
-rw-r--r--ext/tk/lib/tkentry.rb4
-rw-r--r--ext/tk/lib/tkextlib/ICONS.rb16
-rw-r--r--ext/tk/lib/tkextlib/ICONS/icons.rb84
-rw-r--r--ext/tk/lib/tkextlib/ICONS/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/SUPPORT_STATUS161
-rwxr-xr-xext/tk/lib/tkextlib/pkg_checker.rb129
-rw-r--r--ext/tk/lib/tkextlib/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/tcllib.rb57
-rw-r--r--ext/tk/lib/tkextlib/tcllib/README135
-rw-r--r--ext/tk/lib/tkextlib/tcllib/autoscroll.rb100
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ctext.rb141
-rw-r--r--ext/tk/lib/tkextlib/tcllib/cursor.rb41
-rw-r--r--ext/tk/lib/tkextlib/tcllib/datefield.rb50
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ip_entry.rb53
-rw-r--r--ext/tk/lib/tkextlib/tcllib/plotchart.rb666
-rw-r--r--ext/tk/lib/tkextlib/tcllib/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/tcllib/style.rb30
-rw-r--r--ext/tk/lib/tkextlib/tcllib/tkpiechart.rb284
-rw-r--r--ext/tk/lib/tkextlib/tile.rb73
-rw-r--r--ext/tk/lib/tkextlib/tile/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/tile/style.rb67
-rw-r--r--ext/tk/lib/tkextlib/tile/tbutton.rb28
-rw-r--r--ext/tk/lib/tkextlib/tile/tcheckbutton.rb33
-rw-r--r--ext/tk/lib/tkextlib/tile/tlabel.rb28
-rw-r--r--ext/tk/lib/tkextlib/tile/tmenubutton.rb28
-rw-r--r--ext/tk/lib/tkextlib/tile/tnotebook.rb90
-rw-r--r--ext/tk/lib/tkextlib/tile/tradiobutton.rb33
-rw-r--r--ext/tk/lib/tkextlib/tkDND.rb25
-rw-r--r--ext/tk/lib/tkextlib/tkDND/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/tkDND/shape.rb96
-rw-r--r--ext/tk/lib/tkextlib/tkDND/tkdnd.rb108
-rw-r--r--ext/tk/lib/tkextlib/tkHTML.rb16
-rw-r--r--ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb427
-rw-r--r--ext/tk/lib/tkextlib/tkHTML/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/tkimg.rb23
-rw-r--r--ext/tk/lib/tkextlib/tkimg/README26
-rw-r--r--ext/tk/lib/tkextlib/tkimg/bmp.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/gif.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/ico.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/jpeg.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/pcx.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/pixmap.rb21
-rw-r--r--ext/tk/lib/tkextlib/tkimg/png.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/ppm.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/ps.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/tkimg/sgi.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/sun.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/tga.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/tiff.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/window.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/xbm.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/xpm.rb14
-rw-r--r--ext/tk/lib/tkextlib/tktrans.rb17
-rw-r--r--ext/tk/lib/tkextlib/tktrans/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/tktrans/tktrans.rb53
-rw-r--r--ext/tk/lib/tkextlib/treectrl.rb16
-rw-r--r--ext/tk/lib/tkextlib/treectrl/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/treectrl/tktreectrl.rb887
-rw-r--r--ext/tk/lib/tkextlib/vu.rb40
-rw-r--r--ext/tk/lib/tkextlib/vu/bargraph.rb50
-rw-r--r--ext/tk/lib/tkextlib/vu/charts.rb47
-rw-r--r--ext/tk/lib/tkextlib/vu/dial.rb102
-rw-r--r--ext/tk/lib/tkextlib/vu/pie.rb229
-rw-r--r--ext/tk/lib/tkextlib/vu/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/vu/spinbox.rb17
-rw-r--r--ext/tk/lib/tkfont.rb4
-rw-r--r--ext/tk/lib/tkmacpkg.rb4
-rw-r--r--ext/tk/lib/tkmenubar.rb4
-rw-r--r--ext/tk/lib/tkmngfocus.rb4
-rw-r--r--ext/tk/lib/tkpalette.rb4
-rw-r--r--ext/tk/lib/tkscrollbox.rb4
-rw-r--r--ext/tk/lib/tktext.rb4
-rw-r--r--ext/tk/lib/tkvirtevent.rb4
-rw-r--r--ext/tk/lib/tkwinpkg.rb4
-rw-r--r--ext/tk/sample/binding_sample.rb87
-rw-r--r--ext/tk/sample/bindtag_sample.rb127
-rw-r--r--ext/tk/sample/binstr_usage.rb39
-rw-r--r--ext/tk/sample/btn_with_frame.rb20
-rw-r--r--ext/tk/sample/demos-en/ChangeLog64
-rw-r--r--ext/tk/sample/demos-en/ChangeLog.prev9
-rw-r--r--ext/tk/sample/demos-en/README138
-rw-r--r--ext/tk/sample/demos-en/README.1st18
-rw-r--r--ext/tk/sample/demos-en/README.tkencoding29
-rw-r--r--ext/tk/sample/demos-en/arrow.rb239
-rw-r--r--ext/tk/sample/demos-en/bind.rb110
-rw-r--r--ext/tk/sample/demos-en/bitmap.rb73
-rw-r--r--ext/tk/sample/demos-en/browse163
-rw-r--r--ext/tk/sample/demos-en/browse282
-rw-r--r--ext/tk/sample/demos-en/button.rb84
-rw-r--r--ext/tk/sample/demos-en/check.rb70
-rw-r--r--ext/tk/sample/demos-en/check2.rb107
-rw-r--r--ext/tk/sample/demos-en/clrpick.rb77
-rw-r--r--ext/tk/sample/demos-en/colors.rb148
-rw-r--r--ext/tk/sample/demos-en/cscroll.rb134
-rw-r--r--ext/tk/sample/demos-en/ctext.rb186
-rw-r--r--ext/tk/sample/demos-en/dialog1.rb38
-rw-r--r--ext/tk/sample/demos-en/dialog2.rb41
-rw-r--r--ext/tk/sample/demos-en/doc.org/README7
-rw-r--r--ext/tk/sample/demos-en/doc.org/README.JP14
-rw-r--r--ext/tk/sample/demos-en/doc.org/README.tk8046
-rw-r--r--ext/tk/sample/demos-en/doc.org/license.terms39
-rw-r--r--ext/tk/sample/demos-en/doc.org/license.terms.tk8039
-rw-r--r--ext/tk/sample/demos-en/entry1.rb56
-rw-r--r--ext/tk/sample/demos-en/entry2.rb91
-rw-r--r--ext/tk/sample/demos-en/entry3.rb200
-rw-r--r--ext/tk/sample/demos-en/filebox.rb97
-rw-r--r--ext/tk/sample/demos-en/floor.rb1721
-rw-r--r--ext/tk/sample/demos-en/floor2.rb1720
-rw-r--r--ext/tk/sample/demos-en/form.rb62
-rw-r--r--ext/tk/sample/demos-en/hello14
-rw-r--r--ext/tk/sample/demos-en/hscale.rb74
-rw-r--r--ext/tk/sample/demos-en/icon.rb99
-rw-r--r--ext/tk/sample/demos-en/image1.rb60
-rw-r--r--ext/tk/sample/demos-en/image2.rb105
-rw-r--r--ext/tk/sample/demos-en/image3.rb121
-rw-r--r--ext/tk/sample/demos-en/items.rb374
-rw-r--r--ext/tk/sample/demos-en/ixset333
-rw-r--r--ext/tk/sample/demos-en/ixset2367
-rw-r--r--ext/tk/sample/demos-en/label.rb69
-rw-r--r--ext/tk/sample/demos-en/labelframe.rb93
-rw-r--r--ext/tk/sample/demos-en/menu.rb186
-rw-r--r--ext/tk/sample/demos-en/menu84.rb213
-rw-r--r--ext/tk/sample/demos-en/menubu.rb235
-rw-r--r--ext/tk/sample/demos-en/msgbox.rb88
-rw-r--r--ext/tk/sample/demos-en/paned1.rb45
-rw-r--r--ext/tk/sample/demos-en/paned2.rb92
-rw-r--r--ext/tk/sample/demos-en/patch_1.1c193
-rw-r--r--ext/tk/sample/demos-en/plot.rb122
-rw-r--r--ext/tk/sample/demos-en/puzzle.rb120
-rw-r--r--ext/tk/sample/demos-en/radio.rb84
-rw-r--r--ext/tk/sample/demos-en/radio2.rb106
-rw-r--r--ext/tk/sample/demos-en/radio3.rb114
-rw-r--r--ext/tk/sample/demos-en/rmt268
-rw-r--r--ext/tk/sample/demos-en/rolodex320
-rw-r--r--ext/tk/sample/demos-en/rolodex-j323
-rw-r--r--ext/tk/sample/demos-en/ruler.rb203
-rw-r--r--ext/tk/sample/demos-en/sayings.rb104
-rw-r--r--ext/tk/sample/demos-en/search.rb180
-rw-r--r--ext/tk/sample/demos-en/spin.rb63
-rw-r--r--ext/tk/sample/demos-en/square81
-rw-r--r--ext/tk/sample/demos-en/states.rb78
-rw-r--r--ext/tk/sample/demos-en/style.rb211
-rw-r--r--ext/tk/sample/demos-en/tcolor521
-rw-r--r--ext/tk/sample/demos-en/tcolor.bak513
-rw-r--r--ext/tk/sample/demos-en/text.rb126
-rw-r--r--ext/tk/sample/demos-en/timer136
-rw-r--r--ext/tk/sample/demos-en/tkencoding.rb42
-rw-r--r--ext/tk/sample/demos-en/twind.rb285
-rw-r--r--ext/tk/sample/demos-en/twind2.rb382
-rw-r--r--ext/tk/sample/demos-en/unicodeout.rb112
-rw-r--r--ext/tk/sample/demos-en/vscale.rb78
-rw-r--r--ext/tk/sample/demos-en/widget822
-rw-r--r--ext/tk/sample/demos-jp/README54
-rw-r--r--ext/tk/sample/demos-jp/README.1st20
-rw-r--r--ext/tk/sample/demos-jp/arrow.rb236
-rw-r--r--ext/tk/sample/demos-jp/bind.rb107
-rw-r--r--ext/tk/sample/demos-jp/bitmap.rb71
-rw-r--r--ext/tk/sample/demos-jp/browse163
-rw-r--r--ext/tk/sample/demos-jp/browse282
-rw-r--r--ext/tk/sample/demos-jp/button.rb81
-rw-r--r--ext/tk/sample/demos-jp/check.rb67
-rw-r--r--ext/tk/sample/demos-jp/check2.rb107
-rw-r--r--ext/tk/sample/demos-jp/clrpick.rb75
-rw-r--r--ext/tk/sample/demos-jp/colors.rb144
-rw-r--r--ext/tk/sample/demos-jp/cscroll.rb131
-rw-r--r--ext/tk/sample/demos-jp/ctext.rb182
-rw-r--r--ext/tk/sample/demos-jp/dialog1.rb38
-rw-r--r--ext/tk/sample/demos-jp/dialog2.rb42
-rw-r--r--ext/tk/sample/demos-jp/doc.org/README7
-rw-r--r--ext/tk/sample/demos-jp/doc.org/README.JP14
-rw-r--r--ext/tk/sample/demos-jp/doc.org/README.tk8046
-rw-r--r--ext/tk/sample/demos-jp/doc.org/license.terms39
-rw-r--r--ext/tk/sample/demos-jp/doc.org/license.terms.tk8039
-rw-r--r--ext/tk/sample/demos-jp/entry1.rb57
-rw-r--r--ext/tk/sample/demos-jp/entry2.rb88
-rw-r--r--ext/tk/sample/demos-jp/entry3.rb204
-rw-r--r--ext/tk/sample/demos-jp/filebox.rb96
-rw-r--r--ext/tk/sample/demos-jp/floor.rb1718
-rw-r--r--ext/tk/sample/demos-jp/floor2.rb1716
-rw-r--r--ext/tk/sample/demos-jp/form.rb63
-rw-r--r--ext/tk/sample/demos-jp/hello9
-rw-r--r--ext/tk/sample/demos-jp/hscale.rb77
-rw-r--r--ext/tk/sample/demos-jp/icon.rb96
-rw-r--r--ext/tk/sample/demos-jp/image1.rb58
-rw-r--r--ext/tk/sample/demos-jp/image2.rb102
-rw-r--r--ext/tk/sample/demos-jp/image3.rb122
-rw-r--r--ext/tk/sample/demos-jp/items.rb371
-rw-r--r--ext/tk/sample/demos-jp/ixset333
-rw-r--r--ext/tk/sample/demos-jp/ixset2368
-rw-r--r--ext/tk/sample/demos-jp/label.rb65
-rw-r--r--ext/tk/sample/demos-jp/labelframe.rb98
-rw-r--r--ext/tk/sample/demos-jp/menu.rb188
-rw-r--r--ext/tk/sample/demos-jp/menu84.rb210
-rw-r--r--ext/tk/sample/demos-jp/menu8x.rb222
-rw-r--r--ext/tk/sample/demos-jp/menubu.rb235
-rw-r--r--ext/tk/sample/demos-jp/msgbox.rb86
-rw-r--r--ext/tk/sample/demos-jp/paned1.rb48
-rw-r--r--ext/tk/sample/demos-jp/paned2.rb96
-rw-r--r--ext/tk/sample/demos-jp/plot.rb119
-rw-r--r--ext/tk/sample/demos-jp/puzzle.rb116
-rw-r--r--ext/tk/sample/demos-jp/radio.rb81
-rw-r--r--ext/tk/sample/demos-jp/radio2.rb107
-rw-r--r--ext/tk/sample/demos-jp/radio3.rb114
-rw-r--r--ext/tk/sample/demos-jp/rmt268
-rw-r--r--ext/tk/sample/demos-jp/rolodex320
-rw-r--r--ext/tk/sample/demos-jp/rolodex-j299
-rw-r--r--ext/tk/sample/demos-jp/ruler.rb200
-rw-r--r--ext/tk/sample/demos-jp/sayings.rb100
-rw-r--r--ext/tk/sample/demos-jp/search.rb176
-rw-r--r--ext/tk/sample/demos-jp/spin.rb67
-rw-r--r--ext/tk/sample/demos-jp/square81
-rw-r--r--ext/tk/sample/demos-jp/states.rb71
-rw-r--r--ext/tk/sample/demos-jp/style.rb248
-rw-r--r--ext/tk/sample/demos-jp/tcolor528
-rw-r--r--ext/tk/sample/demos-jp/text.rb117
-rw-r--r--ext/tk/sample/demos-jp/timer136
-rw-r--r--ext/tk/sample/demos-jp/twind.rb285
-rw-r--r--ext/tk/sample/demos-jp/twind2.rb381
-rw-r--r--ext/tk/sample/demos-jp/unicodeout.rb115
-rw-r--r--ext/tk/sample/demos-jp/vscale.rb78
-rw-r--r--ext/tk/sample/demos-jp/widget848
-rw-r--r--ext/tk/sample/encstr_usage.rb29
-rw-r--r--ext/tk/sample/images/earth.gifbin51712 -> 0 bytes-rw-r--r--ext/tk/sample/images/earthris.gifbin6343 -> 0 bytes-rw-r--r--ext/tk/sample/images/face.xbm173
-rw-r--r--ext/tk/sample/images/flagdown.xbm27
-rw-r--r--ext/tk/sample/images/flagup.xbm27
-rw-r--r--ext/tk/sample/images/gray25.xbm6
-rw-r--r--ext/tk/sample/images/grey.256
-rw-r--r--ext/tk/sample/images/grey.56
-rw-r--r--ext/tk/sample/images/letters.xbm27
-rw-r--r--ext/tk/sample/images/noletter.xbm27
-rw-r--r--ext/tk/sample/images/pattern.xbm6
-rw-r--r--ext/tk/sample/images/tcllogo.gifbin2341 -> 0 bytes-rw-r--r--ext/tk/sample/images/teapot.ppm56
-rw-r--r--ext/tk/sample/iso2022-kr.txt2
-rw-r--r--ext/tk/sample/menubar1.rb51
-rw-r--r--ext/tk/sample/menubar2.rb56
-rw-r--r--ext/tk/sample/msgs_rb/README3
-rw-r--r--ext/tk/sample/msgs_rb/cs.msg84
-rw-r--r--ext/tk/sample/msgs_rb/de.msg88
-rw-r--r--ext/tk/sample/msgs_rb/el.msg98
-rw-r--r--ext/tk/sample/msgs_rb/en.msg83
-rw-r--r--ext/tk/sample/msgs_rb/en_gb.msg7
-rw-r--r--ext/tk/sample/msgs_rb/eo.msg87
-rw-r--r--ext/tk/sample/msgs_rb/es.msg84
-rw-r--r--ext/tk/sample/msgs_rb/fr.msg84
-rw-r--r--ext/tk/sample/msgs_rb/it.msg84
-rw-r--r--ext/tk/sample/msgs_rb/ja.msg13
-rw-r--r--ext/tk/sample/msgs_rb/nl.msg123
-rw-r--r--ext/tk/sample/msgs_rb/pl.msg87
-rw-r--r--ext/tk/sample/msgs_rb/ru.msg87
-rw-r--r--ext/tk/sample/msgs_rb2/README5
-rw-r--r--ext/tk/sample/msgs_rb2/de.msg88
-rw-r--r--ext/tk/sample/msgs_rb2/ja.msg85
-rw-r--r--ext/tk/sample/msgs_tk/README4
-rw-r--r--ext/tk/sample/msgs_tk/cs.msg84
-rw-r--r--ext/tk/sample/msgs_tk/de.msg88
-rw-r--r--ext/tk/sample/msgs_tk/el.msg103
-rw-r--r--ext/tk/sample/msgs_tk/en.msg83
-rw-r--r--ext/tk/sample/msgs_tk/en_gb.msg7
-rw-r--r--ext/tk/sample/msgs_tk/eo.msg87
-rw-r--r--ext/tk/sample/msgs_tk/es.msg84
-rw-r--r--ext/tk/sample/msgs_tk/fr.msg84
-rw-r--r--ext/tk/sample/msgs_tk/it.msg84
-rw-r--r--ext/tk/sample/msgs_tk/ja.msg13
-rw-r--r--ext/tk/sample/msgs_tk/license.terms39
-rw-r--r--ext/tk/sample/msgs_tk/nl.msg123
-rw-r--r--ext/tk/sample/msgs_tk/pl.msg87
-rw-r--r--ext/tk/sample/msgs_tk/ru.msg87
-rw-r--r--ext/tk/sample/optobj_sample.rb67
-rw-r--r--ext/tk/sample/propagate.rb30
-rw-r--r--ext/tk/sample/remote-ip_sample.rb33
-rw-r--r--ext/tk/sample/remote-ip_sample2.rb53
-rw-r--r--ext/tk/sample/resource.en13
-rw-r--r--ext/tk/sample/resource.ja13
-rw-r--r--ext/tk/sample/safe-tk.rb102
-rw-r--r--ext/tk/sample/tkalignbox.rb225
-rw-r--r--ext/tk/sample/tkballoonhelp.rb99
-rw-r--r--ext/tk/sample/tkbiff.rb155
-rw-r--r--ext/tk/sample/tkbrowse.rb79
-rw-r--r--ext/tk/sample/tkcombobox.rb426
-rw-r--r--ext/tk/sample/tkdialog.rb61
-rw-r--r--ext/tk/sample/tkextlib/tcllib/datefield.rb29
-rw-r--r--ext/tk/sample/tkextlib/tcllib/plotdemos1.rb158
-rw-r--r--ext/tk/sample/tkextlib/tcllib/plotdemos2.rb71
-rw-r--r--ext/tk/sample/tkextlib/tcllib/plotdemos3.rb83
-rw-r--r--ext/tk/sample/tkextlib/tcllib/xyplot.rb17
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/README12
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/hv.rb306
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image1bin8995 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image10bin3095 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image11bin1425 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image12bin2468 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image13bin4073 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image14bin53 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image2bin42 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image3bin3473 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image4bin1988 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image5bin973 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image6bin2184 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image7bin2022 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image8bin1186 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image9bin139 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/index.html115
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image1bin1966 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image10bin255 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image11bin590 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image12bin254 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image13bin493 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image14bin195 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image15bin68 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image16bin157 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image17bin81 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image18bin545 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image19bin53 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image2bin49 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image20bin533 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image21bin564 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image22bin81 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image23bin539 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image24bin151 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image25bin453 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image26bin520 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image27bin565 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image28bin416 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image29bin121 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image3bin10835 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image30bin663 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image31bin78 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image32bin556 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image33bin598 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image34bin496 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image35bin724 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image36bin404 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image37bin124 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image38bin8330 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image39bin369 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image4bin268 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image5bin492 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image6bin246 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image7bin551 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image8bin497 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image9bin492 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/index.html433
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image1bin113 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image10bin5088 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image11bin4485 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image12bin3579 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image13bin5119 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image14bin3603 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image2bin74 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image3bin681 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image4bin3056 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image5bin2297 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image6bin79 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image7bin1613 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image8bin864 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image9bin2379 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/index.html2787
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image1bin42 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image2bin14343 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image3bin17750 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image4bin61 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image5bin201 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image6bin214 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image7bin149 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image8bin203 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image9bin1504 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/index.html768
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/ss.rb404
-rw-r--r--ext/tk/sample/tkextlib/vu/README.txt50
-rw-r--r--ext/tk/sample/tkextlib/vu/canvItems.rb90
-rw-r--r--ext/tk/sample/tkextlib/vu/canvSticker.rb82
-rw-r--r--ext/tk/sample/tkextlib/vu/canvSticker2.rb99
-rw-r--r--ext/tk/sample/tkextlib/vu/dial.rb113
-rw-r--r--ext/tk/sample/tkextlib/vu/m128_000.xbm174
-rw-r--r--ext/tk/sample/tkextlib/vu/oscilloscope.rb68
-rw-r--r--ext/tk/sample/tkextlib/vu/pie.rb56
-rw-r--r--ext/tk/sample/tkextlib/vu/vu.rb67
-rw-r--r--ext/tk/sample/tkfrom.rb132
-rw-r--r--ext/tk/sample/tkhello.rb10
-rw-r--r--ext/tk/sample/tkline.rb47
-rw-r--r--ext/tk/sample/tkmenubutton.rb135
-rw-r--r--ext/tk/sample/tkmsgcat-load_rb.rb102
-rw-r--r--ext/tk/sample/tkmsgcat-load_rb2.rb102
-rw-r--r--ext/tk/sample/tkmsgcat-load_tk.rb118
-rw-r--r--ext/tk/sample/tkmulticolumnlist.rb743
-rw-r--r--ext/tk/sample/tkmultilistbox.rb654
-rw-r--r--ext/tk/sample/tkmultilistframe.rb940
-rw-r--r--ext/tk/sample/tkoptdb-safeTk.rb35
-rw-r--r--ext/tk/sample/tkoptdb.rb106
-rw-r--r--ext/tk/sample/tktextframe.rb162
-rw-r--r--ext/tk/sample/tktimer.rb50
-rw-r--r--ext/tk/sample/tktimer2.rb47
-rw-r--r--ext/tk/sample/tktimer3.rb59
-rw-r--r--ext/tk/sample/tktree.rb99
-rw-r--r--ext/tk/sample/tktree.tcl305
-rw-r--r--ext/tk/tkutil.c1257
-rw-r--r--ext/win32/depend2
-rw-r--r--ext/win32/extconf.rb4
-rw-r--r--ext/win32/lib/win32/registry.rb942
-rw-r--r--ext/win32/lib/win32/resolv.rb106
-rw-r--r--ext/win32/resolv/depend17
-rw-r--r--ext/win32/resolv/extconf.rb7
-rw-r--r--ext/win32/resolv/resolv.c260
-rw-r--r--ext/win32/win32-registry.gemspec29
-rw-r--r--ext/win32ole/.cvsignore3
-rw-r--r--ext/win32ole/MANIFEST24
-rw-r--r--ext/win32ole/depend1
-rw-r--r--ext/win32ole/doc/win32ole.rd294
-rw-r--r--ext/win32ole/extconf.rb27
-rw-r--r--ext/win32ole/lib/win32ole/property.rb16
-rw-r--r--ext/win32ole/sample/excel1.rb22
-rw-r--r--ext/win32ole/sample/excel2.rb30
-rw-r--r--ext/win32ole/sample/excel3.rb13
-rw-r--r--ext/win32ole/sample/ie.rb11
-rw-r--r--ext/win32ole/sample/ieconst.rb32
-rw-r--r--ext/win32ole/sample/ienavi.rb40
-rw-r--r--ext/win32ole/sample/oledirs.rb23
-rw-r--r--ext/win32ole/sample/olegen.rb348
-rw-r--r--ext/win32ole/sample/xml.rb7306
-rw-r--r--ext/win32ole/tests/oleserver.rb10
-rw-r--r--ext/win32ole/tests/testOLEEVENT.rb33
-rw-r--r--ext/win32ole/tests/testOLEMETHOD.rb87
-rw-r--r--ext/win32ole/tests/testOLEPARAM.rb74
-rw-r--r--ext/win32ole/tests/testOLETYPE.rb96
-rw-r--r--ext/win32ole/tests/testOLEVARIABLE.rb49
-rw-r--r--ext/win32ole/tests/testVARIANT.rb32
-rw-r--r--ext/win32ole/tests/testWIN32OLE.rb298
-rw-r--r--ext/win32ole/tests/testall.rb11
-rw-r--r--ext/win32ole/win32ole.c5569
-rw-r--r--ext/zlib/.cvsignore3
-rw-r--r--ext/zlib/.gitignore1
-rw-r--r--ext/zlib/MANIFEST4
-rw-r--r--ext/zlib/depend177
-rw-r--r--ext/zlib/doc/zlib.rd911
-rw-r--r--ext/zlib/extconf.rb108
-rw-r--r--ext/zlib/zlib.c3884
-rw-r--r--ext/zlib/zlib.gemspec31
-rw-r--r--file.c8264
-rw-r--r--gc.c6757
-rw-r--r--gc.rb599
-rw-r--r--gc/README.md37
-rw-r--r--gc/default/default.c9602
-rw-r--r--gc/default/extconf.rb5
-rw-r--r--gc/extconf_base.rb14
-rw-r--r--gc/gc.h265
-rw-r--r--gc/gc_impl.h126
-rw-r--r--gc/mmtk/.gitignore1
-rw-r--r--gc/mmtk/Cargo.lock1108
-rw-r--r--gc/mmtk/Cargo.toml42
-rw-r--r--gc/mmtk/cbindgen.toml36
-rw-r--r--gc/mmtk/depend18
-rw-r--r--gc/mmtk/extconf.rb24
-rw-r--r--gc/mmtk/mmtk.c1552
-rw-r--r--gc/mmtk/mmtk.h172
-rw-r--r--gc/mmtk/src/abi.rs336
-rw-r--r--gc/mmtk/src/active_plan.rs56
-rw-r--r--gc/mmtk/src/api.rs486
-rw-r--r--gc/mmtk/src/binding.rs129
-rw-r--r--gc/mmtk/src/collection.rs109
-rw-r--r--gc/mmtk/src/heap/mod.rs4
-rw-r--r--gc/mmtk/src/heap/ruby_heap_trigger.rs105
-rw-r--r--gc/mmtk/src/lib.rs161
-rw-r--r--gc/mmtk/src/object_model.rs124
-rw-r--r--gc/mmtk/src/pinning_registry.rs187
-rw-r--r--gc/mmtk/src/reference_glue.rs26
-rw-r--r--gc/mmtk/src/scanning.rs291
-rw-r--r--gc/mmtk/src/utils.rs161
-rw-r--r--gc/mmtk/src/weak_proc.rs321
-rw-r--r--gem_prelude.rb27
-rw-r--r--gems/bundled_gems48
-rw-r--r--gems/lib/core_assertions.rb1
-rw-r--r--gems/lib/envutil.rb1
-rw-r--r--gems/lib/rake/extensiontask.rb14
-rw-r--r--golf_prelude.rb130
-rw-r--r--goruby.c68
-rw-r--r--hash.c8275
-rw-r--r--hash.rb40
-rw-r--r--hrtime.h237
-rw-r--r--id_table.c440
-rw-r--r--id_table.h54
-rw-r--r--imemo.c650
-rw-r--r--include/ruby.h40
-rw-r--r--include/ruby/assert.h316
-rw-r--r--include/ruby/atomic.h1145
-rw-r--r--include/ruby/backward.h19
-rw-r--r--include/ruby/backward/2/assume.h56
-rw-r--r--include/ruby/backward/2/attributes.h161
-rw-r--r--include/ruby/backward/2/bool.h36
-rw-r--r--include/ruby/backward/2/gcc_version_since.h37
-rw-r--r--include/ruby/backward/2/inttypes.h131
-rw-r--r--include/ruby/backward/2/limits.h99
-rw-r--r--include/ruby/backward/2/long_long.h73
-rw-r--r--include/ruby/backward/2/r_cast.h32
-rw-r--r--include/ruby/backward/2/rmodule.h36
-rw-r--r--include/ruby/backward/2/stdalign.h30
-rw-r--r--include/ruby/backward/2/stdarg.h69
-rw-r--r--include/ruby/backward/cxxanyargs.hpp671
-rw-r--r--include/ruby/debug.h834
-rw-r--r--include/ruby/defines.h116
-rw-r--r--include/ruby/encoding.h31
-rw-r--r--include/ruby/fiber/scheduler.h505
-rw-r--r--include/ruby/intern.h64
-rw-r--r--include/ruby/internal/abi.h58
-rw-r--r--include/ruby/internal/anyargs.h398
-rw-r--r--include/ruby/internal/arithmetic.h39
-rw-r--r--include/ruby/internal/arithmetic/char.h81
-rw-r--r--include/ruby/internal/arithmetic/double.h72
-rw-r--r--include/ruby/internal/arithmetic/fixnum.h60
-rw-r--r--include/ruby/internal/arithmetic/gid_t.h41
-rw-r--r--include/ruby/internal/arithmetic/int.h264
-rw-r--r--include/ruby/internal/arithmetic/intptr_t.h86
-rw-r--r--include/ruby/internal/arithmetic/long.h356
-rw-r--r--include/ruby/internal/arithmetic/long_long.h135
-rw-r--r--include/ruby/internal/arithmetic/mode_t.h41
-rw-r--r--include/ruby/internal/arithmetic/off_t.h62
-rw-r--r--include/ruby/internal/arithmetic/pid_t.h41
-rw-r--r--include/ruby/internal/arithmetic/short.h113
-rw-r--r--include/ruby/internal/arithmetic/size_t.h66
-rw-r--r--include/ruby/internal/arithmetic/st_data_t.h75
-rw-r--r--include/ruby/internal/arithmetic/uid_t.h41
-rw-r--r--include/ruby/internal/assume.h87
-rw-r--r--include/ruby/internal/attr/alloc_size.h32
-rw-r--r--include/ruby/internal/attr/artificial.h46
-rw-r--r--include/ruby/internal/attr/cold.h37
-rw-r--r--include/ruby/internal/attr/const.h46
-rw-r--r--include/ruby/internal/attr/constexpr.h84
-rw-r--r--include/ruby/internal/attr/deprecated.h82
-rw-r--r--include/ruby/internal/attr/diagnose_if.h42
-rw-r--r--include/ruby/internal/attr/enum_extensibility.h32
-rw-r--r--include/ruby/internal/attr/error.h32
-rw-r--r--include/ruby/internal/attr/flag_enum.h33
-rw-r--r--include/ruby/internal/attr/forceinline.h40
-rw-r--r--include/ruby/internal/attr/format.h38
-rw-r--r--include/ruby/internal/attr/maybe_unused.h38
-rw-r--r--include/ruby/internal/attr/noalias.h69
-rw-r--r--include/ruby/internal/attr/nodiscard.h45
-rw-r--r--include/ruby/internal/attr/noexcept.h91
-rw-r--r--include/ruby/internal/attr/noinline.h35
-rw-r--r--include/ruby/internal/attr/nonnull.h34
-rw-r--r--include/ruby/internal/attr/nonstring.h40
-rw-r--r--include/ruby/internal/attr/noreturn.h48
-rw-r--r--include/ruby/internal/attr/packed_struct.h43
-rw-r--r--include/ruby/internal/attr/pure.h43
-rw-r--r--include/ruby/internal/attr/restrict.h44
-rw-r--r--include/ruby/internal/attr/returns_nonnull.h37
-rw-r--r--include/ruby/internal/attr/warning.h32
-rw-r--r--include/ruby/internal/attr/weakref.h32
-rw-r--r--include/ruby/internal/cast.h50
-rw-r--r--include/ruby/internal/compiler_is.h45
-rw-r--r--include/ruby/internal/compiler_is/apple.h40
-rw-r--r--include/ruby/internal/compiler_is/clang.h37
-rw-r--r--include/ruby/internal/compiler_is/gcc.h45
-rw-r--r--include/ruby/internal/compiler_is/intel.h40
-rw-r--r--include/ruby/internal/compiler_is/msvc.h45
-rw-r--r--include/ruby/internal/compiler_is/sunpro.h54
-rw-r--r--include/ruby/internal/compiler_since.h61
-rw-r--r--include/ruby/internal/config.h151
-rw-r--r--include/ruby/internal/constant_p.h38
-rw-r--r--include/ruby/internal/core.h35
-rw-r--r--include/ruby/internal/core/rarray.h405
-rw-r--r--include/ruby/internal/core/rbasic.h172
-rw-r--r--include/ruby/internal/core/rbignum.h80
-rw-r--r--include/ruby/internal/core/rclass.h93
-rw-r--r--include/ruby/internal/core/rdata.h363
-rw-r--r--include/ruby/internal/core/rfile.h51
-rw-r--r--include/ruby/internal/core/rhash.h131
-rw-r--r--include/ruby/internal/core/rmatch.h144
-rw-r--r--include/ruby/internal/core/robject.h142
-rw-r--r--include/ruby/internal/core/rregexp.h168
-rw-r--r--include/ruby/internal/core/rstring.h453
-rw-r--r--include/ruby/internal/core/rstruct.h109
-rw-r--r--include/ruby/internal/core/rtypeddata.h761
-rw-r--r--include/ruby/internal/ctype.h545
-rw-r--r--include/ruby/internal/dllexport.h80
-rw-r--r--include/ruby/internal/dosish.h89
-rw-r--r--include/ruby/internal/encoding/coderange.h202
-rw-r--r--include/ruby/internal/encoding/ctype.h258
-rw-r--r--include/ruby/internal/encoding/encoding.h1044
-rw-r--r--include/ruby/internal/encoding/pathname.h184
-rw-r--r--include/ruby/internal/encoding/re.h46
-rw-r--r--include/ruby/internal/encoding/sprintf.h78
-rw-r--r--include/ruby/internal/encoding/string.h346
-rw-r--r--include/ruby/internal/encoding/symbol.h100
-rw-r--r--include/ruby/internal/encoding/transcode.h562
-rw-r--r--include/ruby/internal/error.h599
-rw-r--r--include/ruby/internal/eval.h405
-rw-r--r--include/ruby/internal/event.h159
-rw-r--r--include/ruby/internal/fl_type.h757
-rw-r--r--include/ruby/internal/gc.h826
-rw-r--r--include/ruby/internal/glob.h113
-rw-r--r--include/ruby/internal/globals.h211
-rw-r--r--include/ruby/internal/has/attribute.h163
-rw-r--r--include/ruby/internal/has/builtin.h121
-rw-r--r--include/ruby/internal/has/c_attribute.h50
-rw-r--r--include/ruby/internal/has/cpp_attribute.h86
-rw-r--r--include/ruby/internal/has/declspec_attribute.h47
-rw-r--r--include/ruby/internal/has/extension.h33
-rw-r--r--include/ruby/internal/has/feature.h31
-rw-r--r--include/ruby/internal/has/warning.h31
-rw-r--r--include/ruby/internal/intern/array.h663
-rw-r--r--include/ruby/internal/intern/bignum.h846
-rw-r--r--include/ruby/internal/intern/class.h394
-rw-r--r--include/ruby/internal/intern/compar.h62
-rw-r--r--include/ruby/internal/intern/complex.h249
-rw-r--r--include/ruby/internal/intern/cont.h285
-rw-r--r--include/ruby/internal/intern/dir.h42
-rw-r--r--include/ruby/internal/intern/enum.h73
-rw-r--r--include/ruby/internal/intern/enumerator.h263
-rw-r--r--include/ruby/internal/intern/error.h291
-rw-r--r--include/ruby/internal/intern/eval.h222
-rw-r--r--include/ruby/internal/intern/file.h216
-rw-r--r--include/ruby/internal/intern/hash.h306
-rw-r--r--include/ruby/internal/intern/io.h661
-rw-r--r--include/ruby/internal/intern/load.h255
-rw-r--r--include/ruby/internal/intern/marshal.h112
-rw-r--r--include/ruby/internal/intern/numeric.h208
-rw-r--r--include/ruby/internal/intern/object.h501
-rw-r--r--include/ruby/internal/intern/parse.h194
-rw-r--r--include/ruby/internal/intern/proc.h357
-rw-r--r--include/ruby/internal/intern/process.h282
-rw-r--r--include/ruby/internal/intern/random.h116
-rw-r--r--include/ruby/internal/intern/range.h89
-rw-r--r--include/ruby/internal/intern/rational.h172
-rw-r--r--include/ruby/internal/intern/re.h244
-rw-r--r--include/ruby/internal/intern/ruby.h77
-rw-r--r--include/ruby/internal/intern/select.h88
-rw-r--r--include/ruby/internal/intern/select/largesize.h214
-rw-r--r--include/ruby/internal/intern/select/posix.h144
-rw-r--r--include/ruby/internal/intern/select/win32.h259
-rw-r--r--include/ruby/internal/intern/set.h111
-rw-r--r--include/ruby/internal/intern/signal.h146
-rw-r--r--include/ruby/internal/intern/sprintf.h159
-rw-r--r--include/ruby/internal/intern/string.h1758
-rw-r--r--include/ruby/internal/intern/struct.h225
-rw-r--r--include/ruby/internal/intern/thread.h492
-rw-r--r--include/ruby/internal/intern/time.h161
-rw-r--r--include/ruby/internal/intern/variable.h628
-rw-r--r--include/ruby/internal/intern/vm.h433
-rw-r--r--include/ruby/internal/interpreter.h304
-rw-r--r--include/ruby/internal/iterator.h472
-rw-r--r--include/ruby/internal/memory.h767
-rw-r--r--include/ruby/internal/method.h205
-rw-r--r--include/ruby/internal/module.h177
-rw-r--r--include/ruby/internal/newobj.h112
-rw-r--r--include/ruby/internal/scan_args.h534
-rw-r--r--include/ruby/internal/special_consts.h362
-rw-r--r--include/ruby/internal/static_assert.h78
-rw-r--r--include/ruby/internal/stdalign.h135
-rw-r--r--include/ruby/internal/stdbool.h39
-rw-r--r--include/ruby/internal/stdckdint.h68
-rw-r--r--include/ruby/internal/symbol.h343
-rw-r--r--include/ruby/internal/value.h133
-rw-r--r--include/ruby/internal/value_type.h450
-rw-r--r--include/ruby/internal/variable.h337
-rw-r--r--include/ruby/internal/warning_push.h124
-rw-r--r--include/ruby/internal/xmalloc.h288
-rw-r--r--include/ruby/io.h1132
-rw-r--r--include/ruby/io/buffer.h110
-rw-r--r--include/ruby/memory_view.h325
-rw-r--r--include/ruby/missing.h342
-rw-r--r--include/ruby/onigmo.h953
-rw-r--r--include/ruby/oniguruma.h8
-rw-r--r--include/ruby/ractor.h278
-rw-r--r--include/ruby/random.h361
-rw-r--r--include/ruby/re.h172
-rw-r--r--include/ruby/regex.h43
-rw-r--r--include/ruby/ruby.h446
-rw-r--r--include/ruby/st.h199
-rw-r--r--include/ruby/subst.h26
-rw-r--r--include/ruby/thread.h345
-rw-r--r--include/ruby/thread_native.h210
-rw-r--r--include/ruby/util.h239
-rw-r--r--include/ruby/version.h159
-rw-r--r--include/ruby/vm.h61
-rw-r--r--include/ruby/win32.h841
-rw-r--r--inits.c168
-rw-r--r--insns.def1712
-rw-r--r--instruby.rb215
-rw-r--r--intern.h486
-rw-r--r--internal.h105
-rw-r--r--internal/array.h154
-rw-r--r--internal/basic_operators.h66
-rw-r--r--internal/bignum.h256
-rw-r--r--internal/bits.h647
-rw-r--r--internal/box.h83
-rw-r--r--internal/class.h806
-rw-r--r--internal/cmdlineopt.h64
-rw-r--r--internal/compar.h29
-rw-r--r--internal/compile.h34
-rw-r--r--internal/compilers.h107
-rw-r--r--internal/complex.h29
-rw-r--r--internal/concurrent_set.h21
-rw-r--r--internal/cont.h34
-rw-r--r--internal/dir.h16
-rw-r--r--internal/enc.h19
-rw-r--r--internal/encoding.h39
-rw-r--r--internal/enum.h18
-rw-r--r--internal/enumerator.h21
-rw-r--r--internal/error.h252
-rw-r--r--internal/eval.h43
-rw-r--r--internal/file.h38
-rw-r--r--internal/fixnum.h185
-rw-r--r--internal/gc.h361
-rw-r--r--internal/hash.h194
-rw-r--r--internal/imemo.h312
-rw-r--r--internal/inits.h51
-rw-r--r--internal/io.h163
-rw-r--r--internal/load.h20
-rw-r--r--internal/loadpath.h16
-rw-r--r--internal/math.h23
-rw-r--r--internal/missing.h19
-rw-r--r--internal/numeric.h323
-rw-r--r--internal/object.h63
-rw-r--r--internal/parse.h131
-rw-r--r--internal/proc.h30
-rw-r--r--internal/process.h124
-rw-r--r--internal/ractor.h10
-rw-r--r--internal/random.h17
-rw-r--r--internal/range.h40
-rw-r--r--internal/rational.h71
-rw-r--r--internal/re.h33
-rw-r--r--internal/ruby_parser.h102
-rw-r--r--internal/sanitizers.h346
-rw-r--r--internal/serial.h23
-rw-r--r--internal/set_table.h70
-rw-r--r--internal/signal.h25
-rw-r--r--internal/st.h11
-rw-r--r--internal/static_assert.h16
-rw-r--r--internal/string.h232
-rw-r--r--internal/struct.h140
-rw-r--r--internal/symbol.h46
-rw-r--r--internal/thread.h112
-rw-r--r--internal/time.h34
-rw-r--r--internal/transcode.h23
-rw-r--r--internal/util.h27
-rw-r--r--internal/variable.h74
-rw-r--r--internal/vm.h136
-rw-r--r--internal/warnings.h16
-rw-r--r--io.c17538
-rw-r--r--io.rb136
-rw-r--r--io_buffer.c3981
-rw-r--r--iseq.c4552
-rw-r--r--iseq.h358
-rw-r--r--jit.c799
-rw-r--r--jit/Cargo.toml6
-rw-r--r--jit/src/lib.rs38
-rw-r--r--jit_hook.rb12
-rw-r--r--jit_undef.rb4
-rw-r--r--kernel.rb294
-rw-r--r--keywords42
-rw-r--r--lex.c136
-rw-r--r--lex.c.blt302
-rw-r--r--lib/.document33
-rw-r--r--lib/English.gemspec27
-rw-r--r--lib/English.rb149
-rw-r--r--lib/Env.rb18
-rw-r--r--lib/README96
-rw-r--r--lib/abbrev.rb103
-rw-r--r--lib/base64.rb136
-rw-r--r--lib/benchmark.rb569
-rw-r--r--lib/bundled_gems.rb271
-rw-r--r--lib/bundler.rb681
-rw-r--r--lib/bundler/.document1
-rw-r--r--lib/bundler/build_metadata.rb43
-rw-r--r--lib/bundler/bundler.gemspec45
-rw-r--r--lib/bundler/capistrano.rb4
-rw-r--r--lib/bundler/checksum.rb270
-rw-r--r--lib/bundler/ci_detector.rb75
-rw-r--r--lib/bundler/cli.rb821
-rw-r--r--lib/bundler/cli/add.rb59
-rw-r--r--lib/bundler/cli/binstubs.rb57
-rw-r--r--lib/bundler/cli/cache.rb32
-rw-r--r--lib/bundler/cli/check.rb40
-rw-r--r--lib/bundler/cli/clean.rb25
-rw-r--r--lib/bundler/cli/common.rb155
-rw-r--r--lib/bundler/cli/config.rb203
-rw-r--r--lib/bundler/cli/console.rb47
-rw-r--r--lib/bundler/cli/doctor.rb33
-rw-r--r--lib/bundler/cli/doctor/diagnose.rb167
-rw-r--r--lib/bundler/cli/doctor/ssl.rb249
-rw-r--r--lib/bundler/cli/exec.rb114
-rw-r--r--lib/bundler/cli/fund.rb36
-rw-r--r--lib/bundler/cli/gem.rb485
-rw-r--r--lib/bundler/cli/info.rb83
-rw-r--r--lib/bundler/cli/init.rb51
-rw-r--r--lib/bundler/cli/install.rb124
-rw-r--r--lib/bundler/cli/issue.rb41
-rw-r--r--lib/bundler/cli/list.rb97
-rw-r--r--lib/bundler/cli/lock.rb94
-rw-r--r--lib/bundler/cli/open.rb29
-rw-r--r--lib/bundler/cli/outdated.rb297
-rw-r--r--lib/bundler/cli/platform.rb48
-rw-r--r--lib/bundler/cli/plugin.rb39
-rw-r--r--lib/bundler/cli/pristine.rb64
-rw-r--r--lib/bundler/cli/remove.rb17
-rw-r--r--lib/bundler/cli/show.rb71
-rw-r--r--lib/bundler/cli/update.rb123
-rw-r--r--lib/bundler/compact_index_client.rb92
-rw-r--r--lib/bundler/compact_index_client/cache.rb96
-rw-r--r--lib/bundler/compact_index_client/cache_file.rb148
-rw-r--r--lib/bundler/compact_index_client/parser.rb84
-rw-r--r--lib/bundler/compact_index_client/updater.rb105
-rw-r--r--lib/bundler/constants.rb14
-rw-r--r--lib/bundler/current_ruby.rb94
-rw-r--r--lib/bundler/definition.rb1249
-rw-r--r--lib/bundler/dependency.rb151
-rw-r--r--lib/bundler/deployment.rb6
-rw-r--r--lib/bundler/deprecate.rb44
-rw-r--r--lib/bundler/digest.rb71
-rw-r--r--lib/bundler/dsl.rb638
-rw-r--r--lib/bundler/endpoint_specification.rb174
-rw-r--r--lib/bundler/env.rb148
-rw-r--r--lib/bundler/environment_preserver.rb69
-rw-r--r--lib/bundler/errors.rb280
-rw-r--r--lib/bundler/feature_flag.rb20
-rw-r--r--lib/bundler/fetcher.rb361
-rw-r--r--lib/bundler/fetcher/base.rb52
-rw-r--r--lib/bundler/fetcher/compact_index.rb120
-rw-r--r--lib/bundler/fetcher/dependency.rb79
-rw-r--r--lib/bundler/fetcher/downloader.rb117
-rw-r--r--lib/bundler/fetcher/gem_remote_fetcher.rb22
-rw-r--r--lib/bundler/fetcher/index.rb25
-rw-r--r--lib/bundler/force_platform.rb16
-rw-r--r--lib/bundler/friendly_errors.rb127
-rw-r--r--lib/bundler/gem_helper.rb237
-rw-r--r--lib/bundler/gem_tasks.rb7
-rw-r--r--lib/bundler/gem_version_promoter.rb147
-rw-r--r--lib/bundler/index.rb203
-rw-r--r--lib/bundler/injector.rb285
-rw-r--r--lib/bundler/inline.rb106
-rw-r--r--lib/bundler/installer.rb238
-rw-r--r--lib/bundler/installer/gem_installer.rb74
-rw-r--r--lib/bundler/installer/parallel_installer.rb203
-rw-r--r--lib/bundler/installer/standalone.rb113
-rw-r--r--lib/bundler/lazy_specification.rb270
-rw-r--r--lib/bundler/lockfile_generator.rb104
-rw-r--r--lib/bundler/lockfile_parser.rb306
-rw-r--r--lib/bundler/man/.document1
-rw-r--r--lib/bundler/man/bundle-add.176
-rw-r--r--lib/bundler/man/bundle-add.1.ronn87
-rw-r--r--lib/bundler/man/bundle-binstubs.130
-rw-r--r--lib/bundler/man/bundle-binstubs.1.ronn42
-rw-r--r--lib/bundler/man/bundle-cache.156
-rw-r--r--lib/bundler/man/bundle-cache.1.ronn95
-rw-r--r--lib/bundler/man/bundle-check.121
-rw-r--r--lib/bundler/man/bundle-check.1.ronn26
-rw-r--r--lib/bundler/man/bundle-clean.117
-rw-r--r--lib/bundler/man/bundle-clean.1.ronn18
-rw-r--r--lib/bundler/man/bundle-config.1356
-rw-r--r--lib/bundler/man/bundle-config.1.ronn406
-rw-r--r--lib/bundler/man/bundle-console.133
-rw-r--r--lib/bundler/man/bundle-console.1.ronn39
-rw-r--r--lib/bundler/man/bundle-doctor.169
-rw-r--r--lib/bundler/man/bundle-doctor.1.ronn77
-rw-r--r--lib/bundler/man/bundle-env.19
-rw-r--r--lib/bundler/man/bundle-env.1.ronn10
-rw-r--r--lib/bundler/man/bundle-exec.1104
-rw-r--r--lib/bundler/man/bundle-exec.1.ronn150
-rw-r--r--lib/bundler/man/bundle-fund.122
-rw-r--r--lib/bundler/man/bundle-fund.1.ronn25
-rw-r--r--lib/bundler/man/bundle-gem.1107
-rw-r--r--lib/bundler/man/bundle-gem.1.ronn150
-rw-r--r--lib/bundler/man/bundle-help.19
-rw-r--r--lib/bundler/man/bundle-help.1.ronn12
-rw-r--r--lib/bundler/man/bundle-info.117
-rw-r--r--lib/bundler/man/bundle-info.1.ronn21
-rw-r--r--lib/bundler/man/bundle-init.120
-rw-r--r--lib/bundler/man/bundle-init.1.ronn32
-rw-r--r--lib/bundler/man/bundle-install.1175
-rw-r--r--lib/bundler/man/bundle-install.1.ronn306
-rw-r--r--lib/bundler/man/bundle-issue.145
-rw-r--r--lib/bundler/man/bundle-issue.1.ronn37
-rw-r--r--lib/bundler/man/bundle-licenses.19
-rw-r--r--lib/bundler/man/bundle-licenses.1.ronn10
-rw-r--r--lib/bundler/man/bundle-list.140
-rw-r--r--lib/bundler/man/bundle-list.1.ronn41
-rw-r--r--lib/bundler/man/bundle-lock.175
-rw-r--r--lib/bundler/man/bundle-lock.1.ronn115
-rw-r--r--lib/bundler/man/bundle-open.132
-rw-r--r--lib/bundler/man/bundle-open.1.ronn28
-rw-r--r--lib/bundler/man/bundle-outdated.1103
-rw-r--r--lib/bundler/man/bundle-outdated.1.ronn110
-rw-r--r--lib/bundler/man/bundle-platform.149
-rw-r--r--lib/bundler/man/bundle-platform.1.ronn49
-rw-r--r--lib/bundler/man/bundle-plugin.176
-rw-r--r--lib/bundler/man/bundle-plugin.1.ronn84
-rw-r--r--lib/bundler/man/bundle-pristine.123
-rw-r--r--lib/bundler/man/bundle-pristine.1.ronn34
-rw-r--r--lib/bundler/man/bundle-remove.115
-rw-r--r--lib/bundler/man/bundle-remove.1.ronn16
-rw-r--r--lib/bundler/man/bundle-show.116
-rw-r--r--lib/bundler/man/bundle-show.1.ronn21
-rw-r--r--lib/bundler/man/bundle-update.1281
-rw-r--r--lib/bundler/man/bundle-update.1.ronn359
-rw-r--r--lib/bundler/man/bundle-version.122
-rw-r--r--lib/bundler/man/bundle-version.1.ronn24
-rw-r--r--lib/bundler/man/bundle.193
-rw-r--r--lib/bundler/man/bundle.1.ronn107
-rw-r--r--lib/bundler/man/gemfile.5503
-rw-r--r--lib/bundler/man/gemfile.5.ronn586
-rw-r--r--lib/bundler/man/index.txt31
-rw-r--r--lib/bundler/match_metadata.rb30
-rw-r--r--lib/bundler/match_platform.rb42
-rw-r--r--lib/bundler/match_remote_metadata.rb29
-rw-r--r--lib/bundler/materialization.rb59
-rw-r--r--lib/bundler/mirror.rb221
-rw-r--r--lib/bundler/plugin.rb378
-rw-r--r--lib/bundler/plugin/api.rb81
-rw-r--r--lib/bundler/plugin/api/source.rb322
-rw-r--r--lib/bundler/plugin/dsl.rb53
-rw-r--r--lib/bundler/plugin/events.rb85
-rw-r--r--lib/bundler/plugin/index.rb197
-rw-r--r--lib/bundler/plugin/installer.rb122
-rw-r--r--lib/bundler/plugin/installer/git.rb34
-rw-r--r--lib/bundler/plugin/installer/path.rb26
-rw-r--r--lib/bundler/plugin/installer/rubygems.rb19
-rw-r--r--lib/bundler/plugin/source_list.rb31
-rw-r--r--lib/bundler/process_lock.rb20
-rw-r--r--lib/bundler/remote_specification.rb126
-rw-r--r--lib/bundler/resolver.rb524
-rw-r--r--lib/bundler/resolver/base.rb118
-rw-r--r--lib/bundler/resolver/candidate.rb85
-rw-r--r--lib/bundler/resolver/incompatibility.rb15
-rw-r--r--lib/bundler/resolver/package.rb95
-rw-r--r--lib/bundler/resolver/root.rb25
-rw-r--r--lib/bundler/resolver/spec_group.rb74
-rw-r--r--lib/bundler/resolver/strategy.rb40
-rw-r--r--lib/bundler/retry.rb66
-rw-r--r--lib/bundler/ruby_dsl.rb67
-rw-r--r--lib/bundler/ruby_version.rb135
-rw-r--r--lib/bundler/rubygems_ext.rb481
-rw-r--r--lib/bundler/rubygems_gem_installer.rb176
-rw-r--r--lib/bundler/rubygems_integration.rb456
-rw-r--r--lib/bundler/runtime.rb331
-rw-r--r--lib/bundler/safe_marshal.rb31
-rw-r--r--lib/bundler/self_manager.rb196
-rw-r--r--lib/bundler/settings.rb579
-rw-r--r--lib/bundler/settings/validator.rb79
-rw-r--r--lib/bundler/setup.rb39
-rw-r--r--lib/bundler/shared_helpers.rb393
-rw-r--r--lib/bundler/source.rb118
-rw-r--r--lib/bundler/source/gemspec.rb19
-rw-r--r--lib/bundler/source/git.rb451
-rw-r--r--lib/bundler/source/git/git_proxy.rb464
-rw-r--r--lib/bundler/source/metadata.rb63
-rw-r--r--lib/bundler/source/path.rb255
-rw-r--r--lib/bundler/source/path/installer.rb53
-rw-r--r--lib/bundler/source/rubygems.rb516
-rw-r--r--lib/bundler/source/rubygems/remote.rb76
-rw-r--r--lib/bundler/source/rubygems_aggregate.rb68
-rw-r--r--lib/bundler/source_list.rb228
-rw-r--r--lib/bundler/source_map.rb68
-rw-r--r--lib/bundler/spec_set.rb390
-rw-r--r--lib/bundler/stub_specification.rb146
-rw-r--r--lib/bundler/templates/.document1
-rw-r--r--lib/bundler/templates/Executable16
-rw-r--r--lib/bundler/templates/Executable.standalone14
-rw-r--r--lib/bundler/templates/Gemfile5
-rw-r--r--lib/bundler/templates/newgem/CHANGELOG.md.tt5
-rw-r--r--lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt10
-rw-r--r--lib/bundler/templates/newgem/Cargo.toml.tt7
-rw-r--r--lib/bundler/templates/newgem/Gemfile.tt24
-rw-r--r--lib/bundler/templates/newgem/LICENSE.txt.tt21
-rw-r--r--lib/bundler/templates/newgem/README.md.tt49
-rw-r--r--lib/bundler/templates/newgem/Rakefile.tt72
-rw-r--r--lib/bundler/templates/newgem/bin/console.tt11
-rw-r--r--lib/bundler/templates/newgem/bin/setup.tt8
-rw-r--r--lib/bundler/templates/newgem/circleci/config.yml.tt37
-rw-r--r--lib/bundler/templates/newgem/exe/newgem.tt3
-rw-r--r--lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt15
-rw-r--r--lib/bundler/templates/newgem/ext/newgem/extconf-c.rb.tt10
-rw-r--r--lib/bundler/templates/newgem/ext/newgem/extconf-go.rb.tt11
-rw-r--r--lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt6
-rw-r--r--lib/bundler/templates/newgem/ext/newgem/go.mod.tt5
-rw-r--r--lib/bundler/templates/newgem/ext/newgem/newgem-go.c.tt2
-rw-r--r--lib/bundler/templates/newgem/ext/newgem/newgem.c.tt9
-rw-r--r--lib/bundler/templates/newgem/ext/newgem/newgem.go.tt31
-rw-r--r--lib/bundler/templates/newgem/ext/newgem/newgem.h.tt6
-rw-r--r--lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt12
-rw-r--r--lib/bundler/templates/newgem/github/workflows/main.yml.tt45
-rw-r--r--lib/bundler/templates/newgem/gitignore.tt23
-rw-r--r--lib/bundler/templates/newgem/gitlab-ci.yml.tt27
-rw-r--r--lib/bundler/templates/newgem/lib/newgem.rb.tt15
-rw-r--r--lib/bundler/templates/newgem/lib/newgem/version.rb.tt9
-rw-r--r--lib/bundler/templates/newgem/newgem.gemspec.tt56
-rw-r--r--lib/bundler/templates/newgem/rspec.tt3
-rw-r--r--lib/bundler/templates/newgem/rubocop.yml.tt8
-rw-r--r--lib/bundler/templates/newgem/sig/newgem.rbs.tt8
-rw-r--r--lib/bundler/templates/newgem/spec/newgem_spec.rb.tt11
-rw-r--r--lib/bundler/templates/newgem/spec/spec_helper.rb.tt15
-rw-r--r--lib/bundler/templates/newgem/standard.yml.tt3
-rw-r--r--lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt6
-rw-r--r--lib/bundler/templates/newgem/test/minitest/test_newgem.rb.tt13
-rw-r--r--lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt15
-rw-r--r--lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt6
-rw-r--r--lib/bundler/ui.rb9
-rw-r--r--lib/bundler/ui/rg_proxy.rb19
-rw-r--r--lib/bundler/ui/shell.rb191
-rw-r--r--lib/bundler/ui/silent.rb96
-rw-r--r--lib/bundler/uri_credentials_filter.rb43
-rw-r--r--lib/bundler/uri_normalizer.rb23
-rw-r--r--lib/bundler/vendor/.document1
-rw-r--r--lib/bundler/vendor/connection_pool/lib/connection_pool.rb233
-rw-r--r--lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb237
-rw-r--r--lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb3
-rw-r--r--lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb56
-rw-r--r--lib/bundler/vendor/fileutils/lib/fileutils.rb2701
-rw-r--r--lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb1153
-rw-r--r--lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb41
-rw-r--r--lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb65
-rw-r--r--lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb80
-rw-r--r--lib/bundler/vendor/pub_grub/lib/pub_grub.rb31
-rw-r--r--lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb20
-rw-r--r--lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb169
-rw-r--r--lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb182
-rw-r--r--lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb150
-rw-r--r--lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb43
-rw-r--r--lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb121
-rw-r--r--lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb45
-rw-r--r--lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb19
-rw-r--r--lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb61
-rw-r--r--lib/bundler/vendor/pub_grub/lib/pub_grub/strategy.rb42
-rw-r--r--lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb105
-rw-r--r--lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb3
-rw-r--r--lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb129
-rw-r--r--lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb423
-rw-r--r--lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb236
-rw-r--r--lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb178
-rw-r--r--lib/bundler/vendor/securerandom/lib/securerandom.rb102
-rw-r--r--lib/bundler/vendor/thor/lib/thor.rb674
-rw-r--r--lib/bundler/vendor/thor/lib/thor/actions.rb340
-rw-r--r--lib/bundler/vendor/thor/lib/thor/actions/create_file.rb105
-rw-r--r--lib/bundler/vendor/thor/lib/thor/actions/create_link.rb61
-rw-r--r--lib/bundler/vendor/thor/lib/thor/actions/directory.rb108
-rw-r--r--lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb143
-rw-r--r--lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb407
-rw-r--r--lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb130
-rw-r--r--lib/bundler/vendor/thor/lib/thor/base.rb825
-rw-r--r--lib/bundler/vendor/thor/lib/thor/command.rb151
-rw-r--r--lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb107
-rw-r--r--lib/bundler/vendor/thor/lib/thor/error.rb106
-rw-r--r--lib/bundler/vendor/thor/lib/thor/group.rb292
-rw-r--r--lib/bundler/vendor/thor/lib/thor/invocation.rb178
-rw-r--r--lib/bundler/vendor/thor/lib/thor/line_editor.rb17
-rw-r--r--lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb37
-rw-r--r--lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb88
-rw-r--r--lib/bundler/vendor/thor/lib/thor/nested_context.rb29
-rw-r--r--lib/bundler/vendor/thor/lib/thor/parser.rb4
-rw-r--r--lib/bundler/vendor/thor/lib/thor/parser/argument.rb86
-rw-r--r--lib/bundler/vendor/thor/lib/thor/parser/arguments.rb195
-rw-r--r--lib/bundler/vendor/thor/lib/thor/parser/option.rb178
-rw-r--r--lib/bundler/vendor/thor/lib/thor/parser/options.rb294
-rw-r--r--lib/bundler/vendor/thor/lib/thor/rake_compat.rb72
-rw-r--r--lib/bundler/vendor/thor/lib/thor/runner.rb335
-rw-r--r--lib/bundler/vendor/thor/lib/thor/shell.rb81
-rw-r--r--lib/bundler/vendor/thor/lib/thor/shell/basic.rb384
-rw-r--r--lib/bundler/vendor/thor/lib/thor/shell/color.rb112
-rw-r--r--lib/bundler/vendor/thor/lib/thor/shell/column_printer.rb29
-rw-r--r--lib/bundler/vendor/thor/lib/thor/shell/html.rb81
-rw-r--r--lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb118
-rw-r--r--lib/bundler/vendor/thor/lib/thor/shell/terminal.rb42
-rw-r--r--lib/bundler/vendor/thor/lib/thor/shell/wrapped_printer.rb38
-rw-r--r--lib/bundler/vendor/thor/lib/thor/util.rb285
-rw-r--r--lib/bundler/vendor/thor/lib/thor/version.rb3
-rw-r--r--lib/bundler/vendor/tsort/lib/tsort.rb455
-rw-r--r--lib/bundler/vendor/uri/lib/uri.rb104
-rw-r--r--lib/bundler/vendor/uri/lib/uri/common.rb922
-rw-r--r--lib/bundler/vendor/uri/lib/uri/file.rb100
-rw-r--r--lib/bundler/vendor/uri/lib/uri/ftp.rb267
-rw-r--r--lib/bundler/vendor/uri/lib/uri/generic.rb1592
-rw-r--r--lib/bundler/vendor/uri/lib/uri/http.rb137
-rw-r--r--lib/bundler/vendor/uri/lib/uri/https.rb23
-rw-r--r--lib/bundler/vendor/uri/lib/uri/ldap.rb261
-rw-r--r--lib/bundler/vendor/uri/lib/uri/ldaps.rb22
-rw-r--r--lib/bundler/vendor/uri/lib/uri/mailto.rb293
-rw-r--r--lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb547
-rw-r--r--lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb206
-rw-r--r--lib/bundler/vendor/uri/lib/uri/version.rb6
-rw-r--r--lib/bundler/vendor/uri/lib/uri/ws.rb83
-rw-r--r--lib/bundler/vendor/uri/lib/uri/wss.rb23
-rw-r--r--lib/bundler/vendored_fileutils.rb4
-rw-r--r--lib/bundler/vendored_net_http.rb23
-rw-r--r--lib/bundler/vendored_persistent.rb11
-rw-r--r--lib/bundler/vendored_pub_grub.rb4
-rw-r--r--lib/bundler/vendored_securerandom.rb12
-rw-r--r--lib/bundler/vendored_thor.rb8
-rw-r--r--lib/bundler/vendored_timeout.rb12
-rw-r--r--lib/bundler/vendored_tsort.rb4
-rw-r--r--lib/bundler/vendored_uri.rb21
-rw-r--r--lib/bundler/version.rb21
-rw-r--r--lib/bundler/vlad.rb4
-rw-r--r--lib/bundler/worker.rb117
-rw-r--r--lib/bundler/yaml_serializer.rb98
-rw-r--r--lib/cgi-lib.rb270
-rw-r--r--lib/cgi.rb2318
-rw-r--r--lib/cgi/.document2
-rw-r--r--lib/cgi/escape.rb232
-rw-r--r--lib/cgi/session.rb465
-rw-r--r--lib/cgi/session/pstore.rb123
-rw-r--r--lib/cgi/util.rb7
-rw-r--r--lib/complex.rb631
-rw-r--r--lib/csv.rb992
-rw-r--r--lib/date.rb1322
-rw-r--r--lib/date/format.rb563
-rw-r--r--lib/date2.rb5
-rw-r--r--lib/debug.rb941
-rw-r--r--lib/delegate.gemspec29
-rw-r--r--lib/delegate.rb528
-rw-r--r--lib/did_you_mean.rb131
-rw-r--r--lib/did_you_mean/core_ext/name_error.rb57
-rw-r--r--lib/did_you_mean/did_you_mean.gemspec25
-rw-r--r--lib/did_you_mean/experimental.rb2
-rw-r--r--lib/did_you_mean/formatter.rb44
-rw-r--r--lib/did_you_mean/formatters/plain_formatter.rb4
-rw-r--r--lib/did_you_mean/formatters/verbose_formatter.rb10
-rw-r--r--lib/did_you_mean/jaro_winkler.rb84
-rw-r--r--lib/did_you_mean/levenshtein.rb57
-rw-r--r--lib/did_you_mean/spell_checker.rb46
-rw-r--r--lib/did_you_mean/spell_checkers/key_error_checker.rb28
-rw-r--r--lib/did_you_mean/spell_checkers/method_name_checker.rb79
-rw-r--r--lib/did_you_mean/spell_checkers/name_error_checkers.rb20
-rw-r--r--lib/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb49
-rw-r--r--lib/did_you_mean/spell_checkers/name_error_checkers/variable_name_checker.rb85
-rw-r--r--lib/did_you_mean/spell_checkers/null_checker.rb6
-rw-r--r--lib/did_you_mean/spell_checkers/pattern_key_name_checker.rb28
-rw-r--r--lib/did_you_mean/spell_checkers/require_path_checker.rb39
-rw-r--r--lib/did_you_mean/tree_spell_checker.rb109
-rw-r--r--lib/did_you_mean/verbose.rb2
-rw-r--r--lib/did_you_mean/version.rb3
-rw-r--r--lib/drb.rb2
-rw-r--r--lib/drb/acl.rb144
-rw-r--r--lib/drb/drb.rb1619
-rw-r--r--lib/drb/eq.rb16
-rw-r--r--lib/drb/extserv.rb67
-rw-r--r--lib/drb/extservm.rb94
-rw-r--r--lib/drb/gw.rb60
-rw-r--r--lib/drb/invokemethod.rb36
-rw-r--r--lib/drb/observer.rb22
-rw-r--r--lib/drb/ssl.rb185
-rw-r--r--lib/drb/timeridconv.rb91
-rw-r--r--lib/drb/unix.rb107
-rw-r--r--lib/e2mmap.rb195
-rw-r--r--lib/erb.rb1574
-rw-r--r--lib/erb/compiler.rb487
-rw-r--r--lib/erb/def_method.rb47
-rw-r--r--lib/erb/erb.gemspec37
-rw-r--r--lib/erb/util.rb77
-rw-r--r--lib/erb/version.rb5
-rw-r--r--lib/eregex.rb37
-rw-r--r--lib/error_highlight.rb2
-rw-r--r--lib/error_highlight/base.rb938
-rw-r--r--lib/error_highlight/core_ext.rb76
-rw-r--r--lib/error_highlight/error_highlight.gemspec27
-rw-r--r--lib/error_highlight/formatter.rb74
-rw-r--r--lib/error_highlight/version.rb3
-rw-r--r--lib/fileutils.gemspec31
-rw-r--r--lib/fileutils.rb3079
-rw-r--r--lib/finalize.rb186
-rw-r--r--lib/find.gemspec29
-rw-r--r--lib/find.rb68
-rw-r--r--lib/forwardable.rb340
-rw-r--r--lib/forwardable/forwardable.gemspec26
-rw-r--r--lib/ftools.rb255
-rw-r--r--lib/generator.rb380
-rw-r--r--lib/getoptlong.rb468
-rw-r--r--lib/getopts.rb124
-rw-r--r--lib/gserver.rb249
-rw-r--r--lib/importenv.rb31
-rw-r--r--lib/ipaddr.gemspec36
-rw-r--r--lib/ipaddr.rb945
-rw-r--r--lib/irb.rb340
-rw-r--r--lib/irb/cmd/chws.rb33
-rw-r--r--lib/irb/cmd/fork.rb25
-rw-r--r--lib/irb/cmd/load.rb67
-rw-r--r--lib/irb/cmd/nop.rb39
-rw-r--r--lib/irb/cmd/pushws.rb39
-rw-r--r--lib/irb/cmd/subirb.rb43
-rw-r--r--lib/irb/completion.rb188
-rw-r--r--lib/irb/context.rb234
-rw-r--r--lib/irb/ext/change-ws.rb62
-rw-r--r--lib/irb/ext/history.rb110
-rw-r--r--lib/irb/ext/loader.rb106
-rw-r--r--lib/irb/ext/math-mode.rb37
-rw-r--r--lib/irb/ext/multi-irb.rb241
-rw-r--r--lib/irb/ext/tracer.rb61
-rw-r--r--lib/irb/ext/use-loader.rb65
-rw-r--r--lib/irb/ext/workspaces.rb56
-rw-r--r--lib/irb/extend-command.rb215
-rw-r--r--lib/irb/frame.rb67
-rw-r--r--lib/irb/help.rb33
-rw-r--r--lib/irb/init.rb225
-rw-r--r--lib/irb/input-method.rb120
-rw-r--r--lib/irb/lc/error.rb30
-rw-r--r--lib/irb/lc/help-message35
-rw-r--r--lib/irb/lc/ja/error.rb29
-rw-r--r--lib/irb/lc/ja/help-message36
-rw-r--r--lib/irb/locale.rb186
-rw-r--r--lib/irb/ruby-lex.rb1070
-rw-r--r--lib/irb/ruby-token.rb273
-rw-r--r--lib/irb/slex.rb278
-rw-r--r--lib/irb/version.rb16
-rw-r--r--lib/irb/workspace.rb107
-rw-r--r--lib/irb/ws-for-case-2.rb15
-rw-r--r--lib/irb/xmp.rb86
-rw-r--r--lib/jcode.rb219
-rw-r--r--lib/logger.rb728
-rw-r--r--lib/mailread.rb48
-rw-r--r--lib/mathn.rb306
-rw-r--r--lib/matrix.rb1272
-rw-r--r--lib/mkmf.rb3622
-rw-r--r--lib/monitor.rb321
-rw-r--r--lib/mutex_m.rb118
-rw-r--r--lib/net/ftp.rb923
-rw-r--r--lib/net/http.rb3729
-rw-r--r--lib/net/http/exceptions.rb35
-rw-r--r--lib/net/http/generic_request.rb429
-rw-r--r--lib/net/http/header.rb985
-rw-r--r--lib/net/http/net-http.gemspec39
-rw-r--r--lib/net/http/proxy_delta.rb17
-rw-r--r--lib/net/http/request.rb88
-rw-r--r--lib/net/http/requests.rb444
-rw-r--r--lib/net/http/response.rb739
-rw-r--r--lib/net/http/responses.rb1242
-rw-r--r--lib/net/http/status.rb84
-rw-r--r--lib/net/https.rb23
-rw-r--r--lib/net/imap.rb3299
-rw-r--r--lib/net/net-protocol.gemspec33
-rw-r--r--lib/net/pop.rb879
-rw-r--r--lib/net/protocol.rb564
-rw-r--r--lib/net/smtp.rb697
-rw-r--r--lib/net/telnet.rb742
-rw-r--r--lib/observer.rb192
-rw-r--r--lib/open-uri.gemspec32
-rw-r--r--lib/open-uri.rb949
-rw-r--r--lib/open3.rb1448
-rw-r--r--lib/open3/open3.gemspec33
-rw-r--r--lib/open3/version.rb4
-rw-r--r--lib/optionparser.rb2
-rw-r--r--lib/optparse.rb2585
-rw-r--r--lib/optparse/ac.rb70
-rw-r--r--lib/optparse/date.rb3
-rw-r--r--lib/optparse/kwargs.rb27
-rw-r--r--lib/optparse/optparse.gemspec34
-rw-r--r--lib/optparse/shellwords.rb3
-rw-r--r--lib/optparse/time.rb3
-rw-r--r--lib/optparse/uri.rb3
-rw-r--r--lib/optparse/version.rb58
-rw-r--r--lib/ostruct.rb102
-rw-r--r--lib/parsearg.rb83
-rw-r--r--lib/parsedate.rb15
-rw-r--r--lib/pathname.rb1197
-rw-r--r--lib/ping.rb64
-rw-r--r--lib/pp.gemspec35
-rw-r--r--lib/pp.rb880
-rw-r--r--lib/prettyprint.gemspec29
-rw-r--r--lib/prettyprint.rb969
-rw-r--r--lib/prism.rb109
-rw-r--r--lib/prism/desugar_compiler.rb392
-rw-r--r--lib/prism/ffi.rb578
-rw-r--r--lib/prism/lex_compat.rb950
-rw-r--r--lib/prism/lex_ripper.rb62
-rw-r--r--lib/prism/node_ext.rb511
-rw-r--r--lib/prism/pack.rb230
-rw-r--r--lib/prism/parse_result.rb907
-rw-r--r--lib/prism/parse_result/comments.rb188
-rw-r--r--lib/prism/parse_result/errors.rb66
-rw-r--r--lib/prism/parse_result/newlines.rb155
-rw-r--r--lib/prism/pattern.rb269
-rw-r--r--lib/prism/polyfill/append_as_bytes.rb15
-rw-r--r--lib/prism/polyfill/byteindex.rb13
-rw-r--r--lib/prism/polyfill/scan_byte.rb14
-rw-r--r--lib/prism/polyfill/unpack1.rb14
-rw-r--r--lib/prism/polyfill/warn.rb36
-rw-r--r--lib/prism/prism.gemspec173
-rw-r--r--lib/prism/relocation.rb505
-rw-r--r--lib/prism/string_query.rb31
-rw-r--r--lib/prism/translation.rb18
-rw-r--r--lib/prism/translation/parser.rb376
-rw-r--r--lib/prism/translation/parser/builder.rb62
-rw-r--r--lib/prism/translation/parser/compiler.rb2234
-rw-r--r--lib/prism/translation/parser/lexer.rb820
-rw-r--r--lib/prism/translation/parser_current.rb26
-rw-r--r--lib/prism/translation/parser_versions.rb36
-rw-r--r--lib/prism/translation/ripper.rb3511
-rw-r--r--lib/prism/translation/ripper/filter.rb53
-rw-r--r--lib/prism/translation/ripper/lexer.rb135
-rw-r--r--lib/prism/translation/ripper/sexp.rb126
-rw-r--r--lib/prism/translation/ripper/shim.rb5
-rw-r--r--lib/prism/translation/ruby_parser.rb1964
-rw-r--r--lib/profile.rb6
-rw-r--r--lib/profiler.rb59
-rw-r--r--lib/pstore.rb193
-rw-r--r--lib/racc/parser.rb456
-rw-r--r--lib/random/formatter.rb372
-rw-r--r--lib/rational.rb374
-rw-r--r--lib/rdoc/README466
-rw-r--r--lib/rdoc/code_objects.rb699
-rw-r--r--lib/rdoc/diagram.rb333
-rw-r--r--lib/rdoc/dot/dot.rb255
-rw-r--r--lib/rdoc/generators/chm_generator.rb112
-rw-r--r--lib/rdoc/generators/html_generator.rb1440
-rw-r--r--lib/rdoc/generators/ri_generator.rb268
-rw-r--r--lib/rdoc/generators/template/chm/chm.rb87
-rw-r--r--lib/rdoc/generators/template/html/hefss.rb418
-rw-r--r--lib/rdoc/generators/template/html/html.rb647
-rw-r--r--lib/rdoc/generators/template/html/kilmer.rb416
-rw-r--r--lib/rdoc/generators/template/html/old_html.rb728
-rw-r--r--lib/rdoc/generators/template/html/one_page_html.rb122
-rw-r--r--lib/rdoc/generators/template/xml/rdf.rb112
-rw-r--r--lib/rdoc/generators/template/xml/xml.rb112
-rw-r--r--lib/rdoc/generators/xml_generator.rb130
-rw-r--r--lib/rdoc/markup/sample/rdoc2latex.rb16
-rw-r--r--lib/rdoc/markup/sample/sample.rb42
-rw-r--r--lib/rdoc/markup/simple_markup.rb477
-rw-r--r--lib/rdoc/markup/simple_markup/fragments.rb328
-rw-r--r--lib/rdoc/markup/simple_markup/inline.rb338
-rw-r--r--lib/rdoc/markup/simple_markup/lines.rb151
-rw-r--r--lib/rdoc/markup/simple_markup/preprocess.rb70
-rw-r--r--lib/rdoc/markup/simple_markup/to_flow.rb189
-rw-r--r--lib/rdoc/markup/simple_markup/to_html.rb289
-rw-r--r--lib/rdoc/markup/simple_markup/to_latex.rb333
-rw-r--r--lib/rdoc/markup/test/AllTests.rb2
-rw-r--r--lib/rdoc/markup/test/TestInline.rb154
-rw-r--r--lib/rdoc/markup/test/TestParse.rb503
-rw-r--r--lib/rdoc/options.rb575
-rw-r--r--lib/rdoc/parsers/parse_c.rb498
-rw-r--r--lib/rdoc/parsers/parse_f95.rb119
-rw-r--r--lib/rdoc/parsers/parse_rb.rb2583
-rw-r--r--lib/rdoc/parsers/parse_simple.rb37
-rw-r--r--lib/rdoc/parsers/parserfactory.rb99
-rw-r--r--lib/rdoc/rdoc.rb282
-rw-r--r--lib/rdoc/ri/ri_cache.rb176
-rw-r--r--lib/rdoc/ri/ri_descriptions.rb148
-rw-r--r--lib/rdoc/ri/ri_display.rb273
-rw-r--r--lib/rdoc/ri/ri_driver.rb132
-rw-r--r--lib/rdoc/ri/ri_formatter.rb599
-rw-r--r--lib/rdoc/ri/ri_options.rb246
-rw-r--r--lib/rdoc/ri/ri_paths.rb51
-rw-r--r--lib/rdoc/ri/ri_reader.rb91
-rw-r--r--lib/rdoc/ri/ri_util.rb75
-rw-r--r--lib/rdoc/ri/ri_writer.rb62
-rw-r--r--lib/rdoc/template.rb234
-rw-r--r--lib/rdoc/tokenstream.rb25
-rw-r--r--lib/readbytes.rb36
-rw-r--r--lib/resolv-replace.rb62
-rw-r--r--lib/resolv.gemspec29
-rw-r--r--lib/resolv.rb2796
-rw-r--r--lib/rexml/attlistdecl.rb62
-rw-r--r--lib/rexml/attribute.rb157
-rw-r--r--lib/rexml/cdata.rb68
-rw-r--r--lib/rexml/child.rb96
-rw-r--r--lib/rexml/comment.rb86
-rw-r--r--lib/rexml/doctype.rb213
-rw-r--r--lib/rexml/document.rb247
-rw-r--r--lib/rexml/dtd/attlistdecl.rb10
-rw-r--r--lib/rexml/dtd/dtd.rb51
-rw-r--r--lib/rexml/dtd/elementdecl.rb17
-rw-r--r--lib/rexml/dtd/entitydecl.rb56
-rw-r--r--lib/rexml/dtd/notationdecl.rb39
-rw-r--r--lib/rexml/element.rb1174
-rw-r--r--lib/rexml/encoding.rb56
-rw-r--r--lib/rexml/encodings/CP-1252.rb98
-rw-r--r--lib/rexml/encodings/EUC-JP.rb37
-rw-r--r--lib/rexml/encodings/ICONV.rb16
-rw-r--r--lib/rexml/encodings/ISO-8859-1.rb25
-rw-r--r--lib/rexml/encodings/ISO-8859-15.rb69
-rw-r--r--lib/rexml/encodings/SHIFT-JIS.rb37
-rw-r--r--lib/rexml/encodings/SHIFT_JIS.rb1
-rw-r--r--lib/rexml/encodings/UNILE.rb29
-rw-r--r--lib/rexml/encodings/US-ASCII.rb25
-rw-r--r--lib/rexml/encodings/UTF-16.rb29
-rw-r--r--lib/rexml/encodings/UTF-8.rb13
-rw-r--r--lib/rexml/entity.rb159
-rw-r--r--lib/rexml/functions.rb372
-rw-r--r--lib/rexml/instruction.rb62
-rw-r--r--lib/rexml/light/node.rb196
-rw-r--r--lib/rexml/namespace.rb47
-rw-r--r--lib/rexml/node.rb40
-rw-r--r--lib/rexml/output.rb24
-rw-r--r--lib/rexml/parent.rb165
-rw-r--r--lib/rexml/parseexception.rb51
-rw-r--r--lib/rexml/parsers/baseparser.rb413
-rw-r--r--lib/rexml/parsers/lightparser.rb56
-rw-r--r--lib/rexml/parsers/pullparser.rb143
-rw-r--r--lib/rexml/parsers/sax2parser.rb208
-rw-r--r--lib/rexml/parsers/streamparser.rb36
-rw-r--r--lib/rexml/parsers/ultralightparser.rb52
-rw-r--r--lib/rexml/parsers/xpathparser.rb601
-rw-r--r--lib/rexml/quickpath.rb266
-rw-r--r--lib/rexml/rexml.rb26
-rw-r--r--lib/rexml/sax2listener.rb94
-rw-r--r--lib/rexml/source.rb208
-rw-r--r--lib/rexml/streamlistener.rb89
-rw-r--r--lib/rexml/text.rb328
-rw-r--r--lib/rexml/xmldecl.rb105
-rw-r--r--lib/rexml/xmltokens.rb18
-rw-r--r--lib/rexml/xpath.rb62
-rw-r--r--lib/rexml/xpath_parser.rb556
-rw-r--r--lib/rinda/rinda.rb184
-rw-r--r--lib/rinda/ring.rb164
-rw-r--r--lib/rinda/tuplespace.rb428
-rw-r--r--lib/rss/0.9.rb409
-rw-r--r--lib/rss/1.0.rb638
-rw-r--r--lib/rss/2.0.rb147
-rw-r--r--lib/rss/content.rb50
-rw-r--r--lib/rss/converter.rb154
-rw-r--r--lib/rss/dublincore.rb62
-rw-r--r--lib/rss/parser.rb380
-rw-r--r--lib/rss/rexmlparser.rb47
-rw-r--r--lib/rss/rss.rb634
-rw-r--r--lib/rss/syndication.rb83
-rw-r--r--lib/rss/taxonomy.rb32
-rw-r--r--lib/rss/trackback.rb301
-rw-r--r--lib/rss/utils.rb17
-rw-r--r--lib/rss/xml-stylesheet.rb94
-rw-r--r--lib/rss/xmlparser.rb91
-rw-r--r--lib/rss/xmlscanner.rb102
-rw-r--r--lib/ruby2_keywords.gemspec23
-rw-r--r--lib/rubygems.rb1453
-rw-r--r--lib/rubygems/available_set.rb165
-rw-r--r--lib/rubygems/basic_specification.rb384
-rw-r--r--lib/rubygems/bundler_version_finder.rb112
-rw-r--r--lib/rubygems/ci_detector.rb75
-rw-r--r--lib/rubygems/command.rb664
-rw-r--r--lib/rubygems/command_manager.rb254
-rw-r--r--lib/rubygems/commands/build_command.rb120
-rw-r--r--lib/rubygems/commands/cert_command.rb325
-rw-r--r--lib/rubygems/commands/check_command.rb97
-rw-r--r--lib/rubygems/commands/cleanup_command.rb178
-rw-r--r--lib/rubygems/commands/contents_command.rb196
-rw-r--r--lib/rubygems/commands/dependency_command.rb206
-rw-r--r--lib/rubygems/commands/environment_command.rb181
-rw-r--r--lib/rubygems/commands/exec_command.rb256
-rw-r--r--lib/rubygems/commands/fetch_command.rb109
-rw-r--r--lib/rubygems/commands/generate_index_command.rb51
-rw-r--r--lib/rubygems/commands/help_command.rb375
-rw-r--r--lib/rubygems/commands/info_command.rb38
-rw-r--r--lib/rubygems/commands/install_command.rb265
-rw-r--r--lib/rubygems/commands/list_command.rb42
-rw-r--r--lib/rubygems/commands/lock_command.rb109
-rw-r--r--lib/rubygems/commands/mirror_command.rb26
-rw-r--r--lib/rubygems/commands/open_command.rb83
-rw-r--r--lib/rubygems/commands/outdated_command.rb33
-rw-r--r--lib/rubygems/commands/owner_command.rb124
-rw-r--r--lib/rubygems/commands/pristine_command.rb218
-rw-r--r--lib/rubygems/commands/push_command.rb135
-rw-r--r--lib/rubygems/commands/rdoc_command.rb90
-rw-r--r--lib/rubygems/commands/rebuild_command.rb261
-rw-r--r--lib/rubygems/commands/search_command.rb41
-rw-r--r--lib/rubygems/commands/server_command.rb26
-rw-r--r--lib/rubygems/commands/setup_command.rb667
-rw-r--r--lib/rubygems/commands/signin_command.rb34
-rw-r--r--lib/rubygems/commands/signout_command.rb32
-rw-r--r--lib/rubygems/commands/sources_command.rb331
-rw-r--r--lib/rubygems/commands/specification_command.rb156
-rw-r--r--lib/rubygems/commands/stale_command.rb40
-rw-r--r--lib/rubygems/commands/uninstall_command.rb204
-rw-r--r--lib/rubygems/commands/unpack_command.rb168
-rw-r--r--lib/rubygems/commands/update_command.rb326
-rw-r--r--lib/rubygems/commands/which_command.rb88
-rw-r--r--lib/rubygems/commands/yank_command.rb99
-rw-r--r--lib/rubygems/config_file.rb618
-rw-r--r--lib/rubygems/core_ext/kernel_gem.rb68
-rw-r--r--lib/rubygems/core_ext/kernel_require.rb152
-rw-r--r--lib/rubygems/core_ext/kernel_warn.rb45
-rw-r--r--lib/rubygems/core_ext/tcpsocket_init.rb54
-rw-r--r--lib/rubygems/defaults.rb308
-rw-r--r--lib/rubygems/dependency.rb348
-rw-r--r--lib/rubygems/dependency_installer.rb260
-rw-r--r--lib/rubygems/dependency_list.rb242
-rw-r--r--lib/rubygems/deprecate.rb171
-rw-r--r--lib/rubygems/doctor.rb132
-rw-r--r--lib/rubygems/errors.rb177
-rw-r--r--lib/rubygems/exceptions.rb283
-rw-r--r--lib/rubygems/ext.rb20
-rw-r--r--lib/rubygems/ext/build_error.rb9
-rw-r--r--lib/rubygems/ext/builder.rb275
-rw-r--r--lib/rubygems/ext/cargo_builder.rb350
-rw-r--r--lib/rubygems/ext/cargo_builder/link_flag_converter.rb27
-rw-r--r--lib/rubygems/ext/cmake_builder.rb110
-rw-r--r--lib/rubygems/ext/configure_builder.rb26
-rw-r--r--lib/rubygems/ext/ext_conf_builder.rb81
-rw-r--r--lib/rubygems/ext/rake_builder.rb37
-rw-r--r--lib/rubygems/gem_runner.rb88
-rw-r--r--lib/rubygems/gemcutter_utilities.rb397
-rw-r--r--lib/rubygems/gemcutter_utilities/webauthn_listener.rb112
-rw-r--r--lib/rubygems/gemcutter_utilities/webauthn_listener/response.rb163
-rw-r--r--lib/rubygems/gemcutter_utilities/webauthn_poller.rb80
-rw-r--r--lib/rubygems/gemspec_helpers.rb19
-rw-r--r--lib/rubygems/install_message.rb13
-rw-r--r--lib/rubygems/install_update_options.rb212
-rw-r--r--lib/rubygems/installer.rb998
-rw-r--r--lib/rubygems/installer_uninstaller_utils.rb27
-rw-r--r--lib/rubygems/local_remote_options.rb146
-rw-r--r--lib/rubygems/name_tuple.rb125
-rw-r--r--lib/rubygems/openssl.rb7
-rw-r--r--lib/rubygems/package.rb751
-rw-r--r--lib/rubygems/package/digest_io.rb63
-rw-r--r--lib/rubygems/package/file_source.rb32
-rw-r--r--lib/rubygems/package/io_source.rb48
-rw-r--r--lib/rubygems/package/old.rb169
-rw-r--r--lib/rubygems/package/source.rb4
-rw-r--r--lib/rubygems/package/tar_header.rb277
-rw-r--r--lib/rubygems/package/tar_reader.rb103
-rw-r--r--lib/rubygems/package/tar_reader/entry.rb244
-rw-r--r--lib/rubygems/package/tar_writer.rb332
-rw-r--r--lib/rubygems/package_task.rb123
-rw-r--r--lib/rubygems/path_support.rb85
-rw-r--r--lib/rubygems/platform.rb392
-rw-r--r--lib/rubygems/psych_tree.rb37
-rw-r--r--lib/rubygems/query_utils.rb349
-rw-r--r--lib/rubygems/rdoc.rb26
-rw-r--r--lib/rubygems/remote_fetcher.rb345
-rw-r--r--lib/rubygems/request.rb298
-rw-r--r--lib/rubygems/request/connection_pools.rb96
-rw-r--r--lib/rubygems/request/http_pool.rb54
-rw-r--r--lib/rubygems/request/https_pool.rb10
-rw-r--r--lib/rubygems/request_set.rb465
-rw-r--r--lib/rubygems/request_set/gem_dependency_api.rb841
-rw-r--r--lib/rubygems/request_set/lockfile.rb235
-rw-r--r--lib/rubygems/request_set/lockfile/parser.rb344
-rw-r--r--lib/rubygems/request_set/lockfile/tokenizer.rb122
-rw-r--r--lib/rubygems/requirement.rb298
-rw-r--r--lib/rubygems/resolver.rb340
-rw-r--r--lib/rubygems/resolver/activation_request.rb159
-rw-r--r--lib/rubygems/resolver/api_set.rb139
-rw-r--r--lib/rubygems/resolver/api_set/gem_parser.rb21
-rw-r--r--lib/rubygems/resolver/api_specification.rb105
-rw-r--r--lib/rubygems/resolver/best_set.rb49
-rw-r--r--lib/rubygems/resolver/composed_set.rb65
-rw-r--r--lib/rubygems/resolver/conflict.rb146
-rw-r--r--lib/rubygems/resolver/current_set.rb12
-rw-r--r--lib/rubygems/resolver/dependency_request.rb119
-rw-r--r--lib/rubygems/resolver/git_set.rb120
-rw-r--r--lib/rubygems/resolver/git_specification.rb57
-rw-r--r--lib/rubygems/resolver/index_set.rb79
-rw-r--r--lib/rubygems/resolver/index_specification.rb101
-rw-r--r--lib/rubygems/resolver/installed_specification.rb57
-rw-r--r--lib/rubygems/resolver/installer_set.rb271
-rw-r--r--lib/rubygems/resolver/local_specification.rb40
-rw-r--r--lib/rubygems/resolver/lock_set.rb81
-rw-r--r--lib/rubygems/resolver/lock_specification.rb86
-rw-r--r--lib/rubygems/resolver/requirement_list.rb82
-rw-r--r--lib/rubygems/resolver/set.rb55
-rw-r--r--lib/rubygems/resolver/source_set.rb47
-rw-r--r--lib/rubygems/resolver/spec_specification.rb76
-rw-r--r--lib/rubygems/resolver/specification.rb126
-rw-r--r--lib/rubygems/resolver/stats.rb46
-rw-r--r--lib/rubygems/resolver/vendor_set.rb86
-rw-r--r--lib/rubygems/resolver/vendor_specification.rb23
-rw-r--r--lib/rubygems/s3_uri_signer.rb226
-rw-r--r--lib/rubygems/safe_marshal.rb74
-rw-r--r--lib/rubygems/safe_marshal/elements.rb146
-rw-r--r--lib/rubygems/safe_marshal/reader.rb325
-rw-r--r--lib/rubygems/safe_marshal/visitors/stream_printer.rb31
-rw-r--r--lib/rubygems/safe_marshal/visitors/to_ruby.rb428
-rw-r--r--lib/rubygems/safe_marshal/visitors/visitor.rb74
-rw-r--r--lib/rubygems/safe_yaml.rb45
-rw-r--r--lib/rubygems/security.rb615
-rw-r--r--lib/rubygems/security/policies.rb114
-rw-r--r--lib/rubygems/security/policy.rb288
-rw-r--r--lib/rubygems/security/signer.rb212
-rw-r--r--lib/rubygems/security/trust_dir.rb117
-rw-r--r--lib/rubygems/security_option.rb43
-rw-r--r--lib/rubygems/source.rb253
-rw-r--r--lib/rubygems/source/git.rb244
-rw-r--r--lib/rubygems/source/installed.rb39
-rw-r--r--lib/rubygems/source/local.rb131
-rw-r--r--lib/rubygems/source/lock.rb49
-rw-r--r--lib/rubygems/source/specific_file.rb73
-rw-r--r--lib/rubygems/source/vendor.rb24
-rw-r--r--lib/rubygems/source_list.rb182
-rw-r--r--lib/rubygems/spec_fetcher.rb290
-rw-r--r--lib/rubygems/specification.rb2574
-rw-r--r--lib/rubygems/specification_policy.rb522
-rw-r--r--lib/rubygems/specification_record.rb212
-rw-r--r--lib/rubygems/ssl_certs/.document1
-rw-r--r--lib/rubygems/ssl_certs/rubygems.org/GlobalSign.pem21
-rw-r--r--lib/rubygems/stub_specification.rb235
-rw-r--r--lib/rubygems/target_rbconfig.rb50
-rw-r--r--lib/rubygems/text.rb85
-rw-r--r--lib/rubygems/uninstaller.rb440
-rw-r--r--lib/rubygems/unknown_command_spell_checker.rb21
-rw-r--r--lib/rubygems/update_suggestion.rb56
-rw-r--r--lib/rubygems/uri.rb126
-rw-r--r--lib/rubygems/uri_formatter.rb48
-rw-r--r--lib/rubygems/user_interaction.rb647
-rw-r--r--lib/rubygems/util.rb96
-rw-r--r--lib/rubygems/util/atomic_file_writer.rb76
-rw-r--r--lib/rubygems/util/licenses.rb855
-rw-r--r--lib/rubygems/validator.rb144
-rw-r--r--lib/rubygems/vendor/.document1
-rw-r--r--lib/rubygems/vendor/molinillo/lib/molinillo.rb11
-rw-r--r--lib/rubygems/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb57
-rw-r--r--lib/rubygems/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb88
-rw-r--r--lib/rubygems/vendor/molinillo/lib/molinillo/dependency_graph.rb255
-rw-r--r--lib/rubygems/vendor/molinillo/lib/molinillo/dependency_graph/action.rb36
-rw-r--r--lib/rubygems/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb66
-rw-r--r--lib/rubygems/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb62
-rw-r--r--lib/rubygems/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb63
-rw-r--r--lib/rubygems/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb61
-rw-r--r--lib/rubygems/vendor/molinillo/lib/molinillo/dependency_graph/log.rb126
-rw-r--r--lib/rubygems/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb46
-rw-r--r--lib/rubygems/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb36
-rw-r--r--lib/rubygems/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb164
-rw-r--r--lib/rubygems/vendor/molinillo/lib/molinillo/errors.rb149
-rw-r--r--lib/rubygems/vendor/molinillo/lib/molinillo/gem_metadata.rb6
-rw-r--r--lib/rubygems/vendor/molinillo/lib/molinillo/modules/specification_provider.rb112
-rw-r--r--lib/rubygems/vendor/molinillo/lib/molinillo/modules/ui.rb67
-rw-r--r--lib/rubygems/vendor/molinillo/lib/molinillo/resolution.rb839
-rw-r--r--lib/rubygems/vendor/molinillo/lib/molinillo/resolver.rb46
-rw-r--r--lib/rubygems/vendor/molinillo/lib/molinillo/state.rb58
-rw-r--r--lib/rubygems/vendor/net-http/lib/net/http.rb2608
-rw-r--r--lib/rubygems/vendor/net-http/lib/net/http/exceptions.rb35
-rw-r--r--lib/rubygems/vendor/net-http/lib/net/http/generic_request.rb429
-rw-r--r--lib/rubygems/vendor/net-http/lib/net/http/header.rb985
-rw-r--r--lib/rubygems/vendor/net-http/lib/net/http/proxy_delta.rb17
-rw-r--r--lib/rubygems/vendor/net-http/lib/net/http/request.rb88
-rw-r--r--lib/rubygems/vendor/net-http/lib/net/http/requests.rb444
-rw-r--r--lib/rubygems/vendor/net-http/lib/net/http/response.rb739
-rw-r--r--lib/rubygems/vendor/net-http/lib/net/http/responses.rb1242
-rw-r--r--lib/rubygems/vendor/net-http/lib/net/http/status.rb84
-rw-r--r--lib/rubygems/vendor/net-http/lib/net/https.rb23
-rw-r--r--lib/rubygems/vendor/net-protocol/lib/net/protocol.rb544
-rw-r--r--lib/rubygems/vendor/optparse/lib/optionparser.rb2
-rw-r--r--lib/rubygems/vendor/optparse/lib/optparse.rb2467
-rw-r--r--lib/rubygems/vendor/optparse/lib/optparse/ac.rb70
-rw-r--r--lib/rubygems/vendor/optparse/lib/optparse/date.rb18
-rw-r--r--lib/rubygems/vendor/optparse/lib/optparse/kwargs.rb27
-rw-r--r--lib/rubygems/vendor/optparse/lib/optparse/shellwords.rb7
-rw-r--r--lib/rubygems/vendor/optparse/lib/optparse/time.rb11
-rw-r--r--lib/rubygems/vendor/optparse/lib/optparse/uri.rb7
-rw-r--r--lib/rubygems/vendor/optparse/lib/optparse/version.rb80
-rw-r--r--lib/rubygems/vendor/resolv/lib/resolv.rb3483
-rw-r--r--lib/rubygems/vendor/securerandom/lib/securerandom.rb102
-rw-r--r--lib/rubygems/vendor/timeout/lib/timeout.rb201
-rw-r--r--lib/rubygems/vendor/tsort/lib/tsort.rb455
-rw-r--r--lib/rubygems/vendor/uri/lib/uri.rb104
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/common.rb922
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/file.rb100
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/ftp.rb267
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/generic.rb1592
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/http.rb137
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/https.rb23
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/ldap.rb261
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/ldaps.rb22
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/mailto.rb293
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/rfc2396_parser.rb547
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/rfc3986_parser.rb206
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/version.rb6
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/ws.rb83
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/wss.rb23
-rw-r--r--lib/rubygems/vendored_molinillo.rb3
-rw-r--r--lib/rubygems/vendored_net_http.rb5
-rw-r--r--lib/rubygems/vendored_optparse.rb3
-rw-r--r--lib/rubygems/vendored_securerandom.rb3
-rw-r--r--lib/rubygems/vendored_timeout.rb5
-rw-r--r--lib/rubygems/vendored_tsort.rb3
-rw-r--r--lib/rubygems/version.rb429
-rw-r--r--lib/rubygems/version_option.rb80
-rw-r--r--lib/rubygems/win_platform.rb31
-rw-r--r--lib/rubygems/yaml_serializer.rb98
-rw-r--r--lib/rubyunit.rb6
-rw-r--r--lib/runit/assert.rb73
-rw-r--r--lib/runit/cui/testrunner.rb51
-rw-r--r--lib/runit/error.rb9
-rw-r--r--lib/runit/testcase.rb45
-rw-r--r--lib/runit/testresult.rb44
-rw-r--r--lib/runit/testsuite.rb26
-rw-r--r--lib/runit/topublic.rb8
-rw-r--r--lib/scanf.rb702
-rw-r--r--lib/securerandom.gemspec35
-rw-r--r--lib/securerandom.rb102
-rw-r--r--lib/set.rb1205
-rw-r--r--lib/set/subclass_compatible.rb347
-rw-r--r--lib/shell.rb269
-rw-r--r--lib/shell/builtin-command.rb154
-rw-r--r--lib/shell/command-processor.rb592
-rw-r--r--lib/shell/error.rb26
-rw-r--r--lib/shell/filter.rb110
-rw-r--r--lib/shell/process-controller.rb258
-rw-r--r--lib/shell/system-command.rb168
-rw-r--r--lib/shell/version.rb16
-rw-r--r--lib/shellwords.gemspec29
-rw-r--r--lib/shellwords.rb272
-rw-r--r--lib/singleton.gemspec30
-rw-r--r--lib/singleton.rb470
-rw-r--r--lib/soap/attachment.rb107
-rw-r--r--lib/soap/baseData.rb815
-rw-r--r--lib/soap/element.rb251
-rw-r--r--lib/soap/encodingstyle/aspDotNetHandler.rb220
-rw-r--r--lib/soap/encodingstyle/handler.rb100
-rw-r--r--lib/soap/encodingstyle/literalHandler.rb227
-rw-r--r--lib/soap/encodingstyle/soapHandler.rb589
-rw-r--r--lib/soap/generator.rb210
-rw-r--r--lib/soap/mapping.rb10
-rw-r--r--lib/soap/mapping/factory.rb388
-rw-r--r--lib/soap/mapping/mapping.rb218
-rw-r--r--lib/soap/mapping/registry.rb479
-rw-r--r--lib/soap/mapping/rubytypeFactory.rb452
-rw-r--r--lib/soap/mapping/typeMap.rb41
-rw-r--r--lib/soap/mapping/wsdlRegistry.rb155
-rw-r--r--lib/soap/marshal.rb58
-rw-r--r--lib/soap/mimemessage.rb238
-rw-r--r--lib/soap/netHttpClient.rb174
-rw-r--r--lib/soap/parser.rb252
-rw-r--r--lib/soap/processor.rb66
-rw-r--r--lib/soap/property.rb328
-rw-r--r--lib/soap/rpc/cgistub.rb206
-rw-r--r--lib/soap/rpc/driver.rb300
-rw-r--r--lib/soap/rpc/element.rb270
-rw-r--r--lib/soap/rpc/proxy.rb171
-rw-r--r--lib/soap/rpc/router.rb235
-rw-r--r--lib/soap/rpc/rpc.rb25
-rw-r--r--lib/soap/rpc/soaplet.rb200
-rw-r--r--lib/soap/rpc/standaloneServer.rb43
-rw-r--r--lib/soap/soap.rb115
-rw-r--r--lib/soap/streamHandler.rb267
-rw-r--r--lib/soap/wsdlDriver.rb598
-rw-r--r--lib/sync.rb311
-rw-r--r--lib/syntax_suggest.rb3
-rw-r--r--lib/syntax_suggest/api.rb233
-rw-r--r--lib/syntax_suggest/around_block_scan.rb232
-rw-r--r--lib/syntax_suggest/block_expand.rb165
-rw-r--r--lib/syntax_suggest/capture/before_after_keyword_ends.rb85
-rw-r--r--lib/syntax_suggest/capture/falling_indent_lines.rb71
-rw-r--r--lib/syntax_suggest/capture_code_context.rb245
-rw-r--r--lib/syntax_suggest/clean_document.rb306
-rw-r--r--lib/syntax_suggest/cli.rb130
-rw-r--r--lib/syntax_suggest/code_block.rb100
-rw-r--r--lib/syntax_suggest/code_frontier.rb178
-rw-r--r--lib/syntax_suggest/code_line.rb247
-rw-r--r--lib/syntax_suggest/code_search.rb139
-rw-r--r--lib/syntax_suggest/core_ext.rb96
-rw-r--r--lib/syntax_suggest/display_code_with_line_numbers.rb70
-rw-r--r--lib/syntax_suggest/display_invalid_blocks.rb83
-rw-r--r--lib/syntax_suggest/explain_syntax.rb117
-rw-r--r--lib/syntax_suggest/left_right_lex_count.rb168
-rw-r--r--lib/syntax_suggest/lex_all.rb74
-rw-r--r--lib/syntax_suggest/lex_value.rb70
-rw-r--r--lib/syntax_suggest/mini_stringio.rb30
-rw-r--r--lib/syntax_suggest/parse_blocks_from_indent_line.rb60
-rw-r--r--lib/syntax_suggest/pathname_from_message.rb59
-rw-r--r--lib/syntax_suggest/priority_engulf_queue.rb63
-rw-r--r--lib/syntax_suggest/priority_queue.rb105
-rw-r--r--lib/syntax_suggest/ripper_errors.rb39
-rw-r--r--lib/syntax_suggest/scan_history.rb134
-rw-r--r--lib/syntax_suggest/syntax_suggest.gemspec32
-rw-r--r--lib/syntax_suggest/unvisited_lines.rb36
-rw-r--r--lib/syntax_suggest/version.rb5
-rw-r--r--lib/tempfile.gemspec33
-rw-r--r--lib/tempfile.rb692
-rw-r--r--lib/test/unit.rb283
-rw-r--r--lib/test/unit/assertionfailederror.rb12
-rw-r--r--lib/test/unit/assertions.rb472
-rw-r--r--lib/test/unit/autorunner.rb189
-rw-r--r--lib/test/unit/collector.rb43
-rw-r--r--lib/test/unit/collector/dir.rb86
-rw-r--r--lib/test/unit/collector/objectspace.rb34
-rw-r--r--lib/test/unit/error.rb54
-rw-r--r--lib/test/unit/failure.rb49
-rw-r--r--lib/test/unit/testcase.rb150
-rw-r--r--lib/test/unit/testresult.rb79
-rw-r--r--lib/test/unit/testsuite.rb74
-rw-r--r--lib/test/unit/ui/console/testrunner.rb125
-rw-r--r--lib/test/unit/ui/fox/testrunner.rb266
-rw-r--r--lib/test/unit/ui/gtk/testrunner.rb414
-rw-r--r--lib/test/unit/ui/gtk2/testrunner.rb463
-rw-r--r--lib/test/unit/ui/testrunnermediator.rb66
-rw-r--r--lib/test/unit/ui/testrunnerutilities.rb44
-rw-r--r--lib/test/unit/ui/tk/testrunner.rb258
-rw-r--r--lib/test/unit/util/backtracefilter.rb40
-rw-r--r--lib/test/unit/util/observable.rb88
-rw-r--r--lib/test/unit/util/procwrapper.rb46
-rw-r--r--lib/thread.rb420
-rw-r--r--lib/thwait.rb166
-rw-r--r--lib/time.gemspec36
-rw-r--r--lib/time.rb995
-rw-r--r--lib/timeout.gemspec33
-rw-r--r--lib/timeout.rb357
-rw-r--r--lib/tmpdir.gemspec30
-rw-r--r--lib/tmpdir.rb199
-rw-r--r--lib/tracer.rb170
-rw-r--r--lib/tsort.rb289
-rw-r--r--lib/un.gemspec31
-rw-r--r--lib/un.rb356
-rw-r--r--lib/unicode_normalize/normalize.rb187
-rw-r--r--lib/unicode_normalize/tables.rb9439
-rw-r--r--lib/uri.rb109
-rw-r--r--lib/uri/common.rb1255
-rw-r--r--lib/uri/file.rb100
-rw-r--r--lib/uri/ftp.rb191
-rw-r--r--lib/uri/generic.rb1291
-rw-r--r--lib/uri/http.rb124
-rw-r--r--lib/uri/https.rb15
-rw-r--r--lib/uri/ldap.rb95
-rw-r--r--lib/uri/ldaps.rb22
-rw-r--r--lib/uri/mailto.rb228
-rw-r--r--lib/uri/rfc2396_parser.rb547
-rw-r--r--lib/uri/rfc3986_parser.rb206
-rw-r--r--lib/uri/uri.gemspec42
-rw-r--r--lib/uri/version.rb6
-rw-r--r--lib/uri/ws.rb83
-rw-r--r--lib/uri/wss.rb23
-rw-r--r--lib/weakref.gemspec32
-rw-r--r--lib/weakref.rb108
-rw-r--r--lib/webrick.rb29
-rw-r--r--lib/webrick/accesslog.rb64
-rw-r--r--lib/webrick/cgi.rb248
-rw-r--r--lib/webrick/compat.rb15
-rw-r--r--lib/webrick/config.rb95
-rw-r--r--lib/webrick/cookie.rb80
-rw-r--r--lib/webrick/htmlutils.rb25
-rw-r--r--lib/webrick/httpauth.rb46
-rw-r--r--lib/webrick/httpauth/authenticator.rb79
-rw-r--r--lib/webrick/httpauth/basicauth.rb66
-rw-r--r--lib/webrick/httpauth/digestauth.rb348
-rw-r--r--lib/webrick/httpauth/htdigest.rb91
-rw-r--r--lib/webrick/httpauth/htgroup.rb61
-rw-r--r--lib/webrick/httpauth/htpasswd.rb75
-rw-r--r--lib/webrick/httpauth/userdb.rb29
-rw-r--r--lib/webrick/httpproxy.rb237
-rw-r--r--lib/webrick/httprequest.rb341
-rw-r--r--lib/webrick/httpresponse.rb306
-rw-r--r--lib/webrick/https.rb63
-rw-r--r--lib/webrick/httpserver.rb178
-rw-r--r--lib/webrick/httpservlet.rb22
-rw-r--r--lib/webrick/httpservlet/abstract.rb71
-rw-r--r--lib/webrick/httpservlet/cgi_runner.rb45
-rw-r--r--lib/webrick/httpservlet/cgihandler.rb95
-rw-r--r--lib/webrick/httpservlet/erbhandler.rb53
-rw-r--r--lib/webrick/httpservlet/filehandler.rb330
-rw-r--r--lib/webrick/httpservlet/prochandler.rb33
-rw-r--r--lib/webrick/httpstatus.rb126
-rw-r--r--lib/webrick/httputils.rb374
-rw-r--r--lib/webrick/httpversion.rb49
-rw-r--r--lib/webrick/log.rb88
-rw-r--r--lib/webrick/server.rb177
-rw-r--r--lib/webrick/ssl.rb126
-rw-r--r--lib/webrick/utils.rb88
-rw-r--r--lib/webrick/version.rb13
-rw-r--r--lib/wsdl/binding.rb65
-rw-r--r--lib/wsdl/data.rb64
-rw-r--r--lib/wsdl/definitions.rb240
-rw-r--r--lib/wsdl/documentation.rb32
-rw-r--r--lib/wsdl/import.rb70
-rw-r--r--lib/wsdl/importer.rb73
-rw-r--r--lib/wsdl/info.rb33
-rw-r--r--lib/wsdl/message.rb54
-rw-r--r--lib/wsdl/operation.rb129
-rw-r--r--lib/wsdl/operationBinding.rb80
-rw-r--r--lib/wsdl/param.rb74
-rw-r--r--lib/wsdl/parser.rb160
-rw-r--r--lib/wsdl/part.rb52
-rw-r--r--lib/wsdl/port.rb84
-rw-r--r--lib/wsdl/portType.rb72
-rw-r--r--lib/wsdl/service.rb61
-rw-r--r--lib/wsdl/soap/address.rb40
-rw-r--r--lib/wsdl/soap/binding.rb48
-rw-r--r--lib/wsdl/soap/body.rb52
-rw-r--r--lib/wsdl/soap/complexType.rb107
-rw-r--r--lib/wsdl/soap/data.rb41
-rw-r--r--lib/wsdl/soap/definitions.rb152
-rw-r--r--lib/wsdl/soap/fault.rb52
-rw-r--r--lib/wsdl/soap/header.rb79
-rw-r--r--lib/wsdl/soap/headerfault.rb56
-rw-r--r--lib/wsdl/soap/operation.rb123
-rw-r--r--lib/wsdl/types.rb43
-rw-r--r--lib/wsdl/wsdl.rb23
-rw-r--r--lib/wsdl/xmlSchema/all.rb65
-rw-r--r--lib/wsdl/xmlSchema/any.rb56
-rw-r--r--lib/wsdl/xmlSchema/attribute.rb74
-rw-r--r--lib/wsdl/xmlSchema/choice.rb65
-rw-r--r--lib/wsdl/xmlSchema/complexContent.rb83
-rw-r--r--lib/wsdl/xmlSchema/complexType.rb133
-rw-r--r--lib/wsdl/xmlSchema/content.rb96
-rw-r--r--lib/wsdl/xmlSchema/data.rb68
-rw-r--r--lib/wsdl/xmlSchema/element.rb104
-rw-r--r--lib/wsdl/xmlSchema/import.rb44
-rw-r--r--lib/wsdl/xmlSchema/parser.rb162
-rw-r--r--lib/wsdl/xmlSchema/schema.rb106
-rw-r--r--lib/wsdl/xmlSchema/sequence.rb65
-rw-r--r--lib/wsdl/xmlSchema/unique.rb34
-rw-r--r--lib/xmlrpc/README.txt31
-rw-r--r--lib/xmlrpc/base64.rb81
-rw-r--r--lib/xmlrpc/client.rb605
-rw-r--r--lib/xmlrpc/config.rb40
-rw-r--r--lib/xmlrpc/create.rb280
-rw-r--r--lib/xmlrpc/datetime.rb138
-rw-r--r--lib/xmlrpc/httpserver.rb178
-rw-r--r--lib/xmlrpc/marshal.rb76
-rw-r--r--lib/xmlrpc/parser.rb808
-rw-r--r--lib/xmlrpc/server.rb833
-rw-r--r--lib/xmlrpc/utils.rb172
-rw-r--r--lib/xsd/charset.rb167
-rw-r--r--lib/xsd/datatypes.rb1116
-rw-r--r--lib/xsd/datatypes1999.rb20
-rw-r--r--lib/xsd/iconvcharset.rb33
-rw-r--r--lib/xsd/namedelements.rb79
-rw-r--r--lib/xsd/ns.rb130
-rw-r--r--lib/xsd/qname.rb71
-rw-r--r--lib/xsd/xmlparser.rb61
-rw-r--r--lib/xsd/xmlparser/parser.rb96
-rw-r--r--lib/xsd/xmlparser/rexmlparser.rb54
-rw-r--r--lib/xsd/xmlparser/xmlparser.rb50
-rw-r--r--lib/xsd/xmlparser/xmlscanner.rb147
-rw-r--r--lib/yaml.rb416
-rw-r--r--lib/yaml/baseemitter.rb249
-rw-r--r--lib/yaml/basenode.rb216
-rw-r--r--lib/yaml/constants.rb45
-rw-r--r--lib/yaml/dbm.rb220
-rw-r--r--lib/yaml/emitter.rb107
-rw-r--r--lib/yaml/encoding.rb29
-rw-r--r--lib/yaml/error.rb33
-rw-r--r--lib/yaml/loader.rb14
-rw-r--r--lib/yaml/rubytypes.rb624
-rw-r--r--lib/yaml/store.rb89
-rw-r--r--lib/yaml/stream.rb44
-rw-r--r--lib/yaml/stringio.rb83
-rw-r--r--lib/yaml/syck.rb27
-rw-r--r--lib/yaml/types.rb196
-rw-r--r--lib/yaml/yaml.gemspec30
-rw-r--r--lib/yaml/yamlnode.rb54
-rw-r--r--lib/yaml/ypath.rb52
-rwxr-xr-xlibexec/bundle29
-rwxr-xr-xlibexec/bundler4
-rwxr-xr-xlibexec/erb184
-rwxr-xr-xlibexec/syntax_suggest7
-rw-r--r--load.c1695
-rw-r--r--loadpath.c91
-rw-r--r--localeinit.c138
-rw-r--r--main.c65
-rw-r--r--man/erb.1160
-rw-r--r--man/goruby.139
-rw-r--r--man/ruby.1827
-rw-r--r--marshal.c3055
-rw-r--r--marshal.rb40
-rw-r--r--math.c1180
-rwxr-xr-xmdoc2man.rb465
-rw-r--r--memory_view.c870
-rw-r--r--method.h276
-rw-r--r--mini_builtin.c104
-rw-r--r--miniinit.c109
-rw-r--r--misc/.vscode/launch.json13
-rw-r--r--misc/.vscode/settings.json10
-rw-r--r--misc/.vscode/tasks.json14
-rw-r--r--misc/README12
-rw-r--r--misc/call_fuzzer.rb372
-rwxr-xr-xmisc/call_fuzzer.sh13
-rwxr-xr-xmisc/expand_tabs.rb178
-rw-r--r--misc/gdb.py181
-rw-r--r--misc/inf-ruby.el405
-rw-r--r--misc/lldb_cruby.py747
-rw-r--r--misc/lldb_disasm.py250
-rw-r--r--misc/lldb_rb/commands/command_template.py30
-rw-r--r--misc/lldb_rb/commands/heap_page_command.py27
-rw-r--r--misc/lldb_rb/commands/print_flags_command.py31
-rw-r--r--misc/lldb_rb/commands/rb_id2str_command.py49
-rw-r--r--misc/lldb_rb/commands/rclass_ext_command.py14
-rw-r--r--misc/lldb_rb/commands/rp_command.py15
-rw-r--r--misc/lldb_rb/constants.py6
-rw-r--r--misc/lldb_rb/lldb_interface.py18
-rw-r--r--misc/lldb_rb/rb_base_command.py57
-rw-r--r--misc/lldb_rb/rb_heap_structs.py152
-rw-r--r--misc/lldb_rb/utils.py515
-rw-r--r--misc/rb_optparse.bash21
-rw-r--r--misc/rb_optparse.zsh39
-rw-r--r--misc/ruby-mode.el1206
-rw-r--r--misc/ruby-style.el107
-rw-r--r--misc/rubydb2x.el104
-rw-r--r--misc/rubydb3x.el115
-rw-r--r--misc/test_lldb_cruby.rb40
-rw-r--r--misc/tsan_suppressions.txt109
-rwxr-xr-xmisc/yjit_perf.py116
-rw-r--r--missing.h139
-rw-r--r--missing/acosh.c19
-rw-r--r--missing/alloca.c13
-rw-r--r--missing/cbrt.c11
-rw-r--r--missing/close.c72
-rw-r--r--missing/crt_externs.h8
-rw-r--r--missing/crypt.c1159
-rw-r--r--missing/crypt.h247
-rw-r--r--missing/des_tables.c1616
-rw-r--r--missing/dtoa.c3509
-rw-r--r--missing/dup2.c61
-rw-r--r--missing/erf.c31
-rw-r--r--missing/explicit_bzero.c91
-rw-r--r--missing/ffs.c49
-rw-r--r--missing/file.h5
-rw-r--r--missing/fileblocks.c1
-rw-r--r--missing/finite.c8
-rw-r--r--missing/flock.c37
-rw-r--r--missing/hypot.c4
-rw-r--r--missing/isinf.c64
-rw-r--r--missing/isnan.c17
-rw-r--r--missing/langinfo.c148
-rw-r--r--missing/lgamma_r.c80
-rw-r--r--missing/memcmp.c13
-rw-r--r--missing/memmove.c18
-rw-r--r--missing/mkdir.c104
-rw-r--r--missing/mt19937.c158
-rw-r--r--missing/nan.c28
-rw-r--r--missing/nextafter.c77
-rw-r--r--missing/os2.c113
-rw-r--r--missing/procstat_vm.c85
-rw-r--r--missing/setproctitle.c231
-rw-r--r--missing/strcasecmp.c16
-rw-r--r--missing/strchr.c22
-rw-r--r--missing/strerror.c7
-rw-r--r--missing/strftime.c907
-rw-r--r--missing/strlcat.c56
-rw-r--r--missing/strlcpy.c51
-rw-r--r--missing/strncasecmp.c21
-rw-r--r--missing/strstr.c15
-rw-r--r--missing/strtod.c271
-rw-r--r--missing/strtol.c29
-rw-r--r--missing/strtoul.c184
-rw-r--r--missing/tgamma.c82
-rw-r--r--missing/vsnprintf.c1134
-rw-r--r--missing/x68.c40
-rw-r--r--missing/x86_64-chkstk.S10
-rw-r--r--mkconfig.rb142
-rw-r--r--nilclass.rb63
-rw-r--r--node.c446
-rw-r--r--node.h460
-rw-r--r--node_dump.c1325
-rw-r--r--numeric.c7241
-rw-r--r--numeric.rb421
-rw-r--r--object.c5328
-rw-r--r--pack.c3446
-rw-r--r--pack.rb40
-rw-r--r--parse.y20174
-rw-r--r--parser_bits.h647
-rw-r--r--parser_node.h32
-rw-r--r--parser_st.c165
-rw-r--r--parser_st.h162
-rw-r--r--parser_value.h106
-rw-r--r--pathname.c117
-rw-r--r--pathname_builtin.rb1172
-rw-r--r--prec.c141
-rw-r--r--prelude.rb41
-rw-r--r--prism/api_pack.c276
-rw-r--r--prism/config.yml4739
-rw-r--r--prism/defines.h260
-rw-r--r--prism/encoding.c5340
-rw-r--r--prism/encoding.h283
-rw-r--r--prism/extension.c1427
-rw-r--r--prism/extension.h19
-rw-r--r--prism/node.h129
-rw-r--r--prism/options.c338
-rw-r--r--prism/options.h488
-rw-r--r--prism/pack.c509
-rw-r--r--prism/pack.h163
-rw-r--r--prism/parser.h936
-rw-r--r--prism/prettyprint.h34
-rw-r--r--prism/prism.c22679
-rw-r--r--prism/prism.h408
-rw-r--r--prism/regexp.c790
-rw-r--r--prism/regexp.h43
-rw-r--r--prism/srcs.mk150
-rw-r--r--prism/srcs.mk.in48
-rw-r--r--prism/static_literals.c617
-rw-r--r--prism/static_literals.h121
-rw-r--r--prism/templates/ext/prism/api_node.c.erb282
-rw-r--r--prism/templates/include/prism/ast.h.erb238
-rw-r--r--prism/templates/include/prism/diagnostic.h.erb130
-rw-r--r--prism/templates/lib/prism/compiler.rb.erb43
-rw-r--r--prism/templates/lib/prism/dispatcher.rb.erb103
-rw-r--r--prism/templates/lib/prism/dot_visitor.rb.erb189
-rw-r--r--prism/templates/lib/prism/dsl.rb.erb133
-rw-r--r--prism/templates/lib/prism/inspect_visitor.rb.erb131
-rw-r--r--prism/templates/lib/prism/mutation_compiler.rb.erb19
-rw-r--r--prism/templates/lib/prism/node.rb.erb527
-rw-r--r--prism/templates/lib/prism/reflection.rb.erb136
-rw-r--r--prism/templates/lib/prism/serialize.rb.erb602
-rw-r--r--prism/templates/lib/prism/visitor.rb.erb55
-rw-r--r--prism/templates/src/diagnostic.c.erb526
-rw-r--r--prism/templates/src/node.c.erb333
-rw-r--r--prism/templates/src/prettyprint.c.erb166
-rw-r--r--prism/templates/src/serialize.c.erb406
-rw-r--r--prism/templates/src/token_type.c.erb369
-rwxr-xr-xprism/templates/template.rb689
-rw-r--r--prism/util/pm_buffer.c357
-rw-r--r--prism/util/pm_buffer.h236
-rw-r--r--prism/util/pm_char.c318
-rw-r--r--prism/util/pm_char.h204
-rw-r--r--prism/util/pm_constant_pool.c342
-rw-r--r--prism/util/pm_constant_pool.h218
-rw-r--r--prism/util/pm_integer.c670
-rw-r--r--prism/util/pm_integer.h130
-rw-r--r--prism/util/pm_list.c49
-rw-r--r--prism/util/pm_list.h103
-rw-r--r--prism/util/pm_memchr.c35
-rw-r--r--prism/util/pm_memchr.h29
-rw-r--r--prism/util/pm_newline_list.c125
-rw-r--r--prism/util/pm_newline_list.h113
-rw-r--r--prism/util/pm_string.c381
-rw-r--r--prism/util/pm_string.h200
-rw-r--r--prism/util/pm_strncasecmp.c36
-rw-r--r--prism/util/pm_strncasecmp.h32
-rw-r--r--prism/util/pm_strpbrk.c206
-rw-r--r--prism/util/pm_strpbrk.h46
-rw-r--r--prism/version.h29
-rw-r--r--prism_compile.c11558
-rw-r--r--prism_compile.h106
-rw-r--r--prism_init.c9
-rw-r--r--probes.d223
-rw-r--r--probes_helper.h42
-rw-r--r--proc.c4728
-rw-r--r--process.c10248
-rw-r--r--ractor.c2621
-rw-r--r--ractor.rb834
-rw-r--r--ractor_core.h331
-rw-r--r--ractor_sync.c1516
-rw-r--r--random.c2056
-rw-r--r--range.c3080
-rw-r--r--rational.c2830
-rw-r--r--re.c5579
-rw-r--r--re.h42
-rw-r--r--regcomp.c6744
-rw-r--r--regenc.c1032
-rw-r--r--regenc.h261
-rw-r--r--regerror.c402
-rw-r--r--regex.c4643
-rw-r--r--regex.h221
-rw-r--r--regexec.c5376
-rw-r--r--regint.h990
-rw-r--r--regparse.c6852
-rw-r--r--regparse.h371
-rw-r--r--regsyntax.c388
-rw-r--r--ruby-runner.c104
-rw-r--r--ruby.1350
-rw-r--r--ruby.c4000
-rw-r--r--ruby.h702
-rw-r--r--ruby.rs4
-rw-r--r--ruby_assert.h14
-rw-r--r--ruby_atomic.h73
-rw-r--r--ruby_parser.c1119
-rw-r--r--rubyio.h77
-rw-r--r--rubyparser.h1393
-rw-r--r--rubysig.h101
-rw-r--r--rubystub.c61
-rw-r--r--rubytest.rb46
-rw-r--r--sample/README17
-rw-r--r--sample/all-ruby-quine.rb24
-rw-r--r--sample/benchmark.rb19
-rw-r--r--sample/biorhythm.rb143
-rw-r--r--sample/cal.rb86
-rw-r--r--sample/cbreak.rb12
-rw-r--r--sample/cgi-session-pstore.rb11
-rw-r--r--sample/coverage.rb62
-rw-r--r--sample/dbmtest.rb14
-rw-r--r--sample/delegate.rb31
-rw-r--r--sample/dir.rb11
-rw-r--r--sample/drb/README.rd56
-rw-r--r--sample/drb/README.rd.ja59
-rw-r--r--sample/drb/darray.rb12
-rw-r--r--sample/drb/darrayc.rb59
-rw-r--r--sample/drb/dbiff.rb51
-rw-r--r--sample/drb/dcdbiff.rb43
-rw-r--r--sample/drb/dchatc.rb41
-rw-r--r--sample/drb/dchats.rb70
-rw-r--r--sample/drb/dhasen.rb42
-rw-r--r--sample/drb/dhasenc.rb13
-rw-r--r--sample/drb/dlogc.rb16
-rw-r--r--sample/drb/dlogd.rb39
-rw-r--r--sample/drb/dqin.rb13
-rw-r--r--sample/drb/dqlib.rb14
-rw-r--r--sample/drb/dqout.rb14
-rw-r--r--sample/drb/dqueue.rb12
-rw-r--r--sample/drb/drbc.rb45
-rw-r--r--sample/drb/drbch.rb48
-rw-r--r--sample/drb/drbm.rb60
-rw-r--r--sample/drb/drbmc.rb22
-rw-r--r--sample/drb/drbs-acl.rb51
-rw-r--r--sample/drb/drbs.rb64
-rw-r--r--sample/drb/drbssl_c.rb19
-rw-r--r--sample/drb/drbssl_s.rb31
-rw-r--r--sample/drb/extserv_test.rb80
-rw-r--r--sample/drb/gw_ct.rb29
-rw-r--r--sample/drb/gw_cu.rb28
-rw-r--r--sample/drb/gw_s.rb10
-rw-r--r--sample/drb/holderc.rb22
-rw-r--r--sample/drb/holders.rb63
-rw-r--r--sample/drb/http0.rb77
-rw-r--r--sample/drb/http0serv.rb119
-rw-r--r--sample/drb/name.rb117
-rw-r--r--sample/drb/namec.rb36
-rw-r--r--sample/drb/old_tuplespace.rb214
-rw-r--r--sample/drb/rinda_ts.rb7
-rw-r--r--sample/drb/rindac.rb17
-rw-r--r--sample/drb/rindas.rb18
-rw-r--r--sample/drb/ring_echo.rb30
-rw-r--r--sample/drb/ring_inspect.rb30
-rw-r--r--sample/drb/ring_place.rb25
-rw-r--r--sample/drb/simpletuple.rb91
-rw-r--r--sample/drb/speedc.rb21
-rw-r--r--sample/drb/speeds.rb31
-rw-r--r--sample/dualstack-fetch.rb2
-rw-r--r--sample/dualstack-httpd.rb37
-rw-r--r--sample/eval.rb2
-rw-r--r--sample/export.rb2
-rw-r--r--sample/exyacc.rb34
-rw-r--r--sample/fact.rb4
-rw-r--r--sample/fib.awk8
-rw-r--r--sample/fib.pl4
-rw-r--r--sample/fib.py2
-rw-r--r--sample/fib.scm4
-rw-r--r--sample/freq.rb12
-rw-r--r--sample/from.rb161
-rw-r--r--sample/fullpath.rb2
-rw-r--r--sample/getopts.test36
-rw-r--r--sample/goodfriday.rb48
-rw-r--r--sample/iseq_loader.rb243
-rw-r--r--sample/list.rb6
-rw-r--r--sample/list2.rb2
-rw-r--r--sample/list3.rb4
-rw-r--r--sample/logger/app.rb2
-rwxr-xr-x[-rw-r--r--]sample/mine.rb47
-rw-r--r--sample/mkproto.rb24
-rw-r--r--sample/mpart.rb44
-rw-r--r--sample/mrshtest.rb13
-rw-r--r--sample/observ.rb11
-rw-r--r--sample/occur.pl8
-rw-r--r--sample/occur.rb6
-rw-r--r--sample/occur2.rb16
-rw-r--r--sample/open3.rb12
-rw-r--r--sample/openssl/c_rehash.rb43
-rw-r--r--sample/openssl/cert2text.rb7
-rw-r--r--sample/openssl/cert_store_view.rb911
-rw-r--r--sample/openssl/certstore.rb61
-rw-r--r--sample/openssl/cipher.rb69
-rw-r--r--sample/openssl/crlstore.rb32
-rw-r--r--sample/openssl/echo_cli.rb23
-rw-r--r--sample/openssl/echo_svr.rb23
-rw-r--r--sample/openssl/gen_csr.rb27
-rw-r--r--sample/openssl/smime_read.rb21
-rw-r--r--sample/openssl/smime_write.rb25
-rw-r--r--sample/openssl/wget.rb17
-rwxr-xr-x[-rw-r--r--]sample/optparse/opttest.rb76
-rwxr-xr-xsample/optparse/subcommand.rb19
-rw-r--r--sample/philos.rb5
-rw-r--r--sample/prism/find_calls.rb105
-rw-r--r--sample/prism/find_comments.rb100
-rw-r--r--sample/prism/locate_nodes.rb84
-rw-r--r--sample/prism/make_tags.rb302
-rw-r--r--sample/prism/multiplex_constants.rb138
-rw-r--r--sample/prism/relocate_constants.rb43
-rw-r--r--sample/prism/visit_nodes.rb63
-rw-r--r--sample/pstore.rb19
-rw-r--r--sample/pty/expect_sample.rb58
-rw-r--r--sample/pty/script.rb37
-rw-r--r--sample/pty/shl.rb93
-rw-r--r--sample/rcs.awk54
-rw-r--r--sample/rdoc/markup/rdoc2latex.rb15
-rw-r--r--sample/rdoc/markup/sample.rb40
-rw-r--r--sample/regx.rb23
-rw-r--r--sample/rinda-ring.rb22
-rw-r--r--sample/ripper/ruby2html.rb116
-rw-r--r--sample/ripper/strip-comment.rb19
-rw-r--r--sample/rss/list_description.rb84
-rw-r--r--sample/rss/rss_recent.rb83
-rw-r--r--sample/rss/tdiary_plugin/rss-recent.rb213
-rw-r--r--sample/simple-bench.rb140
-rw-r--r--sample/soap/babelfish.rb16
-rw-r--r--sample/soap/calc/calc.rb17
-rw-r--r--sample/soap/calc/calc2.rb29
-rw-r--r--sample/soap/calc/client.rb26
-rw-r--r--sample/soap/calc/client2.rb29
-rw-r--r--sample/soap/calc/httpd.rb20
-rw-r--r--sample/soap/calc/samplehttpd.conf2
-rw-r--r--sample/soap/calc/server.cgi15
-rw-r--r--sample/soap/calc/server.rb17
-rw-r--r--sample/soap/calc/server2.rb20
-rw-r--r--sample/soap/digraph.rb43
-rw-r--r--sample/soap/exchange/client.rb19
-rw-r--r--sample/soap/exchange/exchange.rb17
-rw-r--r--sample/soap/exchange/httpd.rb20
-rw-r--r--sample/soap/exchange/samplehttpd.conf2
-rw-r--r--sample/soap/exchange/server.cgi14
-rw-r--r--sample/soap/exchange/server.rb16
-rw-r--r--sample/soap/helloworld/hw_c.rb6
-rw-r--r--sample/soap/helloworld/hw_s.rb17
-rw-r--r--sample/soap/icd/IICD.rb17
-rw-r--r--sample/soap/icd/icd.rb46
-rw-r--r--sample/soap/raa/iRAA.rb154
-rw-r--r--sample/soap/raa/soap4r.rb30
-rw-r--r--sample/soap/sampleStruct/client.rb16
-rw-r--r--sample/soap/sampleStruct/httpd.rb20
-rw-r--r--sample/soap/sampleStruct/iSampleStruct.rb22
-rw-r--r--sample/soap/sampleStruct/sampleStruct.rb13
-rw-r--r--sample/soap/sampleStruct/samplehttpd.conf2
-rw-r--r--sample/soap/sampleStruct/server.cgi14
-rw-r--r--sample/soap/sampleStruct/server.rb20
-rw-r--r--sample/svr.rb10
-rw-r--r--sample/tempfile.rb8
-rw-r--r--sample/test.rb2038
-rw-r--r--sample/testunit/adder.rb13
-rw-r--r--sample/testunit/subtracter.rb12
-rw-r--r--sample/testunit/tc_adder.rb18
-rw-r--r--sample/testunit/tc_subtracter.rb18
-rw-r--r--sample/testunit/ts_examples.rb7
-rw-r--r--sample/time.rb16
-rw-r--r--sample/timeout.rb42
-rw-r--r--sample/trick2013/README.md15
-rw-r--r--sample/trick2013/kinaba/authors.markdown3
-rw-r--r--sample/trick2013/kinaba/entry.rb1
-rw-r--r--sample/trick2013/kinaba/remarks.markdown37
-rw-r--r--sample/trick2013/mame/authors.markdown3
-rw-r--r--sample/trick2013/mame/entry.rb97
-rw-r--r--sample/trick2013/mame/remarks.markdown47
-rw-r--r--sample/trick2013/shinh/authors.markdown2
-rw-r--r--sample/trick2013/shinh/entry.rb10
-rw-r--r--sample/trick2013/shinh/remarks.markdown4
-rw-r--r--sample/trick2013/yhara/authors.markdown3
-rw-r--r--sample/trick2013/yhara/entry.rb28
-rw-r--r--sample/trick2013/yhara/remarks.en.markdown23
-rw-r--r--sample/trick2013/yhara/remarks.markdown24
-rw-r--r--sample/trick2015/README.md16
-rw-r--r--sample/trick2015/eregon/authors.markdown3
-rw-r--r--sample/trick2015/eregon/entry.rb16
-rw-r--r--sample/trick2015/eregon/remarks.markdown70
-rw-r--r--sample/trick2015/kinaba/authors.markdown4
-rw-r--r--sample/trick2015/kinaba/entry.rb150
-rw-r--r--sample/trick2015/kinaba/remarks.markdown85
-rw-r--r--sample/trick2015/ksk_1/authors.markdown3
-rw-r--r--sample/trick2015/ksk_1/entry.rb1
-rw-r--r--sample/trick2015/ksk_1/remarks.markdown120
-rw-r--r--sample/trick2015/ksk_2/abnormal.cnf6
-rw-r--r--sample/trick2015/ksk_2/authors.markdown3
-rw-r--r--sample/trick2015/ksk_2/entry.rb1
-rw-r--r--sample/trick2015/ksk_2/quinn.cnf21
-rw-r--r--sample/trick2015/ksk_2/remarks.markdown204
-rw-r--r--sample/trick2015/ksk_2/sample.cnf9
-rw-r--r--sample/trick2015/ksk_2/uf20-01.cnf99
-rw-r--r--sample/trick2015/ksk_2/unsat.cnf11
-rw-r--r--sample/trick2015/monae/authors.markdown1
-rw-r--r--sample/trick2015/monae/entry.rb26
-rw-r--r--sample/trick2015/monae/remarks.markdown25
-rw-r--r--sample/trick2018/01-kinaba/authors.markdown3
-rw-r--r--sample/trick2018/01-kinaba/entry.rb8
-rw-r--r--sample/trick2018/01-kinaba/remarks.markdown55
-rw-r--r--sample/trick2018/02-mame/authors.markdown3
-rw-r--r--sample/trick2018/02-mame/entry.rb15
-rw-r--r--sample/trick2018/02-mame/remarks.markdown16
-rw-r--r--sample/trick2018/03-tompng/Gemfile2
-rw-r--r--sample/trick2018/03-tompng/Gemfile.lock13
-rw-r--r--sample/trick2018/03-tompng/authors.markdown3
-rw-r--r--sample/trick2018/03-tompng/entry.rb31
-rw-r--r--sample/trick2018/03-tompng/output.txt44
-rw-r--r--sample/trick2018/03-tompng/remarks.markdown19
-rw-r--r--sample/trick2018/03-tompng/trick.pngbin0 -> 5661 bytes-rw-r--r--sample/trick2018/04-colin/authors.markdown3
-rw-r--r--sample/trick2018/04-colin/entry.rb2
-rw-r--r--sample/trick2018/04-colin/remarks.markdown62
-rw-r--r--sample/trick2018/05-tompng/authors.markdown3
-rw-r--r--sample/trick2018/05-tompng/entry.rb41
-rw-r--r--sample/trick2018/05-tompng/preview_of_output.pngbin0 -> 66800 bytes-rw-r--r--sample/trick2018/05-tompng/remarks.markdown31
-rw-r--r--sample/trick2018/README.md16
-rw-r--r--sample/trick2022/01-tompng/Gemfile2
-rw-r--r--sample/trick2022/01-tompng/Gemfile.lock13
-rw-r--r--sample/trick2022/01-tompng/authors.markdown3
-rw-r--r--sample/trick2022/01-tompng/entry.rb40
-rw-r--r--sample/trick2022/01-tompng/remarks.markdown51
-rw-r--r--sample/trick2022/02-tompng/authors.markdown3
-rw-r--r--sample/trick2022/02-tompng/entry.rb32
-rw-r--r--sample/trick2022/02-tompng/remarks.markdown32
-rw-r--r--sample/trick2022/03-mame/authors.markdown3
-rw-r--r--sample/trick2022/03-mame/entry.rb27
-rw-r--r--sample/trick2022/03-mame/remarks.markdown96
-rw-r--r--sample/trick2022/03-mame/test.txt13
-rw-r--r--sample/trick2022/README.md14
-rw-r--r--sample/trick2025/01-omoikane/authors.markdown5
-rw-r--r--sample/trick2025/01-omoikane/bf.rb81
-rw-r--r--sample/trick2025/01-omoikane/entry.rb32
-rw-r--r--sample/trick2025/01-omoikane/remarks.markdown71
-rw-r--r--sample/trick2025/01-omoikane/sample_input.txt35
-rw-r--r--sample/trick2025/01-omoikane/spoiler_rot13.txt470
-rw-r--r--sample/trick2025/02-mame/authors.markdown3
-rw-r--r--sample/trick2025/02-mame/entry.rb34
-rw-r--r--sample/trick2025/02-mame/remarks.markdown141
-rw-r--r--sample/trick2025/02-mame/sample.orig.rb8
-rw-r--r--sample/trick2025/02-mame/test.patch16
-rw-r--r--sample/trick2025/03-tompng/authors.markdown3
-rw-r--r--sample/trick2025/03-tompng/entry.rb74
-rw-r--r--sample/trick2025/03-tompng/remarks.markdown146
-rw-r--r--sample/trick2025/04-tompng/authors.markdown3
-rw-r--r--sample/trick2025/04-tompng/entry.rb36
-rw-r--r--sample/trick2025/04-tompng/remarks.markdown43
-rw-r--r--sample/trick2025/05-tompng/authors.markdown3
-rw-r--r--sample/trick2025/05-tompng/entry.rb118
-rw-r--r--sample/trick2025/05-tompng/remarks.markdown106
-rw-r--r--sample/trick2025/README.md16
-rw-r--r--sample/trojan.rb4
-rw-r--r--sample/tsvr.rb2
-rw-r--r--sample/uumerge.rb2
-rw-r--r--sample/weakref.rb9
-rw-r--r--sample/webrick/demo-app.rb66
-rw-r--r--sample/webrick/demo-multipart.cgi12
-rw-r--r--sample/webrick/demo-servlet.rb6
-rw-r--r--sample/webrick/demo-urlencoded.cgi12
-rw-r--r--sample/webrick/hello.cgi11
-rw-r--r--sample/webrick/hello.rb8
-rw-r--r--sample/webrick/httpd.rb23
-rw-r--r--sample/webrick/httpsd.rb33
-rw-r--r--sample/wsdl/amazon/AmazonSearch.rb3057
-rw-r--r--sample/wsdl/amazon/AmazonSearchDriver.rb536
-rw-r--r--sample/wsdl/amazon/sampleClient.rb37
-rw-r--r--sample/wsdl/amazon/wsdlDriver.rb52
-rw-r--r--sample/wsdl/googleSearch/GoogleSearch.rb258
-rw-r--r--sample/wsdl/googleSearch/GoogleSearchDriver.rb101
-rw-r--r--sample/wsdl/googleSearch/README6
-rw-r--r--sample/wsdl/googleSearch/httpd.rb20
-rw-r--r--sample/wsdl/googleSearch/sampleClient.rb56
-rw-r--r--sample/wsdl/googleSearch/samplehttpd.conf2
-rw-r--r--sample/wsdl/googleSearch/sjissearch.sh3
-rw-r--r--sample/wsdl/googleSearch/wsdlDriver.rb23
-rw-r--r--sample/wsdl/raa/raa.wsdl264
-rw-r--r--sample/wsdl/raa/soap4r.rb31
-rw-r--r--scheduler.c1245
-rw-r--r--set.c2293
-rw-r--r--shape.c1657
-rw-r--r--shape.h484
-rw-r--r--signal.c1702
-rw-r--r--siphash.c493
-rw-r--r--siphash.h48
-rw-r--r--sparc.c40
-rw-r--r--spec/README.md160
-rwxr-xr-xspec/bin/bundle6
-rwxr-xr-xspec/bin/parallel_rspec7
-rwxr-xr-xspec/bin/rspec6
-rw-r--r--spec/bundled_gems.mspec14
-rw-r--r--spec/bundled_gems_spec.rb427
-rw-r--r--spec/bundler/bundler/build_metadata_spec.rb50
-rw-r--r--spec/bundler/bundler/bundler_spec.rb344
-rw-r--r--spec/bundler/bundler/ci_detector_spec.rb21
-rw-r--r--spec/bundler/bundler/cli_common_spec.rb22
-rw-r--r--spec/bundler/bundler/cli_spec.rb296
-rw-r--r--spec/bundler/bundler/compact_index_client/parser_spec.rb237
-rw-r--r--spec/bundler/bundler/compact_index_client/updater_spec.rb243
-rw-r--r--spec/bundler/bundler/current_ruby_spec.rb157
-rw-r--r--spec/bundler/bundler/definition_spec.rb307
-rw-r--r--spec/bundler/bundler/dependency_spec.rb49
-rw-r--r--spec/bundler/bundler/digest_spec.rb24
-rw-r--r--spec/bundler/bundler/dsl_spec.rb369
-rw-r--r--spec/bundler/bundler/endpoint_specification_spec.rb83
-rw-r--r--spec/bundler/bundler/env_spec.rb236
-rw-r--r--spec/bundler/bundler/environment_preserver_spec.rb87
-rw-r--r--spec/bundler/bundler/fetcher/base_spec.rb77
-rw-r--r--spec/bundler/bundler/fetcher/compact_index_spec.rb109
-rw-r--r--spec/bundler/bundler/fetcher/dependency_spec.rb284
-rw-r--r--spec/bundler/bundler/fetcher/downloader_spec.rb270
-rw-r--r--spec/bundler/bundler/fetcher/gem_remote_fetcher_spec.rb60
-rw-r--r--spec/bundler/bundler/fetcher/index_spec.rb75
-rw-r--r--spec/bundler/bundler/fetcher_spec.rb260
-rw-r--r--spec/bundler/bundler/friendly_errors_spec.rb231
-rw-r--r--spec/bundler/bundler/gem_helper_spec.rb451
-rw-r--r--spec/bundler/bundler/gem_version_promoter_spec.rb163
-rw-r--r--spec/bundler/bundler/index_spec.rb36
-rw-r--r--spec/bundler/bundler/installer/gem_installer_spec.rb47
-rw-r--r--spec/bundler/bundler/installer/spec_installation_spec.rb68
-rw-r--r--spec/bundler/bundler/lockfile_parser_spec.rb221
-rw-r--r--spec/bundler/bundler/mirror_spec.rb331
-rw-r--r--spec/bundler/bundler/plugin/api/source_spec.rb88
-rw-r--r--spec/bundler/bundler/plugin/api_spec.rb83
-rw-r--r--spec/bundler/bundler/plugin/dsl_spec.rb38
-rw-r--r--spec/bundler/bundler/plugin/events_spec.rb32
-rw-r--r--spec/bundler/bundler/plugin/index_spec.rb196
-rw-r--r--spec/bundler/bundler/plugin/installer_spec.rb137
-rw-r--r--spec/bundler/bundler/plugin/source_list_spec.rb25
-rw-r--r--spec/bundler/bundler/plugin_spec.rb368
-rw-r--r--spec/bundler/bundler/remote_specification_spec.rb187
-rw-r--r--spec/bundler/bundler/resolver/candidate_spec.rb20
-rw-r--r--spec/bundler/bundler/retry_spec.rb81
-rw-r--r--spec/bundler/bundler/ruby_dsl_spec.rb248
-rw-r--r--spec/bundler/bundler/ruby_version_spec.rb494
-rw-r--r--spec/bundler/bundler/rubygems_integration_spec.rb126
-rw-r--r--spec/bundler/bundler/settings/validator_spec.rb111
-rw-r--r--spec/bundler/bundler/settings_spec.rb354
-rw-r--r--spec/bundler/bundler/shared_helpers_spec.rb518
-rw-r--r--spec/bundler/bundler/source/git/git_proxy_spec.rb337
-rw-r--r--spec/bundler/bundler/source/git_spec.rb123
-rw-r--r--spec/bundler/bundler/source/path_spec.rb31
-rw-r--r--spec/bundler/bundler/source/rubygems/remote_spec.rb172
-rw-r--r--spec/bundler/bundler/source/rubygems_spec.rb65
-rw-r--r--spec/bundler/bundler/source_list_spec.rb459
-rw-r--r--spec/bundler/bundler/source_spec.rb174
-rw-r--r--spec/bundler/bundler/spec_set_spec.rb59
-rw-r--r--spec/bundler/bundler/specifications/foo.gemspec13
-rw-r--r--spec/bundler/bundler/stub_specification_spec.rb78
-rw-r--r--spec/bundler/bundler/ui/shell_spec.rb112
-rw-r--r--spec/bundler/bundler/ui_spec.rb41
-rw-r--r--spec/bundler/bundler/uri_credentials_filter_spec.rb137
-rw-r--r--spec/bundler/bundler/uri_normalizer_spec.rb25
-rw-r--r--spec/bundler/bundler/worker_spec.rb69
-rw-r--r--spec/bundler/bundler/yaml_serializer_spec.rb235
-rw-r--r--spec/bundler/cache/cache_path_spec.rb32
-rw-r--r--spec/bundler/cache/gems_spec.rb427
-rw-r--r--spec/bundler/cache/git_spec.rb511
-rw-r--r--spec/bundler/cache/path_spec.rb121
-rw-r--r--spec/bundler/cache/platform_spec.rb49
-rw-r--r--spec/bundler/commands/add_spec.rb440
-rw-r--r--spec/bundler/commands/binstubs_spec.rb333
-rw-r--r--spec/bundler/commands/cache_spec.rb620
-rw-r--r--spec/bundler/commands/check_spec.rb601
-rw-r--r--spec/bundler/commands/clean_spec.rb938
-rw-r--r--spec/bundler/commands/config_spec.rb611
-rw-r--r--spec/bundler/commands/console_spec.rb214
-rw-r--r--spec/bundler/commands/doctor_spec.rb181
-rw-r--r--spec/bundler/commands/exec_spec.rb1272
-rw-r--r--spec/bundler/commands/fund_spec.rb118
-rw-r--r--spec/bundler/commands/help_spec.rb92
-rw-r--r--spec/bundler/commands/info_spec.rb249
-rw-r--r--spec/bundler/commands/init_spec.rb207
-rw-r--r--spec/bundler/commands/install_spec.rb2035
-rw-r--r--spec/bundler/commands/issue_spec.rb16
-rw-r--r--spec/bundler/commands/licenses_spec.rb37
-rw-r--r--spec/bundler/commands/list_spec.rb315
-rw-r--r--spec/bundler/commands/lock_spec.rb2876
-rw-r--r--spec/bundler/commands/newgem_spec.rb2083
-rw-r--r--spec/bundler/commands/open_spec.rb175
-rw-r--r--spec/bundler/commands/outdated_spec.rb1369
-rw-r--r--spec/bundler/commands/platform_spec.rb1270
-rw-r--r--spec/bundler/commands/post_bundle_message_spec.rb183
-rw-r--r--spec/bundler/commands/pristine_spec.rb275
-rw-r--r--spec/bundler/commands/remove_spec.rb736
-rw-r--r--spec/bundler/commands/show_spec.rb217
-rw-r--r--spec/bundler/commands/ssl_spec.rb373
-rw-r--r--spec/bundler/commands/update_spec.rb2093
-rw-r--r--spec/bundler/commands/version_spec.rb65
-rw-r--r--spec/bundler/install/allow_offline_install_spec.rb95
-rw-r--r--spec/bundler/install/binstubs_spec.rb49
-rw-r--r--spec/bundler/install/bundler_spec.rb268
-rw-r--r--spec/bundler/install/deploy_spec.rb493
-rw-r--r--spec/bundler/install/failure_spec.rb51
-rw-r--r--spec/bundler/install/force_spec.rb71
-rw-r--r--spec/bundler/install/gemfile/eval_gemfile_spec.rb122
-rw-r--r--spec/bundler/install/gemfile/force_ruby_platform_spec.rb136
-rw-r--r--spec/bundler/install/gemfile/gemspec_spec.rb737
-rw-r--r--spec/bundler/install/gemfile/git_spec.rb1745
-rw-r--r--spec/bundler/install/gemfile/groups_spec.rb345
-rw-r--r--spec/bundler/install/gemfile/install_if_spec.rb51
-rw-r--r--spec/bundler/install/gemfile/lockfile_spec.rb42
-rw-r--r--spec/bundler/install/gemfile/path_spec.rb1017
-rw-r--r--spec/bundler/install/gemfile/platform_spec.rb638
-rw-r--r--spec/bundler/install/gemfile/ruby_spec.rb157
-rw-r--r--spec/bundler/install/gemfile/sources_spec.rb1198
-rw-r--r--spec/bundler/install/gemfile/specific_platform_spec.rb1938
-rw-r--r--spec/bundler/install/gemfile_spec.rb192
-rw-r--r--spec/bundler/install/gems/compact_index_spec.rb1012
-rw-r--r--spec/bundler/install/gems/dependency_api_fallback_spec.rb19
-rw-r--r--spec/bundler/install/gems/dependency_api_spec.rb656
-rw-r--r--spec/bundler/install/gems/env_spec.rb107
-rw-r--r--spec/bundler/install/gems/flex_spec.rb403
-rw-r--r--spec/bundler/install/gems/fund_spec.rb164
-rw-r--r--spec/bundler/install/gems/gemfile_source_header_spec.rb24
-rw-r--r--spec/bundler/install/gems/mirror_probe_spec.rb68
-rw-r--r--spec/bundler/install/gems/mirror_spec.rb39
-rw-r--r--spec/bundler/install/gems/native_extensions_spec.rb184
-rw-r--r--spec/bundler/install/gems/post_install_spec.rb150
-rw-r--r--spec/bundler/install/gems/resolving_spec.rb784
-rw-r--r--spec/bundler/install/gems/standalone_spec.rb524
-rw-r--r--spec/bundler/install/gems/win32_spec.rb25
-rw-r--r--spec/bundler/install/gemspecs_spec.rb181
-rw-r--r--spec/bundler/install/git_spec.rb293
-rw-r--r--spec/bundler/install/global_cache_spec.rb296
-rw-r--r--spec/bundler/install/path_spec.rb214
-rw-r--r--spec/bundler/install/prereleases_spec.rb54
-rw-r--r--spec/bundler/install/process_lock_spec.rb57
-rw-r--r--spec/bundler/install/security_policy_spec.rb72
-rw-r--r--spec/bundler/install/yanked_spec.rb254
-rw-r--r--spec/bundler/lock/git_spec.rb258
-rw-r--r--spec/bundler/lock/lockfile_spec.rb2415
-rw-r--r--spec/bundler/other/cli_dispatch_spec.rb20
-rw-r--r--spec/bundler/other/cli_man_pages_spec.rb100
-rw-r--r--spec/bundler/other/ext_spec.rb50
-rw-r--r--spec/bundler/other/major_deprecation_spec.rb795
-rw-r--r--spec/bundler/plugins/command_spec.rb78
-rw-r--r--spec/bundler/plugins/hook_spec.rb208
-rw-r--r--spec/bundler/plugins/install_spec.rb429
-rw-r--r--spec/bundler/plugins/list_spec.rb60
-rw-r--r--spec/bundler/plugins/source/example_spec.rb456
-rw-r--r--spec/bundler/plugins/source_spec.rb111
-rw-r--r--spec/bundler/plugins/uninstall_spec.rb74
-rw-r--r--spec/bundler/quality_es_spec.rb61
-rw-r--r--spec/bundler/quality_spec.rb261
-rw-r--r--spec/bundler/realworld/double_check_spec.rb40
-rw-r--r--spec/bundler/realworld/edgecases_spec.rb75
-rw-r--r--spec/bundler/realworld/ffi_spec.rb57
-rw-r--r--spec/bundler/realworld/fixtures/tapioca/Gemfile5
-rw-r--r--spec/bundler/realworld/fixtures/tapioca/Gemfile.lock49
-rw-r--r--spec/bundler/realworld/fixtures/warbler/.gitignore1
-rw-r--r--spec/bundler/realworld/fixtures/warbler/Gemfile7
-rw-r--r--spec/bundler/realworld/fixtures/warbler/Gemfile.lock39
-rw-r--r--spec/bundler/realworld/fixtures/warbler/bin/warbler-example.rb3
-rw-r--r--spec/bundler/realworld/fixtures/warbler/demo/demo.gemspec10
-rw-r--r--spec/bundler/realworld/git_spec.rb11
-rw-r--r--spec/bundler/realworld/parallel_spec.rb66
-rw-r--r--spec/bundler/realworld/slow_perf_spec.rb35
-rw-r--r--spec/bundler/resolver/basic_spec.rb422
-rw-r--r--spec/bundler/resolver/platform_spec.rb423
-rw-r--r--spec/bundler/runtime/env_helpers_spec.rb236
-rw-r--r--spec/bundler/runtime/executable_spec.rb141
-rw-r--r--spec/bundler/runtime/gem_tasks_spec.rb158
-rw-r--r--spec/bundler/runtime/inline_spec.rb705
-rw-r--r--spec/bundler/runtime/load_spec.rb113
-rw-r--r--spec/bundler/runtime/platform_spec.rb468
-rw-r--r--spec/bundler/runtime/require_spec.rb480
-rw-r--r--spec/bundler/runtime/requiring_spec.rb15
-rw-r--r--spec/bundler/runtime/self_management_spec.rb261
-rw-r--r--spec/bundler/runtime/setup_spec.rb1679
-rw-r--r--spec/bundler/spec_helper.rb149
-rw-r--r--spec/bundler/support/activate.rb9
-rw-r--r--spec/bundler/support/artifice/compact_index.rb6
-rw-r--r--spec/bundler/support/artifice/compact_index_api_missing.rb13
-rw-r--r--spec/bundler/support/artifice/compact_index_basic_authentication.rb15
-rw-r--r--spec/bundler/support/artifice/compact_index_checksum_mismatch.rb16
-rw-r--r--spec/bundler/support/artifice/compact_index_concurrent_download.rb33
-rw-r--r--spec/bundler/support/artifice/compact_index_creds_diff_host.rb39
-rw-r--r--spec/bundler/support/artifice/compact_index_etag_match.rb16
-rw-r--r--spec/bundler/support/artifice/compact_index_extra.rb6
-rw-r--r--spec/bundler/support/artifice/compact_index_extra_api.rb6
-rw-r--r--spec/bundler/support/artifice/compact_index_extra_api_missing.rb17
-rw-r--r--spec/bundler/support/artifice/compact_index_extra_missing.rb17
-rw-r--r--spec/bundler/support/artifice/compact_index_forbidden.rb13
-rw-r--r--spec/bundler/support/artifice/compact_index_host_redirect.rb21
-rw-r--r--spec/bundler/support/artifice/compact_index_mirror_down.rb21
-rw-r--r--spec/bundler/support/artifice/compact_index_no_checksums.rb16
-rw-r--r--spec/bundler/support/artifice/compact_index_no_gem.rb13
-rw-r--r--spec/bundler/support/artifice/compact_index_partial_update.rb38
-rw-r--r--spec/bundler/support/artifice/compact_index_partial_update_bad_digest.rb40
-rw-r--r--spec/bundler/support/artifice/compact_index_partial_update_no_digest_not_incremental.rb42
-rw-r--r--spec/bundler/support/artifice/compact_index_precompiled_before.rb25
-rw-r--r--spec/bundler/support/artifice/compact_index_range_ignored.rb40
-rw-r--r--spec/bundler/support/artifice/compact_index_range_not_satisfiable.rb34
-rw-r--r--spec/bundler/support/artifice/compact_index_rate_limited.rb48
-rw-r--r--spec/bundler/support/artifice/compact_index_redirects.rb21
-rw-r--r--spec/bundler/support/artifice/compact_index_strict_basic_authentication.rb20
-rw-r--r--spec/bundler/support/artifice/compact_index_wrong_dependencies.rb17
-rw-r--r--spec/bundler/support/artifice/compact_index_wrong_gem_checksum.rb21
-rw-r--r--spec/bundler/support/artifice/endpoint.rb6
-rw-r--r--spec/bundler/support/artifice/endpoint_500.rb17
-rw-r--r--spec/bundler/support/artifice/endpoint_api_forbidden.rb13
-rw-r--r--spec/bundler/support/artifice/endpoint_basic_authentication.rb15
-rw-r--r--spec/bundler/support/artifice/endpoint_creds_diff_host.rb39
-rw-r--r--spec/bundler/support/artifice/endpoint_extra.rb33
-rw-r--r--spec/bundler/support/artifice/endpoint_extra_api.rb34
-rw-r--r--spec/bundler/support/artifice/endpoint_extra_missing.rb17
-rw-r--r--spec/bundler/support/artifice/endpoint_fallback.rb19
-rw-r--r--spec/bundler/support/artifice/endpoint_host_redirect.rb17
-rw-r--r--spec/bundler/support/artifice/endpoint_marshal_fail.rb6
-rw-r--r--spec/bundler/support/artifice/endpoint_marshal_fail_basic_authentication.rb15
-rw-r--r--spec/bundler/support/artifice/endpoint_mirror_source.rb17
-rw-r--r--spec/bundler/support/artifice/endpoint_redirect.rb17
-rw-r--r--spec/bundler/support/artifice/endpoint_strict_basic_authentication.rb20
-rw-r--r--spec/bundler/support/artifice/endpoint_timeout.rb15
-rw-r--r--spec/bundler/support/artifice/fail.rb27
-rw-r--r--spec/bundler/support/artifice/helpers/artifice.rb30
-rw-r--r--spec/bundler/support/artifice/helpers/compact_index.rb124
-rw-r--r--spec/bundler/support/artifice/helpers/compact_index_extra.rb33
-rw-r--r--spec/bundler/support/artifice/helpers/compact_index_extra_api.rb48
-rw-r--r--spec/bundler/support/artifice/helpers/endpoint.rb113
-rw-r--r--spec/bundler/support/artifice/helpers/endpoint_extra.rb29
-rw-r--r--spec/bundler/support/artifice/helpers/endpoint_fallback.rb15
-rw-r--r--spec/bundler/support/artifice/helpers/endpoint_marshal_fail.rb9
-rw-r--r--spec/bundler/support/artifice/helpers/rack_request.rb100
-rw-r--r--spec/bundler/support/artifice/vcr.rb152
-rw-r--r--spec/bundler/support/artifice/windows.rb45
-rw-r--r--spec/bundler/support/build_metadata.rb53
-rw-r--r--spec/bundler/support/builders.rb749
-rwxr-xr-xspec/bundler/support/bundle6
-rw-r--r--spec/bundler/support/bundle.rb7
-rw-r--r--spec/bundler/support/checksums.rb126
-rw-r--r--spec/bundler/support/command_execution.rb78
-rw-r--r--spec/bundler/support/env.rb13
-rw-r--r--spec/bundler/support/filters.rb38
-rw-r--r--spec/bundler/support/hax.rb74
-rw-r--r--spec/bundler/support/helpers.rb545
-rw-r--r--spec/bundler/support/indexes.rb424
-rw-r--r--spec/bundler/support/matchers.rb227
-rw-r--r--spec/bundler/support/options.rb15
-rw-r--r--spec/bundler/support/path.rb362
-rw-r--r--spec/bundler/support/permissions.rb12
-rw-r--r--spec/bundler/support/platforms.rb75
-rw-r--r--spec/bundler/support/rubygems_ext.rb169
-rw-r--r--spec/bundler/support/rubygems_version_manager.rb124
-rw-r--r--spec/bundler/support/setup.rb9
-rw-r--r--spec/bundler/support/subprocess.rb115
-rw-r--r--spec/bundler/support/switch_rubygems.rb4
-rw-r--r--spec/bundler/support/the_bundle.rb41
-rw-r--r--spec/bundler/support/vendored_net_http.rb23
-rw-r--r--spec/bundler/support/windows_tag_group.rb191
-rw-r--r--spec/bundler/update/force_spec.rb30
-rw-r--r--spec/bundler/update/gemfile_spec.rb47
-rw-r--r--spec/bundler/update/gems/fund_spec.rb50
-rw-r--r--spec/bundler/update/gems/post_install_spec.rb76
-rw-r--r--spec/bundler/update/git_spec.rb341
-rw-r--r--spec/bundler/update/path_spec.rb19
-rw-r--r--spec/default.mspec138
-rw-r--r--spec/lib/formatter_overrides.rb6
-rw-r--r--spec/lib/spec_coverage.rb1
-rw-r--r--spec/mmtk.mspec12
-rw-r--r--spec/mspec/.rspec1
-rw-r--r--spec/mspec/Gemfile4
-rw-r--r--spec/mspec/Gemfile.lock26
-rw-r--r--spec/mspec/LICENSE22
-rw-r--r--spec/mspec/README.md84
-rw-r--r--spec/mspec/Rakefile6
-rwxr-xr-xspec/mspec/bin/mkspec7
-rwxr-xr-xspec/mspec/bin/mkspec.bat1
-rwxr-xr-xspec/mspec/bin/mspec7
-rwxr-xr-xspec/mspec/bin/mspec-ci7
-rwxr-xr-xspec/mspec/bin/mspec-ci.bat1
-rwxr-xr-xspec/mspec/bin/mspec-run7
-rwxr-xr-xspec/mspec/bin/mspec-run.bat1
-rwxr-xr-xspec/mspec/bin/mspec-tag7
-rwxr-xr-xspec/mspec/bin/mspec-tag.bat1
-rwxr-xr-xspec/mspec/bin/mspec.bat1
-rw-r--r--spec/mspec/lib/mspec.rb8
-rw-r--r--spec/mspec/lib/mspec/commands/mkspec.rb143
-rw-r--r--spec/mspec/lib/mspec/commands/mspec-ci.rb76
-rw-r--r--spec/mspec/lib/mspec/commands/mspec-run.rb87
-rw-r--r--spec/mspec/lib/mspec/commands/mspec-tag.rb131
-rw-r--r--spec/mspec/lib/mspec/commands/mspec.rb113
-rw-r--r--spec/mspec/lib/mspec/expectations.rb2
-rw-r--r--spec/mspec/lib/mspec/expectations/expectations.rb39
-rw-r--r--spec/mspec/lib/mspec/expectations/should.rb41
-rw-r--r--spec/mspec/lib/mspec/guards.rb11
-rw-r--r--spec/mspec/lib/mspec/guards/block_device.rb16
-rw-r--r--spec/mspec/lib/mspec/guards/bug.rb29
-rw-r--r--spec/mspec/lib/mspec/guards/conflict.rb23
-rw-r--r--spec/mspec/lib/mspec/guards/endian.rb25
-rw-r--r--spec/mspec/lib/mspec/guards/feature.rb45
-rw-r--r--spec/mspec/lib/mspec/guards/guard.rb141
-rw-r--r--spec/mspec/lib/mspec/guards/platform.rb122
-rw-r--r--spec/mspec/lib/mspec/guards/quarantine.rb11
-rw-r--r--spec/mspec/lib/mspec/guards/superuser.rb25
-rw-r--r--spec/mspec/lib/mspec/guards/support.rb14
-rw-r--r--spec/mspec/lib/mspec/guards/version.rb72
-rw-r--r--spec/mspec/lib/mspec/helpers.rb13
-rw-r--r--spec/mspec/lib/mspec/helpers/argf.rb35
-rw-r--r--spec/mspec/lib/mspec/helpers/argv.rb44
-rw-r--r--spec/mspec/lib/mspec/helpers/datetime.rb48
-rw-r--r--spec/mspec/lib/mspec/helpers/fixture.rb24
-rw-r--r--spec/mspec/lib/mspec/helpers/flunk.rb3
-rw-r--r--spec/mspec/lib/mspec/helpers/fs.rb64
-rw-r--r--spec/mspec/lib/mspec/helpers/io.rb87
-rw-r--r--spec/mspec/lib/mspec/helpers/mock_to_path.rb6
-rw-r--r--spec/mspec/lib/mspec/helpers/numeric.rb98
-rw-r--r--spec/mspec/lib/mspec/helpers/ruby_exe.rb205
-rw-r--r--spec/mspec/lib/mspec/helpers/scratch.rb21
-rw-r--r--spec/mspec/lib/mspec/helpers/tmp.rb62
-rw-r--r--spec/mspec/lib/mspec/helpers/warning.rb21
-rw-r--r--spec/mspec/lib/mspec/matchers.rb37
-rw-r--r--spec/mspec/lib/mspec/matchers/base.rb79
-rw-r--r--spec/mspec/lib/mspec/matchers/be_an_instance_of.rb26
-rw-r--r--spec/mspec/lib/mspec/matchers/be_ancestor_of.rb24
-rw-r--r--spec/mspec/lib/mspec/matchers/be_close.rb29
-rw-r--r--spec/mspec/lib/mspec/matchers/be_computed_by.rb37
-rw-r--r--spec/mspec/lib/mspec/matchers/be_empty.rb20
-rw-r--r--spec/mspec/lib/mspec/matchers/be_false.rb20
-rw-r--r--spec/mspec/lib/mspec/matchers/be_kind_of.rb24
-rw-r--r--spec/mspec/lib/mspec/matchers/be_nan.rb20
-rw-r--r--spec/mspec/lib/mspec/matchers/be_nil.rb20
-rw-r--r--spec/mspec/lib/mspec/matchers/be_true.rb20
-rw-r--r--spec/mspec/lib/mspec/matchers/be_true_or_false.rb20
-rw-r--r--spec/mspec/lib/mspec/matchers/block_caller.rb37
-rw-r--r--spec/mspec/lib/mspec/matchers/complain.rb69
-rw-r--r--spec/mspec/lib/mspec/matchers/eql.rb26
-rw-r--r--spec/mspec/lib/mspec/matchers/equal.rb26
-rw-r--r--spec/mspec/lib/mspec/matchers/equal_element.rb78
-rw-r--r--spec/mspec/lib/mspec/matchers/have_class_variable.rb12
-rw-r--r--spec/mspec/lib/mspec/matchers/have_constant.rb12
-rw-r--r--spec/mspec/lib/mspec/matchers/have_instance_method.rb24
-rw-r--r--spec/mspec/lib/mspec/matchers/have_instance_variable.rb12
-rw-r--r--spec/mspec/lib/mspec/matchers/have_method.rb24
-rw-r--r--spec/mspec/lib/mspec/matchers/have_private_instance_method.rb24
-rw-r--r--spec/mspec/lib/mspec/matchers/have_private_method.rb24
-rw-r--r--spec/mspec/lib/mspec/matchers/have_protected_instance_method.rb24
-rw-r--r--spec/mspec/lib/mspec/matchers/have_public_instance_method.rb24
-rw-r--r--spec/mspec/lib/mspec/matchers/have_singleton_method.rb24
-rw-r--r--spec/mspec/lib/mspec/matchers/include.rb31
-rw-r--r--spec/mspec/lib/mspec/matchers/include_any_of.rb29
-rw-r--r--spec/mspec/lib/mspec/matchers/infinity.rb28
-rw-r--r--spec/mspec/lib/mspec/matchers/match_yaml.rb50
-rw-r--r--spec/mspec/lib/mspec/matchers/method.rb10
-rw-r--r--spec/mspec/lib/mspec/matchers/output.rb67
-rw-r--r--spec/mspec/lib/mspec/matchers/output_to_fd.rb71
-rw-r--r--spec/mspec/lib/mspec/matchers/raise_error.rb93
-rw-r--r--spec/mspec/lib/mspec/matchers/respond_to.rb24
-rw-r--r--spec/mspec/lib/mspec/matchers/signed_zero.rb28
-rw-r--r--spec/mspec/lib/mspec/matchers/skip.rb5
-rw-r--r--spec/mspec/lib/mspec/matchers/variable.rb24
-rw-r--r--spec/mspec/lib/mspec/mocks.rb3
-rw-r--r--spec/mspec/lib/mspec/mocks/mock.rb209
-rw-r--r--spec/mspec/lib/mspec/mocks/object.rb28
-rw-r--r--spec/mspec/lib/mspec/mocks/proxy.rb186
-rw-r--r--spec/mspec/lib/mspec/runner.rb12
-rw-r--r--spec/mspec/lib/mspec/runner/actions.rb6
-rw-r--r--spec/mspec/lib/mspec/runner/actions/constants_leak_checker.rb84
-rw-r--r--spec/mspec/lib/mspec/runner/actions/filter.rb40
-rw-r--r--spec/mspec/lib/mspec/runner/actions/leakchecker.rb377
-rw-r--r--spec/mspec/lib/mspec/runner/actions/profile.rb60
-rw-r--r--spec/mspec/lib/mspec/runner/actions/tag.rb133
-rw-r--r--spec/mspec/lib/mspec/runner/actions/taglist.rb56
-rw-r--r--spec/mspec/lib/mspec/runner/actions/tagpurge.rb56
-rw-r--r--spec/mspec/lib/mspec/runner/actions/tally.rb133
-rw-r--r--spec/mspec/lib/mspec/runner/actions/timeout.rb145
-rw-r--r--spec/mspec/lib/mspec/runner/actions/timer.rb22
-rw-r--r--spec/mspec/lib/mspec/runner/context.rb237
-rw-r--r--spec/mspec/lib/mspec/runner/evaluate.rb54
-rw-r--r--spec/mspec/lib/mspec/runner/example.rb34
-rw-r--r--spec/mspec/lib/mspec/runner/exception.rb54
-rw-r--r--spec/mspec/lib/mspec/runner/filters.rb4
-rw-r--r--spec/mspec/lib/mspec/runner/filters/match.rb18
-rw-r--r--spec/mspec/lib/mspec/runner/filters/profile.rb54
-rw-r--r--spec/mspec/lib/mspec/runner/filters/regexp.rb23
-rw-r--r--spec/mspec/lib/mspec/runner/filters/tag.rb29
-rw-r--r--spec/mspec/lib/mspec/runner/formatters.rb13
-rw-r--r--spec/mspec/lib/mspec/runner/formatters/base.rb150
-rw-r--r--spec/mspec/lib/mspec/runner/formatters/describe.rb23
-rw-r--r--spec/mspec/lib/mspec/runner/formatters/dotted.rb23
-rw-r--r--spec/mspec/lib/mspec/runner/formatters/file.rb24
-rw-r--r--spec/mspec/lib/mspec/runner/formatters/html.rb81
-rw-r--r--spec/mspec/lib/mspec/runner/formatters/junit.rb87
-rw-r--r--spec/mspec/lib/mspec/runner/formatters/launchable.rb88
-rw-r--r--spec/mspec/lib/mspec/runner/formatters/method.rb95
-rw-r--r--spec/mspec/lib/mspec/runner/formatters/multi.rb47
-rw-r--r--spec/mspec/lib/mspec/runner/formatters/profile.rb18
-rw-r--r--spec/mspec/lib/mspec/runner/formatters/specdoc.rb41
-rw-r--r--spec/mspec/lib/mspec/runner/formatters/spinner.rb111
-rw-r--r--spec/mspec/lib/mspec/runner/formatters/stats.rb57
-rw-r--r--spec/mspec/lib/mspec/runner/formatters/summary.rb4
-rw-r--r--spec/mspec/lib/mspec/runner/formatters/unit.rb20
-rw-r--r--spec/mspec/lib/mspec/runner/formatters/yaml.rb38
-rw-r--r--spec/mspec/lib/mspec/runner/mspec.rb423
-rw-r--r--spec/mspec/lib/mspec/runner/object.rb26
-rw-r--r--spec/mspec/lib/mspec/runner/parallel.rb98
-rw-r--r--spec/mspec/lib/mspec/runner/shared.rb14
-rw-r--r--spec/mspec/lib/mspec/runner/tag.rb38
-rw-r--r--spec/mspec/lib/mspec/utils/deprecate.rb6
-rw-r--r--spec/mspec/lib/mspec/utils/format.rb24
-rw-r--r--spec/mspec/lib/mspec/utils/name_map.rb133
-rw-r--r--spec/mspec/lib/mspec/utils/options.rb521
-rw-r--r--spec/mspec/lib/mspec/utils/script.rb305
-rw-r--r--spec/mspec/lib/mspec/utils/version.rb52
-rw-r--r--spec/mspec/lib/mspec/utils/warnings.rb10
-rw-r--r--spec/mspec/lib/mspec/version.rb5
-rw-r--r--spec/mspec/spec/commands/fixtures/four.txt (renamed from test/wsdl/datetime/datetime.rb)0
-rw-r--r--spec/mspec/spec/commands/fixtures/level2/three_spec.rb1
-rw-r--r--spec/mspec/spec/commands/fixtures/one_spec.rb1
-rw-r--r--spec/mspec/spec/commands/fixtures/three.rb1
-rw-r--r--spec/mspec/spec/commands/fixtures/two_spec.rb1
-rw-r--r--spec/mspec/spec/commands/mkspec_spec.rb363
-rw-r--r--spec/mspec/spec/commands/mspec_ci_spec.rb155
-rw-r--r--spec/mspec/spec/commands/mspec_run_spec.rb178
-rw-r--r--spec/mspec/spec/commands/mspec_spec.rb180
-rw-r--r--spec/mspec/spec/commands/mspec_tag_spec.rb414
-rw-r--r--spec/mspec/spec/expectations/expectations_spec.rb29
-rw-r--r--spec/mspec/spec/expectations/should_spec.rb61
-rw-r--r--spec/mspec/spec/fixtures/a_spec.rb15
-rw-r--r--spec/mspec/spec/fixtures/b_spec.rb7
-rw-r--r--spec/mspec/spec/fixtures/chatty_spec.rb8
-rw-r--r--spec/mspec/spec/fixtures/config.mspec8
-rw-r--r--spec/mspec/spec/fixtures/die_spec.rb7
-rwxr-xr-xspec/mspec/spec/fixtures/my_ruby4
-rw-r--r--spec/mspec/spec/fixtures/object_methods_spec.rb8
-rw-r--r--spec/mspec/spec/fixtures/print_interpreter_spec.rb4
-rw-r--r--spec/mspec/spec/fixtures/should.rb75
-rw-r--r--spec/mspec/spec/fixtures/tagging_spec.rb16
-rw-r--r--spec/mspec/spec/guards/block_device_spec.rb46
-rw-r--r--spec/mspec/spec/guards/bug_spec.rb151
-rw-r--r--spec/mspec/spec/guards/conflict_spec.rb53
-rw-r--r--spec/mspec/spec/guards/endian_spec.rb55
-rw-r--r--spec/mspec/spec/guards/feature_spec.rb120
-rw-r--r--spec/mspec/spec/guards/guard_spec.rb421
-rw-r--r--spec/mspec/spec/guards/platform_spec.rb337
-rw-r--r--spec/mspec/spec/guards/quarantine_spec.rb35
-rw-r--r--spec/mspec/spec/guards/superuser_spec.rb35
-rw-r--r--spec/mspec/spec/guards/support_spec.rb54
-rw-r--r--spec/mspec/spec/guards/user_spec.rb20
-rw-r--r--spec/mspec/spec/guards/version_spec.rb112
-rw-r--r--spec/mspec/spec/helpers/argf_spec.rb37
-rw-r--r--spec/mspec/spec/helpers/argv_spec.rb27
-rw-r--r--spec/mspec/spec/helpers/datetime_spec.rb44
-rw-r--r--spec/mspec/spec/helpers/fixture_spec.rb25
-rw-r--r--spec/mspec/spec/helpers/flunk_spec.rb20
-rw-r--r--spec/mspec/spec/helpers/fs_spec.rb195
-rw-r--r--spec/mspec/spec/helpers/io_spec.rb136
-rw-r--r--spec/mspec/spec/helpers/mock_to_path_spec.rb23
-rw-r--r--spec/mspec/spec/helpers/numeric_spec.rb31
-rw-r--r--spec/mspec/spec/helpers/ruby_exe_spec.rb256
-rw-r--r--spec/mspec/spec/helpers/scratch_spec.rb24
-rw-r--r--spec/mspec/spec/helpers/suppress_warning_spec.rb19
-rw-r--r--spec/mspec/spec/helpers/tmp_spec.rb27
-rw-r--r--spec/mspec/spec/integration/interpreter_spec.rb18
-rw-r--r--spec/mspec/spec/integration/object_methods_spec.rb18
-rw-r--r--spec/mspec/spec/integration/run_spec.rb72
-rw-r--r--spec/mspec/spec/integration/tag_spec.rb60
-rw-r--r--spec/mspec/spec/matchers/base_spec.rb228
-rw-r--r--spec/mspec/spec/matchers/be_an_instance_of_spec.rb50
-rw-r--r--spec/mspec/spec/matchers/be_ancestor_of_spec.rb28
-rw-r--r--spec/mspec/spec/matchers/be_close_spec.rb48
-rw-r--r--spec/mspec/spec/matchers/be_computed_by_spec.rb42
-rw-r--r--spec/mspec/spec/matchers/be_empty_spec.rb26
-rw-r--r--spec/mspec/spec/matchers/be_false_spec.rb28
-rw-r--r--spec/mspec/spec/matchers/be_kind_of_spec.rb31
-rw-r--r--spec/mspec/spec/matchers/be_nan_spec.rb28
-rw-r--r--spec/mspec/spec/matchers/be_nil_spec.rb27
-rw-r--r--spec/mspec/spec/matchers/be_true_or_false_spec.rb19
-rw-r--r--spec/mspec/spec/matchers/be_true_spec.rb28
-rw-r--r--spec/mspec/spec/matchers/block_caller_spec.rb13
-rw-r--r--spec/mspec/spec/matchers/complain_spec.rb102
-rw-r--r--spec/mspec/spec/matchers/eql_spec.rb33
-rw-r--r--spec/mspec/spec/matchers/equal_element_spec.rb75
-rw-r--r--spec/mspec/spec/matchers/equal_spec.rb32
-rw-r--r--spec/mspec/spec/matchers/have_class_variable_spec.rb49
-rw-r--r--spec/mspec/spec/matchers/have_constant_spec.rb37
-rw-r--r--spec/mspec/spec/matchers/have_instance_method_spec.rb53
-rw-r--r--spec/mspec/spec/matchers/have_instance_variable_spec.rb50
-rw-r--r--spec/mspec/spec/matchers/have_method_spec.rb55
-rw-r--r--spec/mspec/spec/matchers/have_private_instance_method_spec.rb57
-rw-r--r--spec/mspec/spec/matchers/have_private_method_spec.rb44
-rw-r--r--spec/mspec/spec/matchers/have_protected_instance_method_spec.rb57
-rw-r--r--spec/mspec/spec/matchers/have_public_instance_method_spec.rb53
-rw-r--r--spec/mspec/spec/matchers/have_singleton_method_spec.rb45
-rw-r--r--spec/mspec/spec/matchers/include_any_of_spec.rb42
-rw-r--r--spec/mspec/spec/matchers/include_spec.rb37
-rw-r--r--spec/mspec/spec/matchers/infinity_spec.rb34
-rw-r--r--spec/mspec/spec/matchers/match_yaml_spec.rb39
-rw-r--r--spec/mspec/spec/matchers/output_spec.rb84
-rw-r--r--spec/mspec/spec/matchers/output_to_fd_spec.rb44
-rw-r--r--spec/mspec/spec/matchers/raise_error_spec.rb183
-rw-r--r--spec/mspec/spec/matchers/respond_to_spec.rb33
-rw-r--r--spec/mspec/spec/matchers/signed_zero_spec.rb32
-rw-r--r--spec/mspec/spec/mocks/mock_spec.rb529
-rw-r--r--spec/mspec/spec/mocks/proxy_spec.rb405
-rw-r--r--spec/mspec/spec/runner/actions/filter_spec.rb84
-rw-r--r--spec/mspec/spec/runner/actions/tag_spec.rb313
-rw-r--r--spec/mspec/spec/runner/actions/taglist_spec.rb152
-rw-r--r--spec/mspec/spec/runner/actions/tagpurge_spec.rb154
-rw-r--r--spec/mspec/spec/runner/actions/tally_spec.rb355
-rw-r--r--spec/mspec/spec/runner/actions/timer_spec.rb44
-rw-r--r--spec/mspec/spec/runner/context_spec.rb1028
-rw-r--r--spec/mspec/spec/runner/example_spec.rb117
-rw-r--r--spec/mspec/spec/runner/exception_spec.rb146
-rw-r--r--spec/mspec/spec/runner/filters/a.yaml4
-rw-r--r--spec/mspec/spec/runner/filters/b.yaml11
-rw-r--r--spec/mspec/spec/runner/filters/match_spec.rb34
-rw-r--r--spec/mspec/spec/runner/filters/profile_spec.rb117
-rw-r--r--spec/mspec/spec/runner/filters/regexp_spec.rb31
-rw-r--r--spec/mspec/spec/runner/filters/tag_spec.rb92
-rw-r--r--spec/mspec/spec/runner/formatters/describe_spec.rb67
-rw-r--r--spec/mspec/spec/runner/formatters/dotted_spec.rb284
-rw-r--r--spec/mspec/spec/runner/formatters/file_spec.rb84
-rw-r--r--spec/mspec/spec/runner/formatters/html_spec.rb220
-rw-r--r--spec/mspec/spec/runner/formatters/junit_spec.rb159
-rw-r--r--spec/mspec/spec/runner/formatters/method_spec.rb177
-rw-r--r--spec/mspec/spec/runner/formatters/multi_spec.rb68
-rw-r--r--spec/mspec/spec/runner/formatters/specdoc_spec.rb106
-rw-r--r--spec/mspec/spec/runner/formatters/spinner_spec.rb83
-rw-r--r--spec/mspec/spec/runner/formatters/summary_spec.rb26
-rw-r--r--spec/mspec/spec/runner/formatters/unit_spec.rb73
-rw-r--r--spec/mspec/spec/runner/formatters/yaml_spec.rb134
-rw-r--r--spec/mspec/spec/runner/mspec_spec.rb597
-rw-r--r--spec/mspec/spec/runner/shared_spec.rb90
-rw-r--r--spec/mspec/spec/runner/tag_spec.rb123
-rw-r--r--spec/mspec/spec/runner/tags.txt4
-rw-r--r--spec/mspec/spec/spec_helper.rb70
-rw-r--r--spec/mspec/spec/utils/deprecate_spec.rb17
-rw-r--r--spec/mspec/spec/utils/fixtures/this_file_raises.rb1
-rw-r--r--spec/mspec/spec/utils/fixtures/this_file_raises2.rb1
-rw-r--r--spec/mspec/spec/utils/name_map_spec.rb187
-rw-r--r--spec/mspec/spec/utils/options_spec.rb1302
-rw-r--r--spec/mspec/spec/utils/script_spec.rb470
-rw-r--r--spec/mspec/spec/utils/version_spec.rb45
-rwxr-xr-xspec/mspec/tool/check_require_spec_helper.rb34
-rwxr-xr-xspec/mspec/tool/find.rb10
-rwxr-xr-xspec/mspec/tool/pull-latest-mspec-spec26
-rwxr-xr-xspec/mspec/tool/remove_old_guards.rb138
-rw-r--r--spec/mspec/tool/sync/.gitignore4
-rw-r--r--spec/mspec/tool/sync/sync-rubyspec.rb265
-rwxr-xr-xspec/mspec/tool/tag_from_output.rb65
-rwxr-xr-xspec/mspec/tool/wrap_with_guard.rb28
-rw-r--r--spec/ruby/.gitignore5
-rw-r--r--spec/ruby/.mspec.constants236
-rw-r--r--spec/ruby/.rubocop.yml208
-rw-r--r--spec/ruby/.rubocop_todo.yml122
-rw-r--r--spec/ruby/CONTRIBUTING.md298
-rw-r--r--spec/ruby/LICENSE22
-rw-r--r--spec/ruby/README.md166
-rw-r--r--spec/ruby/TODO8
-rwxr-xr-xspec/ruby/bin/rubocop12
-rw-r--r--spec/ruby/command_line/backtrace_limit_spec.rb93
-rwxr-xr-xspec/ruby/command_line/dash_0_spec.rb13
-rw-r--r--spec/ruby/command_line/dash_a_spec.rb19
-rw-r--r--spec/ruby/command_line/dash_c_spec.rb13
-rw-r--r--spec/ruby/command_line/dash_d_spec.rb22
-rw-r--r--spec/ruby/command_line/dash_e_spec.rb41
-rw-r--r--spec/ruby/command_line/dash_encoding_spec.rb36
-rw-r--r--spec/ruby/command_line/dash_external_encoding_spec.rb15
-rw-r--r--spec/ruby/command_line/dash_internal_encoding_spec.rb15
-rw-r--r--spec/ruby/command_line/dash_l_spec.rb31
-rw-r--r--spec/ruby/command_line/dash_n_spec.rb36
-rw-r--r--spec/ruby/command_line/dash_p_spec.rb19
-rw-r--r--spec/ruby/command_line/dash_r_spec.rb31
-rw-r--r--spec/ruby/command_line/dash_s_spec.rb52
-rw-r--r--spec/ruby/command_line/dash_upper_c_spec.rb6
-rw-r--r--spec/ruby/command_line/dash_upper_e_spec.rb37
-rw-r--r--spec/ruby/command_line/dash_upper_f_spec.rb13
-rw-r--r--spec/ruby/command_line/dash_upper_i_spec.rb51
-rw-r--r--spec/ruby/command_line/dash_upper_k_spec.rb65
-rw-r--r--spec/ruby/command_line/dash_upper_s_spec.rb29
-rw-r--r--spec/ruby/command_line/dash_upper_u_spec.rb52
-rw-r--r--spec/ruby/command_line/dash_upper_w_spec.rb44
-rw-r--r--spec/ruby/command_line/dash_upper_x_spec.rb6
-rw-r--r--spec/ruby/command_line/dash_v_spec.rb15
-rw-r--r--spec/ruby/command_line/dash_w_spec.rb10
-rw-r--r--spec/ruby/command_line/dash_x_spec.rb21
-rw-r--r--spec/ruby/command_line/error_message_spec.rb11
-rw-r--r--spec/ruby/command_line/feature_spec.rb71
-rw-r--r--spec/ruby/command_line/fixtures/backtrace.rb35
-rw-r--r--spec/ruby/command_line/fixtures/bad_syntax.rb1
-rw-r--r--spec/ruby/command_line/fixtures/bin/bad_embedded_ruby.txt3
-rw-r--r--spec/ruby/command_line/fixtures/bin/dash_s_fail1
-rw-r--r--spec/ruby/command_line/fixtures/bin/embedded_ruby.txt3
-rw-r--r--spec/ruby/command_line/fixtures/bin/hybrid_launcher.sh4
-rwxr-xr-xspec/ruby/command_line/fixtures/bin/launcher.rb2
-rw-r--r--spec/ruby/command_line/fixtures/change_directory_script.rb1
-rw-r--r--spec/ruby/command_line/fixtures/conditional_range.txt5
-rw-r--r--spec/ruby/command_line/fixtures/dash_s_script.rb12
-rw-r--r--spec/ruby/command_line/fixtures/debug.rb10
-rw-r--r--spec/ruby/command_line/fixtures/debug_info.rb10
-rw-r--r--spec/ruby/command_line/fixtures/freeze_flag_across_files.rb3
-rw-r--r--spec/ruby/command_line/fixtures/freeze_flag_across_files_diff_enc.rb3
-rw-r--r--spec/ruby/command_line/fixtures/freeze_flag_one_literal.rb2
-rw-r--r--spec/ruby/command_line/fixtures/freeze_flag_required.rb1
-rw-r--r--spec/ruby/command_line/fixtures/freeze_flag_required_diff_enc.rb3
-rw-r--r--spec/ruby/command_line/fixtures/freeze_flag_two_literals.rb1
-rw-r--r--spec/ruby/command_line/fixtures/full_names.txt3
-rw-r--r--spec/ruby/command_line/fixtures/loadpath.rb1
-rw-r--r--spec/ruby/command_line/fixtures/names.txt3
-rw-r--r--spec/ruby/command_line/fixtures/passwd_file.txt3
-rw-r--r--spec/ruby/command_line/fixtures/require.rb1
-rw-r--r--spec/ruby/command_line/fixtures/rubyopt.rb1
-rw-r--r--spec/ruby/command_line/fixtures/string_literal_frozen_comment.rb4
-rw-r--r--spec/ruby/command_line/fixtures/string_literal_mutable_comment.rb4
-rw-r--r--spec/ruby/command_line/fixtures/string_literal_raw.rb3
-rw-r--r--spec/ruby/command_line/fixtures/test_file.rb1
-rw-r--r--spec/ruby/command_line/fixtures/verbose.rb1
-rw-r--r--spec/ruby/command_line/frozen_strings_spec.rb94
-rw-r--r--spec/ruby/command_line/rubylib_spec.rb69
-rw-r--r--spec/ruby/command_line/rubyopt_spec.rb185
-rw-r--r--spec/ruby/command_line/shared/change_directory.rb21
-rw-r--r--spec/ruby/command_line/shared/verbose.rb9
-rw-r--r--spec/ruby/command_line/syntax_error_spec.rb19
-rw-r--r--spec/ruby/core/argf/argf_spec.rb11
-rw-r--r--spec/ruby/core/argf/argv_spec.rb19
-rw-r--r--spec/ruby/core/argf/binmode_spec.rb43
-rw-r--r--spec/ruby/core/argf/close_spec.rb35
-rw-r--r--spec/ruby/core/argf/closed_spec.rb18
-rw-r--r--spec/ruby/core/argf/each_byte_spec.rb6
-rw-r--r--spec/ruby/core/argf/each_char_spec.rb6
-rw-r--r--spec/ruby/core/argf/each_codepoint_spec.rb6
-rw-r--r--spec/ruby/core/argf/each_line_spec.rb6
-rw-r--r--spec/ruby/core/argf/each_spec.rb6
-rw-r--r--spec/ruby/core/argf/eof_spec.rb10
-rw-r--r--spec/ruby/core/argf/file_spec.rb21
-rw-r--r--spec/ruby/core/argf/filename_spec.rb6
-rw-r--r--spec/ruby/core/argf/fileno_spec.rb6
-rw-r--r--spec/ruby/core/argf/fixtures/bin_file.txt2
-rw-r--r--spec/ruby/core/argf/fixtures/file1.txt2
-rw-r--r--spec/ruby/core/argf/fixtures/file2.txt2
-rw-r--r--spec/ruby/core/argf/fixtures/filename.rb3
-rw-r--r--spec/ruby/core/argf/fixtures/lineno.rb5
-rw-r--r--spec/ruby/core/argf/fixtures/rewind.rb5
-rw-r--r--spec/ruby/core/argf/fixtures/stdin.txt2
-rw-r--r--spec/ruby/core/argf/getc_spec.rb20
-rw-r--r--spec/ruby/core/argf/gets_spec.rb49
-rw-r--r--spec/ruby/core/argf/lineno_spec.rb30
-rw-r--r--spec/ruby/core/argf/path_spec.rb6
-rw-r--r--spec/ruby/core/argf/pos_spec.rb38
-rw-r--r--spec/ruby/core/argf/read_nonblock_spec.rb80
-rw-r--r--spec/ruby/core/argf/read_spec.rb85
-rw-r--r--spec/ruby/core/argf/readchar_spec.rb19
-rw-r--r--spec/ruby/core/argf/readline_spec.rb23
-rw-r--r--spec/ruby/core/argf/readlines_spec.rb6
-rw-r--r--spec/ruby/core/argf/readpartial_spec.rb75
-rw-r--r--spec/ruby/core/argf/rewind_spec.rb39
-rw-r--r--spec/ruby/core/argf/seek_spec.rb63
-rw-r--r--spec/ruby/core/argf/set_encoding_spec.rb41
-rw-r--r--spec/ruby/core/argf/shared/each_byte.rb58
-rw-r--r--spec/ruby/core/argf/shared/each_char.rb58
-rw-r--r--spec/ruby/core/argf/shared/each_codepoint.rb58
-rw-r--r--spec/ruby/core/argf/shared/each_line.rb62
-rw-r--r--spec/ruby/core/argf/shared/eof.rb24
-rw-r--r--spec/ruby/core/argf/shared/filename.rb28
-rw-r--r--spec/ruby/core/argf/shared/fileno.rb24
-rw-r--r--spec/ruby/core/argf/shared/getc.rb17
-rw-r--r--spec/ruby/core/argf/shared/gets.rb99
-rw-r--r--spec/ruby/core/argf/shared/pos.rb31
-rw-r--r--spec/ruby/core/argf/shared/read.rb58
-rw-r--r--spec/ruby/core/argf/shared/readlines.rb22
-rw-r--r--spec/ruby/core/argf/skip_spec.rb42
-rw-r--r--spec/ruby/core/argf/tell_spec.rb6
-rw-r--r--spec/ruby/core/argf/to_a_spec.rb6
-rw-r--r--spec/ruby/core/argf/to_i_spec.rb6
-rw-r--r--spec/ruby/core/argf/to_io_spec.rb23
-rw-r--r--spec/ruby/core/argf/to_s_spec.rb14
-rw-r--r--spec/ruby/core/array/all_spec.rb13
-rw-r--r--spec/ruby/core/array/allocate_spec.rb19
-rw-r--r--spec/ruby/core/array/any_spec.rb49
-rw-r--r--spec/ruby/core/array/append_spec.rb40
-rw-r--r--spec/ruby/core/array/array_spec.rb7
-rw-r--r--spec/ruby/core/array/assoc_spec.rb52
-rw-r--r--spec/ruby/core/array/at_spec.rb56
-rw-r--r--spec/ruby/core/array/bsearch_index_spec.rb81
-rw-r--r--spec/ruby/core/array/bsearch_spec.rb84
-rw-r--r--spec/ruby/core/array/clear_spec.rb32
-rw-r--r--spec/ruby/core/array/clone_spec.rb31
-rw-r--r--spec/ruby/core/array/collect_spec.rb11
-rw-r--r--spec/ruby/core/array/combination_spec.rb74
-rw-r--r--spec/ruby/core/array/compact_spec.rb51
-rw-r--r--spec/ruby/core/array/comparison_spec.rb97
-rw-r--r--spec/ruby/core/array/concat_spec.rb74
-rw-r--r--spec/ruby/core/array/constructor_spec.rb24
-rw-r--r--spec/ruby/core/array/count_spec.rb26
-rw-r--r--spec/ruby/core/array/cycle_spec.rb101
-rw-r--r--spec/ruby/core/array/deconstruct_spec.rb9
-rw-r--r--spec/ruby/core/array/delete_at_spec.rb41
-rw-r--r--spec/ruby/core/array/delete_if_spec.rb82
-rw-r--r--spec/ruby/core/array/delete_spec.rb46
-rw-r--r--spec/ruby/core/array/difference_spec.rb22
-rw-r--r--spec/ruby/core/array/dig_spec.rb52
-rw-r--r--spec/ruby/core/array/drop_spec.rb56
-rw-r--r--spec/ruby/core/array/drop_while_spec.rb24
-rw-r--r--spec/ruby/core/array/dup_spec.rb31
-rw-r--r--spec/ruby/core/array/each_index_spec.rb58
-rw-r--r--spec/ruby/core/array/each_spec.rb82
-rw-r--r--spec/ruby/core/array/element_reference_spec.rb50
-rw-r--r--spec/ruby/core/array/element_set_spec.rb537
-rw-r--r--spec/ruby/core/array/empty_spec.rb10
-rw-r--r--spec/ruby/core/array/eql_spec.rb19
-rw-r--r--spec/ruby/core/array/equal_value_spec.rb51
-rw-r--r--spec/ruby/core/array/fetch_spec.rb55
-rw-r--r--spec/ruby/core/array/fetch_values_spec.rb55
-rw-r--r--spec/ruby/core/array/fill_spec.rb374
-rw-r--r--spec/ruby/core/array/filter_spec.rb14
-rw-r--r--spec/ruby/core/array/find_index_spec.rb6
-rw-r--r--spec/ruby/core/array/first_spec.rb93
-rw-r--r--spec/ruby/core/array/fixtures/classes.rb592
-rw-r--r--spec/ruby/core/array/fixtures/encoded_strings.rb69
-rw-r--r--spec/ruby/core/array/flatten_spec.rb266
-rw-r--r--spec/ruby/core/array/frozen_spec.rb16
-rw-r--r--spec/ruby/core/array/hash_spec.rb83
-rw-r--r--spec/ruby/core/array/include_spec.rb33
-rw-r--r--spec/ruby/core/array/index_spec.rb6
-rw-r--r--spec/ruby/core/array/initialize_spec.rb158
-rw-r--r--spec/ruby/core/array/insert_spec.rb78
-rw-r--r--spec/ruby/core/array/inspect_spec.rb7
-rw-r--r--spec/ruby/core/array/intersect_spec.rb64
-rw-r--r--spec/ruby/core/array/intersection_spec.rb19
-rw-r--r--spec/ruby/core/array/join_spec.rb50
-rw-r--r--spec/ruby/core/array/keep_if_spec.rb11
-rw-r--r--spec/ruby/core/array/last_spec.rb87
-rw-r--r--spec/ruby/core/array/length_spec.rb7
-rw-r--r--spec/ruby/core/array/map_spec.rb11
-rw-r--r--spec/ruby/core/array/max_spec.rb116
-rw-r--r--spec/ruby/core/array/min_spec.rb121
-rw-r--r--spec/ruby/core/array/minmax_spec.rb14
-rw-r--r--spec/ruby/core/array/minus_spec.rb7
-rw-r--r--spec/ruby/core/array/multiply_spec.rb94
-rw-r--r--spec/ruby/core/array/new_spec.rb124
-rw-r--r--spec/ruby/core/array/none_spec.rb13
-rw-r--r--spec/ruby/core/array/one_spec.rb13
-rw-r--r--spec/ruby/core/array/pack/a_spec.rb73
-rw-r--r--spec/ruby/core/array/pack/at_spec.rb30
-rw-r--r--spec/ruby/core/array/pack/b_spec.rb113
-rw-r--r--spec/ruby/core/array/pack/buffer_spec.rb60
-rw-r--r--spec/ruby/core/array/pack/c_spec.rb87
-rw-r--r--spec/ruby/core/array/pack/comment_spec.rb25
-rw-r--r--spec/ruby/core/array/pack/d_spec.rb39
-rw-r--r--spec/ruby/core/array/pack/e_spec.rb25
-rw-r--r--spec/ruby/core/array/pack/empty_spec.rb11
-rw-r--r--spec/ruby/core/array/pack/f_spec.rb39
-rw-r--r--spec/ruby/core/array/pack/g_spec.rb25
-rw-r--r--spec/ruby/core/array/pack/h_spec.rb205
-rw-r--r--spec/ruby/core/array/pack/i_spec.rb133
-rw-r--r--spec/ruby/core/array/pack/j_spec.rb217
-rw-r--r--spec/ruby/core/array/pack/l_spec.rb221
-rw-r--r--spec/ruby/core/array/pack/m_spec.rb317
-rw-r--r--spec/ruby/core/array/pack/n_spec.rb25
-rw-r--r--spec/ruby/core/array/pack/p_spec.rb38
-rw-r--r--spec/ruby/core/array/pack/percent_spec.rb7
-rw-r--r--spec/ruby/core/array/pack/q_spec.rb61
-rw-r--r--spec/ruby/core/array/pack/s_spec.rb133
-rw-r--r--spec/ruby/core/array/pack/shared/basic.rb84
-rw-r--r--spec/ruby/core/array/pack/shared/encodings.rb16
-rw-r--r--spec/ruby/core/array/pack/shared/float.rb295
-rw-r--r--spec/ruby/core/array/pack/shared/integer.rb453
-rw-r--r--spec/ruby/core/array/pack/shared/numeric_basic.rb50
-rw-r--r--spec/ruby/core/array/pack/shared/string.rb48
-rw-r--r--spec/ruby/core/array/pack/shared/taint.rb2
-rw-r--r--spec/ruby/core/array/pack/shared/unicode.rb106
-rw-r--r--spec/ruby/core/array/pack/u_spec.rb140
-rw-r--r--spec/ruby/core/array/pack/v_spec.rb25
-rw-r--r--spec/ruby/core/array/pack/w_spec.rb54
-rw-r--r--spec/ruby/core/array/pack/x_spec.rb65
-rw-r--r--spec/ruby/core/array/pack/z_spec.rb44
-rw-r--r--spec/ruby/core/array/partition_spec.rb43
-rw-r--r--spec/ruby/core/array/permutation_spec.rb138
-rw-r--r--spec/ruby/core/array/plus_spec.rb56
-rw-r--r--spec/ruby/core/array/pop_spec.rb124
-rw-r--r--spec/ruby/core/array/prepend_spec.rb7
-rw-r--r--spec/ruby/core/array/product_spec.rb73
-rw-r--r--spec/ruby/core/array/push_spec.rb7
-rw-r--r--spec/ruby/core/array/rassoc_spec.rb52
-rw-r--r--spec/ruby/core/array/reject_spec.rb158
-rw-r--r--spec/ruby/core/array/repeated_combination_spec.rb84
-rw-r--r--spec/ruby/core/array/repeated_permutation_spec.rb94
-rw-r--r--spec/ruby/core/array/replace_spec.rb7
-rw-r--r--spec/ruby/core/array/reverse_each_spec.rb57
-rw-r--r--spec/ruby/core/array/reverse_spec.rb42
-rw-r--r--spec/ruby/core/array/rindex_spec.rb95
-rw-r--r--spec/ruby/core/array/rotate_spec.rb129
-rw-r--r--spec/ruby/core/array/sample_spec.rb155
-rw-r--r--spec/ruby/core/array/select_spec.rb14
-rw-r--r--spec/ruby/core/array/shared/clone.rb20
-rw-r--r--spec/ruby/core/array/shared/collect.rb141
-rw-r--r--spec/ruby/core/array/shared/delete_if.rb13
-rw-r--r--spec/ruby/core/array/shared/difference.rb78
-rw-r--r--spec/ruby/core/array/shared/enumeratorize.rb5
-rw-r--r--spec/ruby/core/array/shared/eql.rb92
-rw-r--r--spec/ruby/core/array/shared/index.rb41
-rw-r--r--spec/ruby/core/array/shared/inspect.rb107
-rw-r--r--spec/ruby/core/array/shared/intersection.rb85
-rw-r--r--spec/ruby/core/array/shared/iterable_and_tolerating_size_increasing.rb25
-rw-r--r--spec/ruby/core/array/shared/join.rb112
-rw-r--r--spec/ruby/core/array/shared/keep_if.rb95
-rw-r--r--spec/ruby/core/array/shared/length.rb11
-rw-r--r--spec/ruby/core/array/shared/push.rb33
-rw-r--r--spec/ruby/core/array/shared/replace.rb60
-rw-r--r--spec/ruby/core/array/shared/select.rb35
-rw-r--r--spec/ruby/core/array/shared/slice.rb857
-rw-r--r--spec/ruby/core/array/shared/union.rb79
-rw-r--r--spec/ruby/core/array/shared/unshift.rb64
-rw-r--r--spec/ruby/core/array/shift_spec.rb120
-rw-r--r--spec/ruby/core/array/shuffle_spec.rb119
-rw-r--r--spec/ruby/core/array/size_spec.rb7
-rw-r--r--spec/ruby/core/array/slice_spec.rb218
-rw-r--r--spec/ruby/core/array/sort_by_spec.rb85
-rw-r--r--spec/ruby/core/array/sort_spec.rb252
-rw-r--r--spec/ruby/core/array/sum_spec.rb90
-rw-r--r--spec/ruby/core/array/take_spec.rb32
-rw-r--r--spec/ruby/core/array/take_while_spec.rb26
-rw-r--r--spec/ruby/core/array/to_a_spec.rb24
-rw-r--r--spec/ruby/core/array/to_ary_spec.rb20
-rw-r--r--spec/ruby/core/array/to_h_spec.rb91
-rw-r--r--spec/ruby/core/array/to_s_spec.rb8
-rw-r--r--spec/ruby/core/array/transpose_spec.rb53
-rw-r--r--spec/ruby/core/array/try_convert_spec.rb50
-rw-r--r--spec/ruby/core/array/union_spec.rb25
-rw-r--r--spec/ruby/core/array/uniq_spec.rb243
-rw-r--r--spec/ruby/core/array/unshift_spec.rb7
-rw-r--r--spec/ruby/core/array/values_at_spec.rb74
-rw-r--r--spec/ruby/core/array/zip_spec.rb71
-rw-r--r--spec/ruby/core/basicobject/__id__spec.rb6
-rw-r--r--spec/ruby/core/basicobject/__send___spec.rb10
-rw-r--r--spec/ruby/core/basicobject/basicobject_spec.rb91
-rw-r--r--spec/ruby/core/basicobject/equal_spec.rb54
-rw-r--r--spec/ruby/core/basicobject/equal_value_spec.rb10
-rw-r--r--spec/ruby/core/basicobject/fixtures/classes.rb255
-rw-r--r--spec/ruby/core/basicobject/fixtures/common.rb9
-rw-r--r--spec/ruby/core/basicobject/fixtures/remove_method_missing.rb9
-rw-r--r--spec/ruby/core/basicobject/fixtures/singleton_method.rb10
-rw-r--r--spec/ruby/core/basicobject/initialize_spec.rb13
-rw-r--r--spec/ruby/core/basicobject/instance_eval_spec.rb329
-rw-r--r--spec/ruby/core/basicobject/instance_exec_spec.rb107
-rw-r--r--spec/ruby/core/basicobject/method_missing_spec.rb40
-rw-r--r--spec/ruby/core/basicobject/not_equal_spec.rb53
-rw-r--r--spec/ruby/core/basicobject/not_spec.rb11
-rw-r--r--spec/ruby/core/basicobject/singleton_method_added_spec.rb147
-rw-r--r--spec/ruby/core/basicobject/singleton_method_removed_spec.rb24
-rw-r--r--spec/ruby/core/basicobject/singleton_method_undefined_spec.rb24
-rw-r--r--spec/ruby/core/binding/clone_spec.rb13
-rw-r--r--spec/ruby/core/binding/dup_spec.rb30
-rw-r--r--spec/ruby/core/binding/eval_spec.rb115
-rw-r--r--spec/ruby/core/binding/fixtures/classes.rb66
-rw-r--r--spec/ruby/core/binding/fixtures/location.rb6
-rw-r--r--spec/ruby/core/binding/local_variable_defined_spec.rb46
-rw-r--r--spec/ruby/core/binding/local_variable_get_spec.rb56
-rw-r--r--spec/ruby/core/binding/local_variable_set_spec.rb71
-rw-r--r--spec/ruby/core/binding/local_variables_spec.rb35
-rw-r--r--spec/ruby/core/binding/receiver_spec.rb11
-rw-r--r--spec/ruby/core/binding/shared/clone.rb56
-rw-r--r--spec/ruby/core/binding/source_location_spec.rb14
-rw-r--r--spec/ruby/core/builtin_constants/builtin_constants_spec.rb151
-rw-r--r--spec/ruby/core/class/allocate_spec.rb41
-rw-r--r--spec/ruby/core/class/attached_object_spec.rb29
-rw-r--r--spec/ruby/core/class/dup_spec.rb69
-rw-r--r--spec/ruby/core/class/fixtures/classes.rb47
-rw-r--r--spec/ruby/core/class/inherited_spec.rb118
-rw-r--r--spec/ruby/core/class/initialize_spec.rb34
-rw-r--r--spec/ruby/core/class/new_spec.rb157
-rw-r--r--spec/ruby/core/class/subclasses_spec.rb85
-rw-r--r--spec/ruby/core/class/superclass_spec.rb27
-rw-r--r--spec/ruby/core/comparable/between_spec.rb25
-rw-r--r--spec/ruby/core/comparable/clamp_spec.rb223
-rw-r--r--spec/ruby/core/comparable/equal_value_spec.rb114
-rw-r--r--spec/ruby/core/comparable/fixtures/classes.rb37
-rw-r--r--spec/ruby/core/comparable/gt_spec.rb43
-rw-r--r--spec/ruby/core/comparable/gte_spec.rb47
-rw-r--r--spec/ruby/core/comparable/lt_spec.rb49
-rw-r--r--spec/ruby/core/comparable/lte_spec.rb46
-rw-r--r--spec/ruby/core/complex/abs2_spec.rb9
-rw-r--r--spec/ruby/core/complex/abs_spec.rb6
-rw-r--r--spec/ruby/core/complex/angle_spec.rb6
-rw-r--r--spec/ruby/core/complex/arg_spec.rb6
-rw-r--r--spec/ruby/core/complex/coerce_spec.rb70
-rw-r--r--spec/ruby/core/complex/comparison_spec.rb25
-rw-r--r--spec/ruby/core/complex/conj_spec.rb6
-rw-r--r--spec/ruby/core/complex/conjugate_spec.rb6
-rw-r--r--spec/ruby/core/complex/constants_spec.rb7
-rw-r--r--spec/ruby/core/complex/denominator_spec.rb13
-rw-r--r--spec/ruby/core/complex/divide_spec.rb6
-rw-r--r--spec/ruby/core/complex/eql_spec.rb31
-rw-r--r--spec/ruby/core/complex/equal_value_spec.rb93
-rw-r--r--spec/ruby/core/complex/exponent_spec.rb61
-rw-r--r--spec/ruby/core/complex/fdiv_spec.rb129
-rw-r--r--spec/ruby/core/complex/finite_spec.rb32
-rw-r--r--spec/ruby/core/complex/hash_spec.rb16
-rw-r--r--spec/ruby/core/complex/imag_spec.rb6
-rw-r--r--spec/ruby/core/complex/imaginary_spec.rb6
-rw-r--r--spec/ruby/core/complex/infinite_spec.rb32
-rw-r--r--spec/ruby/core/complex/inspect_spec.rb37
-rw-r--r--spec/ruby/core/complex/integer_spec.rb11
-rw-r--r--spec/ruby/core/complex/magnitude_spec.rb6
-rw-r--r--spec/ruby/core/complex/marshal_dump_spec.rb11
-rw-r--r--spec/ruby/core/complex/minus_spec.rb45
-rw-r--r--spec/ruby/core/complex/multiply_spec.rb49
-rw-r--r--spec/ruby/core/complex/negative_spec.rb13
-rw-r--r--spec/ruby/core/complex/numerator_spec.rb19
-rw-r--r--spec/ruby/core/complex/phase_spec.rb6
-rw-r--r--spec/ruby/core/complex/plus_spec.rb45
-rw-r--r--spec/ruby/core/complex/polar_spec.rb41
-rw-r--r--spec/ruby/core/complex/positive_spec.rb13
-rw-r--r--spec/ruby/core/complex/quo_spec.rb6
-rw-r--r--spec/ruby/core/complex/rationalize_spec.rb31
-rw-r--r--spec/ruby/core/complex/real_spec.rb28
-rw-r--r--spec/ruby/core/complex/rect_spec.rb10
-rw-r--r--spec/ruby/core/complex/rectangular_spec.rb10
-rw-r--r--spec/ruby/core/complex/shared/abs.rb10
-rw-r--r--spec/ruby/core/complex/shared/arg.rb9
-rw-r--r--spec/ruby/core/complex/shared/conjugate.rb8
-rw-r--r--spec/ruby/core/complex/shared/divide.rb82
-rw-r--r--spec/ruby/core/complex/shared/image.rb8
-rw-r--r--spec/ruby/core/complex/shared/rect.rb94
-rw-r--r--spec/ruby/core/complex/to_c_spec.rb12
-rw-r--r--spec/ruby/core/complex/to_f_spec.rb41
-rw-r--r--spec/ruby/core/complex/to_i_spec.rb41
-rw-r--r--spec/ruby/core/complex/to_r_spec.rb49
-rw-r--r--spec/ruby/core/complex/to_s_spec.rb55
-rw-r--r--spec/ruby/core/complex/uminus_spec.rb11
-rw-r--r--spec/ruby/core/conditionvariable/broadcast_spec.rb39
-rw-r--r--spec/ruby/core/conditionvariable/marshal_dump_spec.rb8
-rw-r--r--spec/ruby/core/conditionvariable/signal_spec.rb76
-rw-r--r--spec/ruby/core/conditionvariable/wait_spec.rb174
-rw-r--r--spec/ruby/core/data/constants_spec.rb11
-rw-r--r--spec/ruby/core/data/deconstruct_keys_spec.rb130
-rw-r--r--spec/ruby/core/data/deconstruct_spec.rb8
-rw-r--r--spec/ruby/core/data/define_spec.rb34
-rw-r--r--spec/ruby/core/data/eql_spec.rb63
-rw-r--r--spec/ruby/core/data/equal_value_spec.rb63
-rw-r--r--spec/ruby/core/data/fixtures/classes.rb34
-rw-r--r--spec/ruby/core/data/hash_spec.rb25
-rw-r--r--spec/ruby/core/data/initialize_spec.rb124
-rw-r--r--spec/ruby/core/data/inspect_spec.rb6
-rw-r--r--spec/ruby/core/data/members_spec.rb21
-rw-r--r--spec/ruby/core/data/shared/inspect.rb62
-rw-r--r--spec/ruby/core/data/to_h_spec.rb63
-rw-r--r--spec/ruby/core/data/to_s_spec.rb6
-rw-r--r--spec/ruby/core/data/with_spec.rb57
-rw-r--r--spec/ruby/core/dir/chdir_spec.rb220
-rw-r--r--spec/ruby/core/dir/children_spec.rb147
-rw-r--r--spec/ruby/core/dir/chroot_spec.rb47
-rw-r--r--spec/ruby/core/dir/close_spec.rb53
-rw-r--r--spec/ruby/core/dir/delete_spec.rb15
-rw-r--r--spec/ruby/core/dir/dir_spec.rb7
-rw-r--r--spec/ruby/core/dir/each_child_spec.rb119
-rw-r--r--spec/ruby/core/dir/each_spec.rb75
-rw-r--r--spec/ruby/core/dir/element_reference_spec.rb33
-rw-r--r--spec/ruby/core/dir/empty_spec.rb31
-rw-r--r--spec/ruby/core/dir/entries_spec.rb70
-rw-r--r--spec/ruby/core/dir/exist_spec.rb21
-rw-r--r--spec/ruby/core/dir/fchdir_spec.rb73
-rw-r--r--spec/ruby/core/dir/fileno_spec.rb37
-rw-r--r--spec/ruby/core/dir/fixtures/common.rb198
-rw-r--r--spec/ruby/core/dir/for_fd_spec.rb79
-rw-r--r--spec/ruby/core/dir/foreach_spec.rb68
-rw-r--r--spec/ruby/core/dir/getwd_spec.rb15
-rw-r--r--spec/ruby/core/dir/glob_spec.rb362
-rw-r--r--spec/ruby/core/dir/home_spec.rb85
-rw-r--r--spec/ruby/core/dir/initialize_spec.rb23
-rw-r--r--spec/ruby/core/dir/inspect_spec.rb24
-rw-r--r--spec/ruby/core/dir/mkdir_spec.rb107
-rw-r--r--spec/ruby/core/dir/open_spec.rb15
-rw-r--r--spec/ruby/core/dir/path_spec.rb15
-rw-r--r--spec/ruby/core/dir/pos_spec.rb40
-rw-r--r--spec/ruby/core/dir/pwd_spec.rb39
-rw-r--r--spec/ruby/core/dir/read_spec.rb76
-rw-r--r--spec/ruby/core/dir/rewind_spec.rb36
-rw-r--r--spec/ruby/core/dir/rmdir_spec.rb15
-rw-r--r--spec/ruby/core/dir/seek_spec.rb19
-rw-r--r--spec/ruby/core/dir/shared/chroot.rb44
-rw-r--r--spec/ruby/core/dir/shared/closed.rb9
-rw-r--r--spec/ruby/core/dir/shared/delete.rb53
-rw-r--r--spec/ruby/core/dir/shared/exist.rb57
-rw-r--r--spec/ruby/core/dir/shared/glob.rb441
-rw-r--r--spec/ruby/core/dir/shared/open.rb73
-rw-r--r--spec/ruby/core/dir/shared/path.rb30
-rw-r--r--spec/ruby/core/dir/shared/pos.rb51
-rw-r--r--spec/ruby/core/dir/shared/pwd.rb45
-rw-r--r--spec/ruby/core/dir/tell_spec.rb18
-rw-r--r--spec/ruby/core/dir/to_path_spec.rb15
-rw-r--r--spec/ruby/core/dir/unlink_spec.rb15
-rw-r--r--spec/ruby/core/encoding/_dump_spec.rb5
-rw-r--r--spec/ruby/core/encoding/_load_spec.rb5
-rw-r--r--spec/ruby/core/encoding/aliases_spec.rb43
-rw-r--r--spec/ruby/core/encoding/ascii_compatible_spec.rb11
-rw-r--r--spec/ruby/core/encoding/compatible_spec.rb758
-rw-r--r--spec/ruby/core/encoding/converter/asciicompat_encoding_spec.rb37
-rw-r--r--spec/ruby/core/encoding/converter/constants_spec.rb131
-rw-r--r--spec/ruby/core/encoding/converter/convert_spec.rb46
-rw-r--r--spec/ruby/core/encoding/converter/convpath_spec.rb24
-rw-r--r--spec/ruby/core/encoding/converter/destination_encoding_spec.rb11
-rw-r--r--spec/ruby/core/encoding/converter/finish_spec.rb36
-rw-r--r--spec/ruby/core/encoding/converter/insert_output_spec.rb5
-rw-r--r--spec/ruby/core/encoding/converter/inspect_spec.rb13
-rw-r--r--spec/ruby/core/encoding/converter/last_error_spec.rb91
-rw-r--r--spec/ruby/core/encoding/converter/new_spec.rb119
-rw-r--r--spec/ruby/core/encoding/converter/primitive_convert_spec.rb216
-rw-r--r--spec/ruby/core/encoding/converter/primitive_errinfo_spec.rb69
-rw-r--r--spec/ruby/core/encoding/converter/putback_spec.rb56
-rw-r--r--spec/ruby/core/encoding/converter/replacement_spec.rb72
-rw-r--r--spec/ruby/core/encoding/converter/search_convpath_spec.rb30
-rw-r--r--spec/ruby/core/encoding/converter/source_encoding_spec.rb11
-rw-r--r--spec/ruby/core/encoding/default_external_spec.rb69
-rw-r--r--spec/ruby/core/encoding/default_internal_spec.rb74
-rw-r--r--spec/ruby/core/encoding/dummy_spec.rb14
-rw-r--r--spec/ruby/core/encoding/find_spec.rb82
-rw-r--r--spec/ruby/core/encoding/fixtures/classes.rb49
-rw-r--r--spec/ruby/core/encoding/inspect_spec.rb33
-rw-r--r--spec/ruby/core/encoding/invalid_byte_sequence_error/destination_encoding_name_spec.rb19
-rw-r--r--spec/ruby/core/encoding/invalid_byte_sequence_error/destination_encoding_spec.rb19
-rw-r--r--spec/ruby/core/encoding/invalid_byte_sequence_error/error_bytes_spec.rb31
-rw-r--r--spec/ruby/core/encoding/invalid_byte_sequence_error/incomplete_input_spec.rb28
-rw-r--r--spec/ruby/core/encoding/invalid_byte_sequence_error/readagain_bytes_spec.rb31
-rw-r--r--spec/ruby/core/encoding/invalid_byte_sequence_error/source_encoding_name_spec.rb29
-rw-r--r--spec/ruby/core/encoding/invalid_byte_sequence_error/source_encoding_spec.rb34
-rw-r--r--spec/ruby/core/encoding/list_spec.rb49
-rw-r--r--spec/ruby/core/encoding/locale_charmap_spec.rb56
-rw-r--r--spec/ruby/core/encoding/name_list_spec.rb23
-rw-r--r--spec/ruby/core/encoding/name_spec.rb6
-rw-r--r--spec/ruby/core/encoding/names_spec.rb35
-rw-r--r--spec/ruby/core/encoding/replicate_spec.rb88
-rw-r--r--spec/ruby/core/encoding/shared/name.rb15
-rw-r--r--spec/ruby/core/encoding/to_s_spec.rb6
-rw-r--r--spec/ruby/core/encoding/undefined_conversion_error/destination_encoding_name_spec.rb16
-rw-r--r--spec/ruby/core/encoding/undefined_conversion_error/destination_encoding_spec.rb16
-rw-r--r--spec/ruby/core/encoding/undefined_conversion_error/error_char_spec.rb28
-rw-r--r--spec/ruby/core/encoding/undefined_conversion_error/source_encoding_name_spec.rb29
-rw-r--r--spec/ruby/core/encoding/undefined_conversion_error/source_encoding_spec.rb30
-rw-r--r--spec/ruby/core/enumerable/all_spec.rb187
-rw-r--r--spec/ruby/core/enumerable/any_spec.rb200
-rw-r--r--spec/ruby/core/enumerable/chain_spec.rb23
-rw-r--r--spec/ruby/core/enumerable/chunk_spec.rb77
-rw-r--r--spec/ruby/core/enumerable/chunk_while_spec.rb42
-rw-r--r--spec/ruby/core/enumerable/collect_concat_spec.rb7
-rw-r--r--spec/ruby/core/enumerable/collect_spec.rb7
-rw-r--r--spec/ruby/core/enumerable/compact_spec.rb9
-rw-r--r--spec/ruby/core/enumerable/count_spec.rb59
-rw-r--r--spec/ruby/core/enumerable/cycle_spec.rb104
-rw-r--r--spec/ruby/core/enumerable/detect_spec.rb7
-rw-r--r--spec/ruby/core/enumerable/drop_spec.rb43
-rw-r--r--spec/ruby/core/enumerable/drop_while_spec.rb50
-rw-r--r--spec/ruby/core/enumerable/each_cons_spec.rb103
-rw-r--r--spec/ruby/core/enumerable/each_entry_spec.rb41
-rw-r--r--spec/ruby/core/enumerable/each_slice_spec.rb105
-rw-r--r--spec/ruby/core/enumerable/each_with_index_spec.rb53
-rw-r--r--spec/ruby/core/enumerable/each_with_object_spec.rb41
-rw-r--r--spec/ruby/core/enumerable/entries_spec.rb7
-rw-r--r--spec/ruby/core/enumerable/filter_map_spec.rb24
-rw-r--r--spec/ruby/core/enumerable/filter_spec.rb7
-rw-r--r--spec/ruby/core/enumerable/find_all_spec.rb7
-rw-r--r--spec/ruby/core/enumerable/find_index_spec.rb89
-rw-r--r--spec/ruby/core/enumerable/find_spec.rb7
-rw-r--r--spec/ruby/core/enumerable/first_spec.rb28
-rw-r--r--spec/ruby/core/enumerable/fixtures/classes.rb350
-rw-r--r--spec/ruby/core/enumerable/flat_map_spec.rb7
-rw-r--r--spec/ruby/core/enumerable/grep_spec.rb87
-rw-r--r--spec/ruby/core/enumerable/grep_v_spec.rb76
-rw-r--r--spec/ruby/core/enumerable/group_by_spec.rb37
-rw-r--r--spec/ruby/core/enumerable/include_spec.rb7
-rw-r--r--spec/ruby/core/enumerable/inject_spec.rb7
-rw-r--r--spec/ruby/core/enumerable/lazy_spec.rb10
-rw-r--r--spec/ruby/core/enumerable/map_spec.rb7
-rw-r--r--spec/ruby/core/enumerable/max_by_spec.rb81
-rw-r--r--spec/ruby/core/enumerable/max_spec.rb119
-rw-r--r--spec/ruby/core/enumerable/member_spec.rb7
-rw-r--r--spec/ruby/core/enumerable/min_by_spec.rb81
-rw-r--r--spec/ruby/core/enumerable/min_spec.rb123
-rw-r--r--spec/ruby/core/enumerable/minmax_by_spec.rb44
-rw-r--r--spec/ruby/core/enumerable/minmax_spec.rb20
-rw-r--r--spec/ruby/core/enumerable/none_spec.rb153
-rw-r--r--spec/ruby/core/enumerable/one_spec.rb154
-rw-r--r--spec/ruby/core/enumerable/partition_spec.rb20
-rw-r--r--spec/ruby/core/enumerable/reduce_spec.rb7
-rw-r--r--spec/ruby/core/enumerable/reject_spec.rb25
-rw-r--r--spec/ruby/core/enumerable/reverse_each_spec.rb26
-rw-r--r--spec/ruby/core/enumerable/select_spec.rb7
-rw-r--r--spec/ruby/core/enumerable/shared/collect.rb107
-rw-r--r--spec/ruby/core/enumerable/shared/collect_concat.rb54
-rw-r--r--spec/ruby/core/enumerable/shared/entries.rb16
-rw-r--r--spec/ruby/core/enumerable/shared/enumerable_enumeratorized.rb33
-rw-r--r--spec/ruby/core/enumerable/shared/enumeratorized.rb42
-rw-r--r--spec/ruby/core/enumerable/shared/find.rb77
-rw-r--r--spec/ruby/core/enumerable/shared/find_all.rb31
-rw-r--r--spec/ruby/core/enumerable/shared/include.rb34
-rw-r--r--spec/ruby/core/enumerable/shared/inject.rb142
-rw-r--r--spec/ruby/core/enumerable/shared/take.rb63
-rw-r--r--spec/ruby/core/enumerable/slice_after_spec.rb61
-rw-r--r--spec/ruby/core/enumerable/slice_before_spec.rb64
-rw-r--r--spec/ruby/core/enumerable/slice_when_spec.rb54
-rw-r--r--spec/ruby/core/enumerable/sort_by_spec.rb43
-rw-r--r--spec/ruby/core/enumerable/sort_spec.rb54
-rw-r--r--spec/ruby/core/enumerable/sum_spec.rb50
-rw-r--r--spec/ruby/core/enumerable/take_spec.rb13
-rw-r--r--spec/ruby/core/enumerable/take_while_spec.rb51
-rw-r--r--spec/ruby/core/enumerable/tally_spec.rb91
-rw-r--r--spec/ruby/core/enumerable/to_a_spec.rb7
-rw-r--r--spec/ruby/core/enumerable/to_h_spec.rb96
-rw-r--r--spec/ruby/core/enumerable/to_set_spec.rb30
-rw-r--r--spec/ruby/core/enumerable/uniq_spec.rb78
-rw-r--r--spec/ruby/core/enumerable/zip_spec.rb46
-rw-r--r--spec/ruby/core/enumerator/arithmetic_sequence/begin_spec.rb16
-rw-r--r--spec/ruby/core/enumerator/arithmetic_sequence/each_spec.rb17
-rw-r--r--spec/ruby/core/enumerator/arithmetic_sequence/end_spec.rb16
-rw-r--r--spec/ruby/core/enumerator/arithmetic_sequence/eq_spec.rb18
-rw-r--r--spec/ruby/core/enumerator/arithmetic_sequence/exclude_end_spec.rb17
-rw-r--r--spec/ruby/core/enumerator/arithmetic_sequence/first_spec.rb9
-rw-r--r--spec/ruby/core/enumerator/arithmetic_sequence/hash_spec.rb20
-rw-r--r--spec/ruby/core/enumerator/arithmetic_sequence/inspect_spec.rb20
-rw-r--r--spec/ruby/core/enumerator/arithmetic_sequence/last_spec.rb9
-rw-r--r--spec/ruby/core/enumerator/arithmetic_sequence/new_spec.rb17
-rw-r--r--spec/ruby/core/enumerator/arithmetic_sequence/size_spec.rb17
-rw-r--r--spec/ruby/core/enumerator/arithmetic_sequence/step_spec.rb11
-rw-r--r--spec/ruby/core/enumerator/chain/each_spec.rb15
-rw-r--r--spec/ruby/core/enumerator/chain/initialize_spec.rb31
-rw-r--r--spec/ruby/core/enumerator/chain/inspect_spec.rb18
-rw-r--r--spec/ruby/core/enumerator/chain/rewind_spec.rb51
-rw-r--r--spec/ruby/core/enumerator/chain/size_spec.rb22
-rw-r--r--spec/ruby/core/enumerator/each_spec.rb89
-rw-r--r--spec/ruby/core/enumerator/each_with_index_spec.rb36
-rw-r--r--spec/ruby/core/enumerator/each_with_object_spec.rb6
-rw-r--r--spec/ruby/core/enumerator/enum_for_spec.rb6
-rw-r--r--spec/ruby/core/enumerator/enumerator_spec.rb7
-rw-r--r--spec/ruby/core/enumerator/feed_spec.rb52
-rw-r--r--spec/ruby/core/enumerator/first_spec.rb7
-rw-r--r--spec/ruby/core/enumerator/fixtures/classes.rb15
-rw-r--r--spec/ruby/core/enumerator/fixtures/common.rb9
-rw-r--r--spec/ruby/core/enumerator/generator/each_spec.rb40
-rw-r--r--spec/ruby/core/enumerator/generator/initialize_spec.rb26
-rw-r--r--spec/ruby/core/enumerator/initialize_spec.rb57
-rw-r--r--spec/ruby/core/enumerator/inspect_spec.rb22
-rw-r--r--spec/ruby/core/enumerator/lazy/chunk_spec.rb67
-rw-r--r--spec/ruby/core/enumerator/lazy/chunk_while_spec.rb14
-rw-r--r--spec/ruby/core/enumerator/lazy/collect_concat_spec.rb8
-rw-r--r--spec/ruby/core/enumerator/lazy/collect_spec.rb8
-rw-r--r--spec/ruby/core/enumerator/lazy/compact_spec.rb14
-rw-r--r--spec/ruby/core/enumerator/lazy/drop_spec.rb58
-rw-r--r--spec/ruby/core/enumerator/lazy/drop_while_spec.rb66
-rw-r--r--spec/ruby/core/enumerator/lazy/eager_spec.rb27
-rw-r--r--spec/ruby/core/enumerator/lazy/enum_for_spec.rb8
-rw-r--r--spec/ruby/core/enumerator/lazy/filter_map_spec.rb14
-rw-r--r--spec/ruby/core/enumerator/lazy/filter_spec.rb6
-rw-r--r--spec/ruby/core/enumerator/lazy/find_all_spec.rb8
-rw-r--r--spec/ruby/core/enumerator/lazy/fixtures/classes.rb54
-rw-r--r--spec/ruby/core/enumerator/lazy/flat_map_spec.rb16
-rw-r--r--spec/ruby/core/enumerator/lazy/force_spec.rb36
-rw-r--r--spec/ruby/core/enumerator/lazy/grep_spec.rb121
-rw-r--r--spec/ruby/core/enumerator/lazy/grep_v_spec.rb123
-rw-r--r--spec/ruby/core/enumerator/lazy/initialize_spec.rb63
-rw-r--r--spec/ruby/core/enumerator/lazy/lazy_spec.rb27
-rw-r--r--spec/ruby/core/enumerator/lazy/map_spec.rb12
-rw-r--r--spec/ruby/core/enumerator/lazy/reject_spec.rb78
-rw-r--r--spec/ruby/core/enumerator/lazy/select_spec.rb47
-rw-r--r--spec/ruby/core/enumerator/lazy/shared/collect.rb62
-rw-r--r--spec/ruby/core/enumerator/lazy/shared/collect_concat.rb78
-rw-r--r--spec/ruby/core/enumerator/lazy/shared/select.rb66
-rw-r--r--spec/ruby/core/enumerator/lazy/shared/to_enum.rb55
-rw-r--r--spec/ruby/core/enumerator/lazy/slice_after_spec.rb14
-rw-r--r--spec/ruby/core/enumerator/lazy/slice_before_spec.rb14
-rw-r--r--spec/ruby/core/enumerator/lazy/slice_when_spec.rb14
-rw-r--r--spec/ruby/core/enumerator/lazy/take_spec.rb66
-rw-r--r--spec/ruby/core/enumerator/lazy/take_while_spec.rb60
-rw-r--r--spec/ruby/core/enumerator/lazy/to_enum_spec.rb8
-rw-r--r--spec/ruby/core/enumerator/lazy/uniq_spec.rb74
-rw-r--r--spec/ruby/core/enumerator/lazy/with_index_spec.rb36
-rw-r--r--spec/ruby/core/enumerator/lazy/zip_spec.rb86
-rw-r--r--spec/ruby/core/enumerator/new_spec.rb76
-rw-r--r--spec/ruby/core/enumerator/next_spec.rb38
-rw-r--r--spec/ruby/core/enumerator/next_values_spec.rb61
-rw-r--r--spec/ruby/core/enumerator/peek_spec.rb36
-rw-r--r--spec/ruby/core/enumerator/peek_values_spec.rb63
-rw-r--r--spec/ruby/core/enumerator/plus_spec.rb33
-rw-r--r--spec/ruby/core/enumerator/produce_spec.rb34
-rw-r--r--spec/ruby/core/enumerator/product/each_spec.rb71
-rw-r--r--spec/ruby/core/enumerator/product/initialize_copy_spec.rb52
-rw-r--r--spec/ruby/core/enumerator/product/initialize_spec.rb31
-rw-r--r--spec/ruby/core/enumerator/product/inspect_spec.rb20
-rw-r--r--spec/ruby/core/enumerator/product/rewind_spec.rb62
-rw-r--r--spec/ruby/core/enumerator/product/size_spec.rb54
-rw-r--r--spec/ruby/core/enumerator/product_spec.rb91
-rw-r--r--spec/ruby/core/enumerator/rewind_spec.rb70
-rw-r--r--spec/ruby/core/enumerator/shared/enum_for.rb57
-rw-r--r--spec/ruby/core/enumerator/shared/with_index.rb33
-rw-r--r--spec/ruby/core/enumerator/shared/with_object.rb42
-rw-r--r--spec/ruby/core/enumerator/size_spec.rb26
-rw-r--r--spec/ruby/core/enumerator/to_enum_spec.rb6
-rw-r--r--spec/ruby/core/enumerator/with_index_spec.rb89
-rw-r--r--spec/ruby/core/enumerator/with_object_spec.rb6
-rw-r--r--spec/ruby/core/enumerator/yielder/append_spec.rb35
-rw-r--r--spec/ruby/core/enumerator/yielder/initialize_spec.rb18
-rw-r--r--spec/ruby/core/enumerator/yielder/to_proc_spec.rb16
-rw-r--r--spec/ruby/core/enumerator/yielder/yield_spec.rb33
-rw-r--r--spec/ruby/core/env/assoc_spec.rb31
-rw-r--r--spec/ruby/core/env/clear_spec.rb20
-rw-r--r--spec/ruby/core/env/clone_spec.rb21
-rw-r--r--spec/ruby/core/env/delete_if_spec.rb54
-rw-r--r--spec/ruby/core/env/delete_spec.rb55
-rw-r--r--spec/ruby/core/env/dup_spec.rb9
-rw-r--r--spec/ruby/core/env/each_key_spec.rb34
-rw-r--r--spec/ruby/core/env/each_pair_spec.rb6
-rw-r--r--spec/ruby/core/env/each_spec.rb6
-rw-r--r--spec/ruby/core/env/each_value_spec.rb34
-rw-r--r--spec/ruby/core/env/element_reference_spec.rb76
-rw-r--r--spec/ruby/core/env/element_set_spec.rb6
-rw-r--r--spec/ruby/core/env/empty_spec.rb23
-rw-r--r--spec/ruby/core/env/except_spec.rb34
-rw-r--r--spec/ruby/core/env/fetch_spec.rb63
-rw-r--r--spec/ruby/core/env/filter_spec.rb13
-rw-r--r--spec/ruby/core/env/fixtures/common.rb9
-rw-r--r--spec/ruby/core/env/has_key_spec.rb6
-rw-r--r--spec/ruby/core/env/has_value_spec.rb6
-rw-r--r--spec/ruby/core/env/include_spec.rb6
-rw-r--r--spec/ruby/core/env/inspect_spec.rb11
-rw-r--r--spec/ruby/core/env/invert_spec.rb16
-rw-r--r--spec/ruby/core/env/keep_if_spec.rb54
-rw-r--r--spec/ruby/core/env/key_spec.rb39
-rw-r--r--spec/ruby/core/env/keys_spec.rb14
-rw-r--r--spec/ruby/core/env/length_spec.rb6
-rw-r--r--spec/ruby/core/env/member_spec.rb6
-rw-r--r--spec/ruby/core/env/merge_spec.rb6
-rw-r--r--spec/ruby/core/env/rassoc_spec.rb42
-rw-r--r--spec/ruby/core/env/rehash_spec.rb7
-rw-r--r--spec/ruby/core/env/reject_spec.rb101
-rw-r--r--spec/ruby/core/env/replace_spec.rb51
-rw-r--r--spec/ruby/core/env/select_spec.rb13
-rw-r--r--spec/ruby/core/env/shared/each.rb65
-rw-r--r--spec/ruby/core/env/shared/include.rb30
-rw-r--r--spec/ruby/core/env/shared/length.rb13
-rw-r--r--spec/ruby/core/env/shared/select.rb61
-rw-r--r--spec/ruby/core/env/shared/store.rb60
-rw-r--r--spec/ruby/core/env/shared/to_hash.rb33
-rw-r--r--spec/ruby/core/env/shared/update.rb104
-rw-r--r--spec/ruby/core/env/shared/value.rb29
-rw-r--r--spec/ruby/core/env/shift_spec.rb47
-rw-r--r--spec/ruby/core/env/size_spec.rb6
-rw-r--r--spec/ruby/core/env/slice_spec.rb37
-rw-r--r--spec/ruby/core/env/spec_helper.rb26
-rw-r--r--spec/ruby/core/env/store_spec.rb6
-rw-r--r--spec/ruby/core/env/to_a_spec.rb21
-rw-r--r--spec/ruby/core/env/to_h_spec.rb70
-rw-r--r--spec/ruby/core/env/to_hash_spec.rb6
-rw-r--r--spec/ruby/core/env/to_s_spec.rb7
-rw-r--r--spec/ruby/core/env/update_spec.rb6
-rw-r--r--spec/ruby/core/env/value_spec.rb6
-rw-r--r--spec/ruby/core/env/values_at_spec.rb38
-rw-r--r--spec/ruby/core/env/values_spec.rb14
-rw-r--r--spec/ruby/core/exception/backtrace_locations_spec.rb39
-rw-r--r--spec/ruby/core/exception/backtrace_spec.rb106
-rw-r--r--spec/ruby/core/exception/case_compare_spec.rb37
-rw-r--r--spec/ruby/core/exception/cause_spec.rb56
-rw-r--r--spec/ruby/core/exception/detailed_message_spec.rb50
-rw-r--r--spec/ruby/core/exception/dup_spec.rb74
-rw-r--r--spec/ruby/core/exception/equal_value_spec.rb68
-rw-r--r--spec/ruby/core/exception/errno_spec.rb69
-rw-r--r--spec/ruby/core/exception/exception_spec.rb69
-rw-r--r--spec/ruby/core/exception/exit_value_spec.rb13
-rw-r--r--spec/ruby/core/exception/fixtures/common.rb102
-rw-r--r--spec/ruby/core/exception/fixtures/syntax_error.rb3
-rw-r--r--spec/ruby/core/exception/fixtures/thread_fiber_ensure.rb22
-rw-r--r--spec/ruby/core/exception/fixtures/thread_fiber_ensure_non_root_fiber.rb25
-rw-r--r--spec/ruby/core/exception/frozen_error_spec.rb54
-rw-r--r--spec/ruby/core/exception/full_message_spec.rb226
-rw-r--r--spec/ruby/core/exception/hierarchy_spec.rb62
-rw-r--r--spec/ruby/core/exception/inspect_spec.rb24
-rw-r--r--spec/ruby/core/exception/interrupt_spec.rb60
-rw-r--r--spec/ruby/core/exception/io_error_spec.rb45
-rw-r--r--spec/ruby/core/exception/key_error_spec.rb19
-rw-r--r--spec/ruby/core/exception/load_error_spec.rb21
-rw-r--r--spec/ruby/core/exception/message_spec.rb27
-rw-r--r--spec/ruby/core/exception/name_error_spec.rb28
-rw-r--r--spec/ruby/core/exception/name_spec.rb43
-rw-r--r--spec/ruby/core/exception/new_spec.rb7
-rw-r--r--spec/ruby/core/exception/no_method_error_spec.rb283
-rw-r--r--spec/ruby/core/exception/reason_spec.rb13
-rw-r--r--spec/ruby/core/exception/receiver_spec.rb58
-rw-r--r--spec/ruby/core/exception/result_spec.rb21
-rw-r--r--spec/ruby/core/exception/set_backtrace_spec.rb23
-rw-r--r--spec/ruby/core/exception/shared/new.rb18
-rw-r--r--spec/ruby/core/exception/shared/set_backtrace.rb64
-rw-r--r--spec/ruby/core/exception/signal_exception_spec.rb123
-rw-r--r--spec/ruby/core/exception/signm_spec.rb9
-rw-r--r--spec/ruby/core/exception/signo_spec.rb9
-rw-r--r--spec/ruby/core/exception/standard_error_spec.rb23
-rw-r--r--spec/ruby/core/exception/status_spec.rb9
-rw-r--r--spec/ruby/core/exception/success_spec.rb15
-rw-r--r--spec/ruby/core/exception/syntax_error_spec.rb25
-rw-r--r--spec/ruby/core/exception/system_call_error_spec.rb163
-rw-r--r--spec/ruby/core/exception/system_exit_spec.rb59
-rw-r--r--spec/ruby/core/exception/to_s_spec.rb37
-rw-r--r--spec/ruby/core/exception/top_level_spec.rb65
-rw-r--r--spec/ruby/core/exception/uncaught_throw_error_spec.rb12
-rw-r--r--spec/ruby/core/false/and_spec.rb11
-rw-r--r--spec/ruby/core/false/case_compare_spec.rb14
-rw-r--r--spec/ruby/core/false/dup_spec.rb7
-rw-r--r--spec/ruby/core/false/falseclass_spec.rb15
-rw-r--r--spec/ruby/core/false/inspect_spec.rb7
-rw-r--r--spec/ruby/core/false/or_spec.rb11
-rw-r--r--spec/ruby/core/false/singleton_method_spec.rb15
-rw-r--r--spec/ruby/core/false/to_s_spec.rb15
-rw-r--r--spec/ruby/core/false/xor_spec.rb11
-rw-r--r--spec/ruby/core/fiber/alive_spec.rb44
-rw-r--r--spec/ruby/core/fiber/blocking_spec.rb73
-rw-r--r--spec/ruby/core/fiber/current_spec.rb50
-rw-r--r--spec/ruby/core/fiber/fixtures/classes.rb22
-rw-r--r--spec/ruby/core/fiber/fixtures/scheduler.rb35
-rw-r--r--spec/ruby/core/fiber/inspect_spec.rb35
-rw-r--r--spec/ruby/core/fiber/kill_spec.rb90
-rw-r--r--spec/ruby/core/fiber/new_spec.rb39
-rw-r--r--spec/ruby/core/fiber/raise_spec.rb139
-rw-r--r--spec/ruby/core/fiber/resume_spec.rb83
-rw-r--r--spec/ruby/core/fiber/scheduler_spec.rb8
-rw-r--r--spec/ruby/core/fiber/set_scheduler_spec.rb8
-rw-r--r--spec/ruby/core/fiber/shared/blocking.rb41
-rw-r--r--spec/ruby/core/fiber/shared/resume.rb58
-rw-r--r--spec/ruby/core/fiber/shared/scheduler.rb51
-rw-r--r--spec/ruby/core/fiber/storage_spec.rb181
-rw-r--r--spec/ruby/core/fiber/transfer_spec.rb84
-rw-r--r--spec/ruby/core/fiber/yield_spec.rb49
-rw-r--r--spec/ruby/core/file/absolute_path_spec.rb94
-rw-r--r--spec/ruby/core/file/atime_spec.rb60
-rw-r--r--spec/ruby/core/file/basename_spec.rb183
-rw-r--r--spec/ruby/core/file/birthtime_spec.rb56
-rw-r--r--spec/ruby/core/file/blockdev_spec.rb6
-rw-r--r--spec/ruby/core/file/chardev_spec.rb6
-rw-r--r--spec/ruby/core/file/chmod_spec.rb185
-rw-r--r--spec/ruby/core/file/chown_spec.rb144
-rw-r--r--spec/ruby/core/file/constants/constants_spec.rb31
-rw-r--r--spec/ruby/core/file/constants_spec.rb141
-rw-r--r--spec/ruby/core/file/ctime_spec.rb54
-rw-r--r--spec/ruby/core/file/delete_spec.rb6
-rw-r--r--spec/ruby/core/file/directory_spec.rb10
-rw-r--r--spec/ruby/core/file/dirname_spec.rb137
-rw-r--r--spec/ruby/core/file/empty_spec.rb7
-rw-r--r--spec/ruby/core/file/executable_real_spec.rb7
-rw-r--r--spec/ruby/core/file/executable_spec.rb7
-rw-r--r--spec/ruby/core/file/exist_spec.rb12
-rw-r--r--spec/ruby/core/file/expand_path_spec.rb265
-rw-r--r--spec/ruby/core/file/extname_spec.rb76
-rw-r--r--spec/ruby/core/file/file_spec.rb16
-rw-r--r--spec/ruby/core/file/fixtures/common.rb22
-rw-r--r--spec/ruby/core/file/fixtures/do_not_remove1
-rw-r--r--spec/ruby/core/file/fixtures/file_types.rb66
-rw-r--r--spec/ruby/core/file/flock_spec.rb74
-rw-r--r--spec/ruby/core/file/fnmatch_spec.rb10
-rw-r--r--spec/ruby/core/file/ftype_spec.rb82
-rw-r--r--spec/ruby/core/file/grpowned_spec.rb10
-rw-r--r--spec/ruby/core/file/identical_spec.rb6
-rw-r--r--spec/ruby/core/file/initialize_spec.rb19
-rw-r--r--spec/ruby/core/file/inspect_spec.rb17
-rw-r--r--spec/ruby/core/file/join_spec.rb148
-rw-r--r--spec/ruby/core/file/lchmod_spec.rb32
-rw-r--r--spec/ruby/core/file/lchown_spec.rb59
-rw-r--r--spec/ruby/core/file/link_spec.rb39
-rw-r--r--spec/ruby/core/file/lstat_spec.rb33
-rw-r--r--spec/ruby/core/file/lutime_spec.rb43
-rw-r--r--spec/ruby/core/file/mkfifo_spec.rb51
-rw-r--r--spec/ruby/core/file/mtime_spec.rb56
-rw-r--r--spec/ruby/core/file/new_spec.rb223
-rw-r--r--spec/ruby/core/file/null_spec.rb15
-rw-r--r--spec/ruby/core/file/open_spec.rb713
-rw-r--r--spec/ruby/core/file/owned_spec.rb35
-rw-r--r--spec/ruby/core/file/path_spec.rb81
-rw-r--r--spec/ruby/core/file/pipe_spec.rb32
-rw-r--r--spec/ruby/core/file/printf_spec.rb18
-rw-r--r--spec/ruby/core/file/read_spec.rb6
-rw-r--r--spec/ruby/core/file/readable_real_spec.rb7
-rw-r--r--spec/ruby/core/file/readable_spec.rb7
-rw-r--r--spec/ruby/core/file/readlink_spec.rb86
-rw-r--r--spec/ruby/core/file/realdirpath_spec.rb104
-rw-r--r--spec/ruby/core/file/realpath_spec.rb98
-rw-r--r--spec/ruby/core/file/rename_spec.rb37
-rw-r--r--spec/ruby/core/file/reopen_spec.rb32
-rw-r--r--spec/ruby/core/file/setgid_spec.rb36
-rw-r--r--spec/ruby/core/file/setuid_spec.rb34
-rw-r--r--spec/ruby/core/file/shared/fnmatch.rb294
-rw-r--r--spec/ruby/core/file/shared/open.rb12
-rw-r--r--spec/ruby/core/file/shared/path.rb82
-rw-r--r--spec/ruby/core/file/shared/read.rb15
-rw-r--r--spec/ruby/core/file/shared/stat.rb32
-rw-r--r--spec/ruby/core/file/shared/unlink.rb61
-rw-r--r--spec/ruby/core/file/shared/update_time.rb105
-rw-r--r--spec/ruby/core/file/size_spec.rb119
-rw-r--r--spec/ruby/core/file/socket_spec.rb10
-rw-r--r--spec/ruby/core/file/split_spec.rb64
-rw-r--r--spec/ruby/core/file/stat/atime_spec.rb18
-rw-r--r--spec/ruby/core/file/stat/birthtime_spec.rb29
-rw-r--r--spec/ruby/core/file/stat/blksize_spec.rb27
-rw-r--r--spec/ruby/core/file/stat/blockdev_spec.rb7
-rw-r--r--spec/ruby/core/file/stat/blocks_spec.rb27
-rw-r--r--spec/ruby/core/file/stat/chardev_spec.rb7
-rw-r--r--spec/ruby/core/file/stat/comparison_spec.rb66
-rw-r--r--spec/ruby/core/file/stat/ctime_spec.rb18
-rw-r--r--spec/ruby/core/file/stat/dev_major_spec.rb23
-rw-r--r--spec/ruby/core/file/stat/dev_minor_spec.rb23
-rw-r--r--spec/ruby/core/file/stat/dev_spec.rb15
-rw-r--r--spec/ruby/core/file/stat/directory_spec.rb7
-rw-r--r--spec/ruby/core/file/stat/executable_real_spec.rb7
-rw-r--r--spec/ruby/core/file/stat/executable_spec.rb7
-rw-r--r--spec/ruby/core/file/stat/file_spec.rb7
-rw-r--r--spec/ruby/core/file/stat/fixtures/classes.rb5
-rw-r--r--spec/ruby/core/file/stat/ftype_spec.rb64
-rw-r--r--spec/ruby/core/file/stat/gid_spec.rb19
-rw-r--r--spec/ruby/core/file/stat/grpowned_spec.rb7
-rw-r--r--spec/ruby/core/file/stat/ino_spec.rb28
-rw-r--r--spec/ruby/core/file/stat/inspect_spec.rb26
-rw-r--r--spec/ruby/core/file/stat/mode_spec.rb19
-rw-r--r--spec/ruby/core/file/stat/mtime_spec.rb18
-rw-r--r--spec/ruby/core/file/stat/new_spec.rb32
-rw-r--r--spec/ruby/core/file/stat/nlink_spec.rb21
-rw-r--r--spec/ruby/core/file/stat/owned_spec.rb33
-rw-r--r--spec/ruby/core/file/stat/pipe_spec.rb32
-rw-r--r--spec/ruby/core/file/stat/rdev_major_spec.rb24
-rw-r--r--spec/ruby/core/file/stat/rdev_minor_spec.rb24
-rw-r--r--spec/ruby/core/file/stat/rdev_spec.rb15
-rw-r--r--spec/ruby/core/file/stat/readable_real_spec.rb7
-rw-r--r--spec/ruby/core/file/stat/readable_spec.rb7
-rw-r--r--spec/ruby/core/file/stat/setgid_spec.rb7
-rw-r--r--spec/ruby/core/file/stat/setuid_spec.rb7
-rw-r--r--spec/ruby/core/file/stat/size_spec.rb21
-rw-r--r--spec/ruby/core/file/stat/socket_spec.rb7
-rw-r--r--spec/ruby/core/file/stat/sticky_spec.rb7
-rw-r--r--spec/ruby/core/file/stat/symlink_spec.rb7
-rw-r--r--spec/ruby/core/file/stat/uid_spec.rb18
-rw-r--r--spec/ruby/core/file/stat/world_readable_spec.rb11
-rw-r--r--spec/ruby/core/file/stat/world_writable_spec.rb11
-rw-r--r--spec/ruby/core/file/stat/writable_real_spec.rb7
-rw-r--r--spec/ruby/core/file/stat/writable_spec.rb7
-rw-r--r--spec/ruby/core/file/stat/zero_spec.rb7
-rw-r--r--spec/ruby/core/file/stat_spec.rb55
-rw-r--r--spec/ruby/core/file/sticky_spec.rb50
-rw-r--r--spec/ruby/core/file/symlink_spec.rb57
-rw-r--r--spec/ruby/core/file/to_path_spec.rb6
-rw-r--r--spec/ruby/core/file/truncate_spec.rb177
-rw-r--r--spec/ruby/core/file/umask_spec.rb57
-rw-r--r--spec/ruby/core/file/unlink_spec.rb6
-rw-r--r--spec/ruby/core/file/utime_spec.rb6
-rw-r--r--spec/ruby/core/file/world_readable_spec.rb12
-rw-r--r--spec/ruby/core/file/world_writable_spec.rb12
-rw-r--r--spec/ruby/core/file/writable_real_spec.rb7
-rw-r--r--spec/ruby/core/file/writable_spec.rb7
-rw-r--r--spec/ruby/core/file/zero_spec.rb7
-rw-r--r--spec/ruby/core/filetest/blockdev_spec.rb6
-rw-r--r--spec/ruby/core/filetest/chardev_spec.rb6
-rw-r--r--spec/ruby/core/filetest/directory_spec.rb10
-rw-r--r--spec/ruby/core/filetest/executable_real_spec.rb7
-rw-r--r--spec/ruby/core/filetest/executable_spec.rb7
-rw-r--r--spec/ruby/core/filetest/exist_spec.rb12
-rw-r--r--spec/ruby/core/filetest/file_spec.rb10
-rw-r--r--spec/ruby/core/filetest/grpowned_spec.rb10
-rw-r--r--spec/ruby/core/filetest/identical_spec.rb6
-rw-r--r--spec/ruby/core/filetest/owned_spec.rb6
-rw-r--r--spec/ruby/core/filetest/pipe_spec.rb6
-rw-r--r--spec/ruby/core/filetest/readable_real_spec.rb7
-rw-r--r--spec/ruby/core/filetest/readable_spec.rb7
-rw-r--r--spec/ruby/core/filetest/setgid_spec.rb6
-rw-r--r--spec/ruby/core/filetest/setuid_spec.rb6
-rw-r--r--spec/ruby/core/filetest/size_spec.rb34
-rw-r--r--spec/ruby/core/filetest/socket_spec.rb10
-rw-r--r--spec/ruby/core/filetest/sticky_spec.rb7
-rw-r--r--spec/ruby/core/filetest/symlink_spec.rb10
-rw-r--r--spec/ruby/core/filetest/world_readable_spec.rb5
-rw-r--r--spec/ruby/core/filetest/world_writable_spec.rb5
-rw-r--r--spec/ruby/core/filetest/writable_real_spec.rb7
-rw-r--r--spec/ruby/core/filetest/writable_spec.rb7
-rw-r--r--spec/ruby/core/filetest/zero_spec.rb7
-rw-r--r--spec/ruby/core/float/abs_spec.rb6
-rw-r--r--spec/ruby/core/float/angle_spec.rb6
-rw-r--r--spec/ruby/core/float/arg_spec.rb6
-rw-r--r--spec/ruby/core/float/case_compare_spec.rb6
-rw-r--r--spec/ruby/core/float/ceil_spec.rb26
-rw-r--r--spec/ruby/core/float/coerce_spec.rb18
-rw-r--r--spec/ruby/core/float/comparison_spec.rb113
-rw-r--r--spec/ruby/core/float/constants_spec.rb55
-rw-r--r--spec/ruby/core/float/denominator_spec.rb29
-rw-r--r--spec/ruby/core/float/divide_spec.rb43
-rw-r--r--spec/ruby/core/float/divmod_spec.rb43
-rw-r--r--spec/ruby/core/float/dup_spec.rb8
-rw-r--r--spec/ruby/core/float/eql_spec.rb16
-rw-r--r--spec/ruby/core/float/equal_value_spec.rb6
-rw-r--r--spec/ruby/core/float/exponent_spec.rb15
-rw-r--r--spec/ruby/core/float/fdiv_spec.rb6
-rw-r--r--spec/ruby/core/float/finite_spec.rb19
-rw-r--r--spec/ruby/core/float/fixtures/classes.rb4
-rw-r--r--spec/ruby/core/float/fixtures/coerce.rb15
-rw-r--r--spec/ruby/core/float/float_spec.rb19
-rw-r--r--spec/ruby/core/float/floor_spec.rb26
-rw-r--r--spec/ruby/core/float/gt_spec.rb38
-rw-r--r--spec/ruby/core/float/gte_spec.rb38
-rw-r--r--spec/ruby/core/float/hash_spec.rb11
-rw-r--r--spec/ruby/core/float/infinite_spec.rb19
-rw-r--r--spec/ruby/core/float/inspect_spec.rb6
-rw-r--r--spec/ruby/core/float/lt_spec.rb38
-rw-r--r--spec/ruby/core/float/lte_spec.rb39
-rw-r--r--spec/ruby/core/float/magnitude_spec.rb6
-rw-r--r--spec/ruby/core/float/minus_spec.rb12
-rw-r--r--spec/ruby/core/float/modulo_spec.rb10
-rw-r--r--spec/ruby/core/float/multiply_spec.rb17
-rw-r--r--spec/ruby/core/float/nan_spec.rb9
-rw-r--r--spec/ruby/core/float/negative_spec.rb33
-rw-r--r--spec/ruby/core/float/next_float_spec.rb49
-rw-r--r--spec/ruby/core/float/numerator_spec.rb39
-rw-r--r--spec/ruby/core/float/phase_spec.rb6
-rw-r--r--spec/ruby/core/float/plus_spec.rb12
-rw-r--r--spec/ruby/core/float/positive_spec.rb33
-rw-r--r--spec/ruby/core/float/prev_float_spec.rb49
-rw-r--r--spec/ruby/core/float/quo_spec.rb6
-rw-r--r--spec/ruby/core/float/rationalize_spec.rb43
-rw-r--r--spec/ruby/core/float/round_spec.rb203
-rw-r--r--spec/ruby/core/float/shared/abs.rb21
-rw-r--r--spec/ruby/core/float/shared/arg.rb36
-rw-r--r--spec/ruby/core/float/shared/arithmetic_exception_in_coerce.rb11
-rw-r--r--spec/ruby/core/float/shared/comparison_exception_in_coerce.rb11
-rw-r--r--spec/ruby/core/float/shared/equal.rb38
-rw-r--r--spec/ruby/core/float/shared/modulo.rb48
-rw-r--r--spec/ruby/core/float/shared/quo.rb59
-rw-r--r--spec/ruby/core/float/shared/to_i.rb14
-rw-r--r--spec/ruby/core/float/shared/to_s.rb308
-rw-r--r--spec/ruby/core/float/to_f_spec.rb9
-rw-r--r--spec/ruby/core/float/to_i_spec.rb6
-rw-r--r--spec/ruby/core/float/to_int_spec.rb6
-rw-r--r--spec/ruby/core/float/to_r_spec.rb5
-rw-r--r--spec/ruby/core/float/to_s_spec.rb6
-rw-r--r--spec/ruby/core/float/truncate_spec.rb14
-rw-r--r--spec/ruby/core/float/uminus_spec.rb28
-rw-r--r--spec/ruby/core/float/uplus_spec.rb9
-rw-r--r--spec/ruby/core/float/zero_spec.rb9
-rw-r--r--spec/ruby/core/gc/auto_compact_spec.rb24
-rw-r--r--spec/ruby/core/gc/config_spec.rb83
-rw-r--r--spec/ruby/core/gc/count_spec.rb17
-rw-r--r--spec/ruby/core/gc/disable_spec.rb18
-rw-r--r--spec/ruby/core/gc/enable_spec.rb13
-rw-r--r--spec/ruby/core/gc/garbage_collect_spec.rb15
-rw-r--r--spec/ruby/core/gc/measure_total_time_spec.rb17
-rw-r--r--spec/ruby/core/gc/profiler/clear_spec.rb5
-rw-r--r--spec/ruby/core/gc/profiler/disable_spec.rb16
-rw-r--r--spec/ruby/core/gc/profiler/enable_spec.rb17
-rw-r--r--spec/ruby/core/gc/profiler/enabled_spec.rb21
-rw-r--r--spec/ruby/core/gc/profiler/report_spec.rb5
-rw-r--r--spec/ruby/core/gc/profiler/result_spec.rb7
-rw-r--r--spec/ruby/core/gc/profiler/total_time_spec.rb7
-rw-r--r--spec/ruby/core/gc/start_spec.rb12
-rw-r--r--spec/ruby/core/gc/stat_spec.rb62
-rw-r--r--spec/ruby/core/gc/stress_spec.rb27
-rw-r--r--spec/ruby/core/gc/total_time_spec.rb13
-rw-r--r--spec/ruby/core/hash/allocate_spec.rb15
-rw-r--r--spec/ruby/core/hash/any_spec.rb30
-rw-r--r--spec/ruby/core/hash/assoc_spec.rb50
-rw-r--r--spec/ruby/core/hash/clear_spec.rb32
-rw-r--r--spec/ruby/core/hash/clone_spec.rb12
-rw-r--r--spec/ruby/core/hash/compact_spec.rb83
-rw-r--r--spec/ruby/core/hash/compare_by_identity_spec.rb147
-rw-r--r--spec/ruby/core/hash/constructor_spec.rb129
-rw-r--r--spec/ruby/core/hash/deconstruct_keys_spec.rb23
-rw-r--r--spec/ruby/core/hash/default_proc_spec.rb80
-rw-r--r--spec/ruby/core/hash/default_spec.rb46
-rw-r--r--spec/ruby/core/hash/delete_if_spec.rb44
-rw-r--r--spec/ruby/core/hash/delete_spec.rb58
-rw-r--r--spec/ruby/core/hash/dig_spec.rb66
-rw-r--r--spec/ruby/core/hash/each_key_spec.rb23
-rw-r--r--spec/ruby/core/hash/each_pair_spec.rb11
-rw-r--r--spec/ruby/core/hash/each_spec.rb11
-rw-r--r--spec/ruby/core/hash/each_value_spec.rb23
-rw-r--r--spec/ruby/core/hash/element_reference_spec.rb134
-rw-r--r--spec/ruby/core/hash/element_set_spec.rb7
-rw-r--r--spec/ruby/core/hash/empty_spec.rb15
-rw-r--r--spec/ruby/core/hash/eql_spec.rb9
-rw-r--r--spec/ruby/core/hash/equal_value_spec.rb18
-rw-r--r--spec/ruby/core/hash/except_spec.rb42
-rw-r--r--spec/ruby/core/hash/fetch_spec.rb44
-rw-r--r--spec/ruby/core/hash/fetch_values_spec.rb35
-rw-r--r--spec/ruby/core/hash/filter_spec.rb10
-rw-r--r--spec/ruby/core/hash/fixtures/classes.rb75
-rw-r--r--spec/ruby/core/hash/fixtures/name.rb30
-rw-r--r--spec/ruby/core/hash/flatten_spec.rb62
-rw-r--r--spec/ruby/core/hash/gt_spec.rb42
-rw-r--r--spec/ruby/core/hash/gte_spec.rb42
-rw-r--r--spec/ruby/core/hash/has_key_spec.rb7
-rw-r--r--spec/ruby/core/hash/has_value_spec.rb7
-rw-r--r--spec/ruby/core/hash/hash_spec.rb51
-rw-r--r--spec/ruby/core/hash/include_spec.rb7
-rw-r--r--spec/ruby/core/hash/initialize_spec.rb61
-rw-r--r--spec/ruby/core/hash/inspect_spec.rb7
-rw-r--r--spec/ruby/core/hash/invert_spec.rb48
-rw-r--r--spec/ruby/core/hash/keep_if_spec.rb37
-rw-r--r--spec/ruby/core/hash/key_spec.rb12
-rw-r--r--spec/ruby/core/hash/keys_spec.rb23
-rw-r--r--spec/ruby/core/hash/length_spec.rb7
-rw-r--r--spec/ruby/core/hash/lt_spec.rb42
-rw-r--r--spec/ruby/core/hash/lte_spec.rb42
-rw-r--r--spec/ruby/core/hash/member_spec.rb7
-rw-r--r--spec/ruby/core/hash/merge_spec.rb123
-rw-r--r--spec/ruby/core/hash/new_spec.rb67
-rw-r--r--spec/ruby/core/hash/rassoc_spec.rb42
-rw-r--r--spec/ruby/core/hash/rehash_spec.rb114
-rw-r--r--spec/ruby/core/hash/reject_spec.rb116
-rw-r--r--spec/ruby/core/hash/replace_spec.rb79
-rw-r--r--spec/ruby/core/hash/ruby2_keywords_hash_spec.rb83
-rw-r--r--spec/ruby/core/hash/select_spec.rb10
-rw-r--r--spec/ruby/core/hash/shared/comparison.rb15
-rw-r--r--spec/ruby/core/hash/shared/each.rb105
-rw-r--r--spec/ruby/core/hash/shared/eql.rb204
-rw-r--r--spec/ruby/core/hash/shared/greater_than.rb23
-rw-r--r--spec/ruby/core/hash/shared/index.rb37
-rw-r--r--spec/ruby/core/hash/shared/iteration.rb19
-rw-r--r--spec/ruby/core/hash/shared/key.rb38
-rw-r--r--spec/ruby/core/hash/shared/length.rb12
-rw-r--r--spec/ruby/core/hash/shared/less_than.rb23
-rw-r--r--spec/ruby/core/hash/shared/select.rb112
-rw-r--r--spec/ruby/core/hash/shared/store.rb115
-rw-r--r--spec/ruby/core/hash/shared/to_s.rb93
-rw-r--r--spec/ruby/core/hash/shared/update.rb76
-rw-r--r--spec/ruby/core/hash/shared/value.rb14
-rw-r--r--spec/ruby/core/hash/shared/values_at.rb9
-rw-r--r--spec/ruby/core/hash/shift_spec.rb78
-rw-r--r--spec/ruby/core/hash/size_spec.rb7
-rw-r--r--spec/ruby/core/hash/slice_spec.rb74
-rw-r--r--spec/ruby/core/hash/sort_spec.rb17
-rw-r--r--spec/ruby/core/hash/store_spec.rb7
-rw-r--r--spec/ruby/core/hash/to_a_spec.rb29
-rw-r--r--spec/ruby/core/hash/to_h_spec.rb106
-rw-r--r--spec/ruby/core/hash/to_hash_spec.rb14
-rw-r--r--spec/ruby/core/hash/to_proc_spec.rb91
-rw-r--r--spec/ruby/core/hash/to_s_spec.rb7
-rw-r--r--spec/ruby/core/hash/transform_keys_spec.rb150
-rw-r--r--spec/ruby/core/hash/transform_values_spec.rb118
-rw-r--r--spec/ruby/core/hash/try_convert_spec.rb50
-rw-r--r--spec/ruby/core/hash/update_spec.rb7
-rw-r--r--spec/ruby/core/hash/value_spec.rb7
-rw-r--r--spec/ruby/core/hash/values_at_spec.rb7
-rw-r--r--spec/ruby/core/hash/values_spec.rb10
-rw-r--r--spec/ruby/core/integer/abs_spec.rb6
-rw-r--r--spec/ruby/core/integer/allbits_spec.rb37
-rw-r--r--spec/ruby/core/integer/anybits_spec.rb36
-rw-r--r--spec/ruby/core/integer/bit_and_spec.rb97
-rw-r--r--spec/ruby/core/integer/bit_length_spec.rb76
-rw-r--r--spec/ruby/core/integer/bit_or_spec.rb89
-rw-r--r--spec/ruby/core/integer/bit_xor_spec.rb93
-rw-r--r--spec/ruby/core/integer/case_compare_spec.rb6
-rw-r--r--spec/ruby/core/integer/ceil_spec.rb24
-rw-r--r--spec/ruby/core/integer/ceildiv_spec.rb20
-rw-r--r--spec/ruby/core/integer/chr_spec.rb257
-rw-r--r--spec/ruby/core/integer/coerce_spec.rb91
-rw-r--r--spec/ruby/core/integer/comparison_spec.rb177
-rw-r--r--spec/ruby/core/integer/complement_spec.rb20
-rw-r--r--spec/ruby/core/integer/constants_spec.rb13
-rw-r--r--spec/ruby/core/integer/denominator_spec.rb20
-rw-r--r--spec/ruby/core/integer/digits_spec.rb41
-rw-r--r--spec/ruby/core/integer/div_spec.rb154
-rw-r--r--spec/ruby/core/integer/divide_spec.rb126
-rw-r--r--spec/ruby/core/integer/divmod_spec.rb117
-rw-r--r--spec/ruby/core/integer/downto_spec.rb69
-rw-r--r--spec/ruby/core/integer/dup_spec.rb13
-rw-r--r--spec/ruby/core/integer/element_reference_spec.rb188
-rw-r--r--spec/ruby/core/integer/equal_value_spec.rb6
-rw-r--r--spec/ruby/core/integer/even_spec.rb40
-rw-r--r--spec/ruby/core/integer/exponent_spec.rb7
-rw-r--r--spec/ruby/core/integer/fdiv_spec.rb100
-rw-r--r--spec/ruby/core/integer/fixtures/classes.rb4
-rw-r--r--spec/ruby/core/integer/floor_spec.rb13
-rw-r--r--spec/ruby/core/integer/gcd_spec.rb69
-rw-r--r--spec/ruby/core/integer/gcdlcm_spec.rb53
-rw-r--r--spec/ruby/core/integer/gt_spec.rb43
-rw-r--r--spec/ruby/core/integer/gte_spec.rb43
-rw-r--r--spec/ruby/core/integer/integer_spec.rb20
-rw-r--r--spec/ruby/core/integer/lcm_spec.rb58
-rw-r--r--spec/ruby/core/integer/left_shift_spec.rb211
-rw-r--r--spec/ruby/core/integer/lt_spec.rb45
-rw-r--r--spec/ruby/core/integer/lte_spec.rb53
-rw-r--r--spec/ruby/core/integer/magnitude_spec.rb6
-rw-r--r--spec/ruby/core/integer/minus_spec.rb60
-rw-r--r--spec/ruby/core/integer/modulo_spec.rb10
-rw-r--r--spec/ruby/core/integer/multiply_spec.rb45
-rw-r--r--spec/ruby/core/integer/next_spec.rb6
-rw-r--r--spec/ruby/core/integer/nobits_spec.rb36
-rw-r--r--spec/ruby/core/integer/numerator_spec.rb18
-rw-r--r--spec/ruby/core/integer/odd_spec.rb38
-rw-r--r--spec/ruby/core/integer/ord_spec.rb17
-rw-r--r--spec/ruby/core/integer/plus_spec.rb75
-rw-r--r--spec/ruby/core/integer/pow_spec.rb51
-rw-r--r--spec/ruby/core/integer/pred_spec.rb11
-rw-r--r--spec/ruby/core/integer/rationalize_spec.rb39
-rw-r--r--spec/ruby/core/integer/remainder_spec.rb51
-rw-r--r--spec/ruby/core/integer/right_shift_spec.rb233
-rw-r--r--spec/ruby/core/integer/round_spec.rb81
-rw-r--r--spec/ruby/core/integer/shared/abs.rb18
-rw-r--r--spec/ruby/core/integer/shared/arithmetic_coerce.rb11
-rw-r--r--spec/ruby/core/integer/shared/comparison_coerce.rb11
-rw-r--r--spec/ruby/core/integer/shared/equal.rb58
-rw-r--r--spec/ruby/core/integer/shared/exponent.rb144
-rw-r--r--spec/ruby/core/integer/shared/integer_ceil_precision.rb43
-rw-r--r--spec/ruby/core/integer/shared/integer_floor_precision.rb43
-rw-r--r--spec/ruby/core/integer/shared/integer_rounding.rb19
-rw-r--r--spec/ruby/core/integer/shared/modulo.rb114
-rw-r--r--spec/ruby/core/integer/shared/next.rb25
-rw-r--r--spec/ruby/core/integer/shared/to_i.rb8
-rw-r--r--spec/ruby/core/integer/size_spec.rb34
-rw-r--r--spec/ruby/core/integer/sqrt_spec.rb31
-rw-r--r--spec/ruby/core/integer/succ_spec.rb6
-rw-r--r--spec/ruby/core/integer/times_spec.rb79
-rw-r--r--spec/ruby/core/integer/to_f_spec.rb23
-rw-r--r--spec/ruby/core/integer/to_i_spec.rb6
-rw-r--r--spec/ruby/core/integer/to_int_spec.rb6
-rw-r--r--spec/ruby/core/integer/to_r_spec.rb26
-rw-r--r--spec/ruby/core/integer/to_s_spec.rb95
-rw-r--r--spec/ruby/core/integer/truncate_spec.rb19
-rw-r--r--spec/ruby/core/integer/try_convert_spec.rb48
-rw-r--r--spec/ruby/core/integer/uminus_spec.rb30
-rw-r--r--spec/ruby/core/integer/upto_spec.rb69
-rw-r--r--spec/ruby/core/integer/zero_spec.rb13
-rw-r--r--spec/ruby/core/io/advise_spec.rb86
-rw-r--r--spec/ruby/core/io/autoclose_spec.rb77
-rw-r--r--spec/ruby/core/io/binmode_spec.rb64
-rw-r--r--spec/ruby/core/io/binread_spec.rb57
-rw-r--r--spec/ruby/core/io/binwrite_spec.rb6
-rw-r--r--spec/ruby/core/io/buffer/empty_spec.rb29
-rw-r--r--spec/ruby/core/io/buffer/external_spec.rb108
-rw-r--r--spec/ruby/core/io/buffer/free_spec.rb104
-rw-r--r--spec/ruby/core/io/buffer/initialize_spec.rb103
-rw-r--r--spec/ruby/core/io/buffer/internal_spec.rb108
-rw-r--r--spec/ruby/core/io/buffer/locked_spec.rb75
-rw-r--r--spec/ruby/core/io/buffer/mapped_spec.rb108
-rw-r--r--spec/ruby/core/io/buffer/null_spec.rb29
-rw-r--r--spec/ruby/core/io/buffer/private_spec.rb111
-rw-r--r--spec/ruby/core/io/buffer/readonly_spec.rb143
-rw-r--r--spec/ruby/core/io/buffer/resize_spec.rb155
-rw-r--r--spec/ruby/core/io/buffer/shared/null_and_empty.rb59
-rw-r--r--spec/ruby/core/io/buffer/shared_spec.rb117
-rw-r--r--spec/ruby/core/io/buffer/transfer_spec.rb118
-rw-r--r--spec/ruby/core/io/buffer/valid_spec.rb110
-rw-r--r--spec/ruby/core/io/close_on_exec_spec.rb76
-rw-r--r--spec/ruby/core/io/close_read_spec.rb61
-rw-r--r--spec/ruby/core/io/close_spec.rb118
-rw-r--r--spec/ruby/core/io/close_write_spec.rb68
-rw-r--r--spec/ruby/core/io/closed_spec.rb20
-rw-r--r--spec/ruby/core/io/constants_spec.rb19
-rw-r--r--spec/ruby/core/io/copy_stream_spec.rb343
-rw-r--r--spec/ruby/core/io/dup_spec.rb106
-rw-r--r--spec/ruby/core/io/each_byte_spec.rb57
-rw-r--r--spec/ruby/core/io/each_char_spec.rb12
-rw-r--r--spec/ruby/core/io/each_codepoint_spec.rb43
-rw-r--r--spec/ruby/core/io/each_line_spec.rb11
-rw-r--r--spec/ruby/core/io/each_spec.rb11
-rw-r--r--spec/ruby/core/io/eof_spec.rb107
-rw-r--r--spec/ruby/core/io/external_encoding_spec.rb223
-rw-r--r--spec/ruby/core/io/fcntl_spec.rb8
-rw-r--r--spec/ruby/core/io/fdatasync_spec.rb5
-rw-r--r--spec/ruby/core/io/fileno_spec.rb12
-rw-r--r--spec/ruby/core/io/fixtures/bom_UTF-16BE.txtbin0 -> 20 bytes-rw-r--r--spec/ruby/core/io/fixtures/bom_UTF-16LE.txtbin0 -> 20 bytes-rw-r--r--spec/ruby/core/io/fixtures/bom_UTF-32BE.txtbin0 -> 40 bytes-rw-r--r--spec/ruby/core/io/fixtures/bom_UTF-32LE.txtbin0 -> 40 bytes-rw-r--r--spec/ruby/core/io/fixtures/bom_UTF-8.txt1
-rw-r--r--spec/ruby/core/io/fixtures/classes.rb218
-rw-r--r--spec/ruby/core/io/fixtures/copy_in_out.rb2
-rw-r--r--spec/ruby/core/io/fixtures/copy_stream.txt6
-rw-r--r--spec/ruby/core/io/fixtures/empty.txt0
-rw-r--r--spec/ruby/core/io/fixtures/incomplete.txt1
-rw-r--r--spec/ruby/core/io/fixtures/lines.txt9
-rw-r--r--spec/ruby/core/io/fixtures/no_bom_UTF-8.txt1
-rw-r--r--spec/ruby/core/io/fixtures/numbered_lines.txt5
-rw-r--r--spec/ruby/core/io/fixtures/one_byte.txt1
-rw-r--r--spec/ruby/core/io/fixtures/read_binary.txt1
-rw-r--r--spec/ruby/core/io/fixtures/read_euc_jp.txt1
-rw-r--r--spec/ruby/core/io/fixtures/read_text.txt1
-rw-r--r--spec/ruby/core/io/fixtures/reopen_stdout.rb3
-rw-r--r--spec/ruby/core/io/flush_spec.rb37
-rw-r--r--spec/ruby/core/io/for_fd_spec.rb10
-rw-r--r--spec/ruby/core/io/foreach_spec.rb98
-rw-r--r--spec/ruby/core/io/fsync_spec.rb24
-rw-r--r--spec/ruby/core/io/getbyte_spec.rb58
-rw-r--r--spec/ruby/core/io/getc_spec.rb42
-rw-r--r--spec/ruby/core/io/gets_spec.rb360
-rw-r--r--spec/ruby/core/io/initialize_spec.rb60
-rw-r--r--spec/ruby/core/io/inspect_spec.rb23
-rw-r--r--spec/ruby/core/io/internal_encoding_spec.rb145
-rw-r--r--spec/ruby/core/io/io_spec.rb11
-rw-r--r--spec/ruby/core/io/ioctl_spec.rb32
-rw-r--r--spec/ruby/core/io/isatty_spec.rb6
-rw-r--r--spec/ruby/core/io/lineno_spec.rb138
-rw-r--r--spec/ruby/core/io/new_spec.rb18
-rw-r--r--spec/ruby/core/io/nonblock_spec.rb48
-rw-r--r--spec/ruby/core/io/open_spec.rb99
-rw-r--r--spec/ruby/core/io/output_spec.rb27
-rw-r--r--spec/ruby/core/io/path_spec.rb12
-rw-r--r--spec/ruby/core/io/pid_spec.rb35
-rw-r--r--spec/ruby/core/io/pipe_spec.rb225
-rw-r--r--spec/ruby/core/io/popen_spec.rb287
-rw-r--r--spec/ruby/core/io/pos_spec.rb11
-rw-r--r--spec/ruby/core/io/pread_spec.rb140
-rw-r--r--spec/ruby/core/io/print_spec.rb66
-rw-r--r--spec/ruby/core/io/printf_spec.rb32
-rw-r--r--spec/ruby/core/io/putc_spec.rb11
-rw-r--r--spec/ruby/core/io/puts_spec.rb139
-rw-r--r--spec/ruby/core/io/pwrite_spec.rb69
-rw-r--r--spec/ruby/core/io/read_nonblock_spec.rb148
-rw-r--r--spec/ruby/core/io/read_spec.rb757
-rw-r--r--spec/ruby/core/io/readbyte_spec.rb24
-rw-r--r--spec/ruby/core/io/readchar_spec.rb110
-rw-r--r--spec/ruby/core/io/readline_spec.rb84
-rw-r--r--spec/ruby/core/io/readlines_spec.rb259
-rw-r--r--spec/ruby/core/io/readpartial_spec.rb115
-rw-r--r--spec/ruby/core/io/reopen_spec.rb313
-rw-r--r--spec/ruby/core/io/rewind_spec.rb53
-rw-r--r--spec/ruby/core/io/seek_spec.rb79
-rw-r--r--spec/ruby/core/io/select_spec.rb164
-rw-r--r--spec/ruby/core/io/set_encoding_by_bom_spec.rb262
-rw-r--r--spec/ruby/core/io/set_encoding_spec.rb238
-rw-r--r--spec/ruby/core/io/shared/binwrite.rb91
-rw-r--r--spec/ruby/core/io/shared/chars.rb73
-rw-r--r--spec/ruby/core/io/shared/codepoints.rb54
-rw-r--r--spec/ruby/core/io/shared/each.rb251
-rw-r--r--spec/ruby/core/io/shared/gets_ascii.rb19
-rw-r--r--spec/ruby/core/io/shared/new.rb413
-rw-r--r--spec/ruby/core/io/shared/pos.rb78
-rw-r--r--spec/ruby/core/io/shared/readlines.rb259
-rw-r--r--spec/ruby/core/io/shared/tty.rb24
-rw-r--r--spec/ruby/core/io/shared/write.rb154
-rw-r--r--spec/ruby/core/io/stat_spec.rb25
-rw-r--r--spec/ruby/core/io/sync_spec.rb64
-rw-r--r--spec/ruby/core/io/sysopen_spec.rb50
-rw-r--r--spec/ruby/core/io/sysread_spec.rb137
-rw-r--r--spec/ruby/core/io/sysseek_spec.rb49
-rw-r--r--spec/ruby/core/io/syswrite_spec.rb82
-rw-r--r--spec/ruby/core/io/tell_spec.rb7
-rw-r--r--spec/ruby/core/io/to_i_spec.rb12
-rw-r--r--spec/ruby/core/io/to_io_spec.rb21
-rw-r--r--spec/ruby/core/io/try_convert_spec.rb49
-rw-r--r--spec/ruby/core/io/tty_spec.rb6
-rw-r--r--spec/ruby/core/io/ungetbyte_spec.rb54
-rw-r--r--spec/ruby/core/io/ungetc_spec.rb138
-rw-r--r--spec/ruby/core/io/write_nonblock_spec.rb96
-rw-r--r--spec/ruby/core/io/write_spec.rb297
-rw-r--r--spec/ruby/core/kernel/Array_spec.rb97
-rw-r--r--spec/ruby/core/kernel/Complex_spec.rb276
-rw-r--r--spec/ruby/core/kernel/Float_spec.rb413
-rw-r--r--spec/ruby/core/kernel/Hash_spec.rb63
-rw-r--r--spec/ruby/core/kernel/Integer_spec.rb823
-rw-r--r--spec/ruby/core/kernel/Rational_spec.rb236
-rw-r--r--spec/ruby/core/kernel/String_spec.rb106
-rw-r--r--spec/ruby/core/kernel/__callee___spec.rb48
-rw-r--r--spec/ruby/core/kernel/__dir___spec.rb27
-rw-r--r--spec/ruby/core/kernel/__method___spec.rb40
-rw-r--r--spec/ruby/core/kernel/abort_spec.rb15
-rw-r--r--spec/ruby/core/kernel/at_exit_spec.rb19
-rw-r--r--spec/ruby/core/kernel/autoload_spec.rb178
-rw-r--r--spec/ruby/core/kernel/backtick_spec.rb84
-rw-r--r--spec/ruby/core/kernel/binding_spec.rb51
-rw-r--r--spec/ruby/core/kernel/block_given_spec.rb43
-rw-r--r--spec/ruby/core/kernel/caller_locations_spec.rb110
-rw-r--r--spec/ruby/core/kernel/caller_spec.rb109
-rw-r--r--spec/ruby/core/kernel/case_compare_spec.rb135
-rw-r--r--spec/ruby/core/kernel/catch_spec.rb127
-rw-r--r--spec/ruby/core/kernel/chomp_spec.rb65
-rw-r--r--spec/ruby/core/kernel/chop_spec.rb53
-rw-r--r--spec/ruby/core/kernel/class_spec.rb26
-rw-r--r--spec/ruby/core/kernel/clone_spec.rb177
-rw-r--r--spec/ruby/core/kernel/comparison_spec.rb31
-rw-r--r--spec/ruby/core/kernel/define_singleton_method_spec.rb120
-rw-r--r--spec/ruby/core/kernel/display_spec.rb6
-rw-r--r--spec/ruby/core/kernel/dup_spec.rb67
-rw-r--r--spec/ruby/core/kernel/enum_for_spec.rb5
-rw-r--r--spec/ruby/core/kernel/eql_spec.rb10
-rw-r--r--spec/ruby/core/kernel/equal_value_spec.rb15
-rw-r--r--spec/ruby/core/kernel/eval_spec.rb570
-rw-r--r--spec/ruby/core/kernel/exec_spec.rb18
-rw-r--r--spec/ruby/core/kernel/exit_spec.rb27
-rw-r--r--spec/ruby/core/kernel/extend_spec.rb91
-rw-r--r--spec/ruby/core/kernel/fail_spec.rb42
-rw-r--r--spec/ruby/core/kernel/fixtures/Complex.rb5
-rw-r--r--spec/ruby/core/kernel/fixtures/__callee__.rb34
-rw-r--r--spec/ruby/core/kernel/fixtures/__dir__.rb2
-rw-r--r--spec/ruby/core/kernel/fixtures/__method__.rb34
-rw-r--r--spec/ruby/core/kernel/fixtures/autoload_b.rb5
-rw-r--r--spec/ruby/core/kernel/fixtures/autoload_d.rb5
-rw-r--r--spec/ruby/core/kernel/fixtures/autoload_from_included_module.rb9
-rw-r--r--spec/ruby/core/kernel/fixtures/autoload_from_included_module2.rb9
-rw-r--r--spec/ruby/core/kernel/fixtures/autoload_frozen.rb7
-rw-r--r--spec/ruby/core/kernel/fixtures/caller.rb7
-rw-r--r--spec/ruby/core/kernel/fixtures/caller_at_exit.rb7
-rw-r--r--spec/ruby/core/kernel/fixtures/caller_locations.rb7
-rw-r--r--spec/ruby/core/kernel/fixtures/chomp.rb4
-rw-r--r--spec/ruby/core/kernel/fixtures/chomp_f.rb4
-rw-r--r--spec/ruby/core/kernel/fixtures/chop.rb4
-rw-r--r--spec/ruby/core/kernel/fixtures/chop_f.rb4
-rw-r--r--spec/ruby/core/kernel/fixtures/classes.rb558
-rw-r--r--spec/ruby/core/kernel/fixtures/eval_locals.rb6
-rw-r--r--spec/ruby/core/kernel/fixtures/eval_return_with_lambda.rb12
-rw-r--r--spec/ruby/core/kernel/fixtures/eval_return_without_lambda.rb14
-rw-r--r--spec/ruby/core/kernel/fixtures/singleton_methods.rb13
-rw-r--r--spec/ruby/core/kernel/fixtures/test.rb362
-rw-r--r--spec/ruby/core/kernel/fixtures/warn_core_method.rb14
-rw-r--r--spec/ruby/core/kernel/fixtures/warn_require.rb1
-rw-r--r--spec/ruby/core/kernel/fixtures/warn_require_caller.rb2
-rw-r--r--spec/ruby/core/kernel/fork_spec.rb15
-rw-r--r--spec/ruby/core/kernel/format_spec.rb47
-rw-r--r--spec/ruby/core/kernel/freeze_spec.rb91
-rw-r--r--spec/ruby/core/kernel/frozen_spec.rb76
-rw-r--r--spec/ruby/core/kernel/gets_spec.rb17
-rw-r--r--spec/ruby/core/kernel/global_variables_spec.rb26
-rw-r--r--spec/ruby/core/kernel/gsub_spec.rb96
-rw-r--r--spec/ruby/core/kernel/initialize_clone_spec.rb26
-rw-r--r--spec/ruby/core/kernel/initialize_copy_spec.rb36
-rw-r--r--spec/ruby/core/kernel/initialize_dup_spec.rb20
-rw-r--r--spec/ruby/core/kernel/inspect_spec.rb90
-rw-r--r--spec/ruby/core/kernel/instance_of_spec.rb40
-rw-r--r--spec/ruby/core/kernel/instance_variable_defined_spec.rb41
-rw-r--r--spec/ruby/core/kernel/instance_variable_get_spec.rb111
-rw-r--r--spec/ruby/core/kernel/instance_variable_set_spec.rb105
-rw-r--r--spec/ruby/core/kernel/instance_variables_spec.rb40
-rw-r--r--spec/ruby/core/kernel/is_a_spec.rb6
-rw-r--r--spec/ruby/core/kernel/itself_spec.rb9
-rw-r--r--spec/ruby/core/kernel/kind_of_spec.rb6
-rw-r--r--spec/ruby/core/kernel/lambda_spec.rb158
-rw-r--r--spec/ruby/core/kernel/load_spec.rb40
-rw-r--r--spec/ruby/core/kernel/local_variables_spec.rb48
-rw-r--r--spec/ruby/core/kernel/loop_spec.rb79
-rw-r--r--spec/ruby/core/kernel/match_spec.rb7
-rw-r--r--spec/ruby/core/kernel/method_spec.rb80
-rw-r--r--spec/ruby/core/kernel/methods_spec.rb101
-rw-r--r--spec/ruby/core/kernel/nil_spec.rb12
-rw-r--r--spec/ruby/core/kernel/not_match_spec.rb25
-rw-r--r--spec/ruby/core/kernel/object_id_spec.rb6
-rw-r--r--spec/ruby/core/kernel/open_spec.rb194
-rw-r--r--spec/ruby/core/kernel/p_spec.rb85
-rw-r--r--spec/ruby/core/kernel/pp_spec.rb9
-rw-r--r--spec/ruby/core/kernel/print_spec.rb24
-rw-r--r--spec/ruby/core/kernel/printf_spec.rb70
-rw-r--r--spec/ruby/core/kernel/private_methods_spec.rb69
-rw-r--r--spec/ruby/core/kernel/proc_spec.rb48
-rw-r--r--spec/ruby/core/kernel/protected_methods_spec.rb69
-rw-r--r--spec/ruby/core/kernel/public_method_spec.rb32
-rw-r--r--spec/ruby/core/kernel/public_methods_spec.rb76
-rw-r--r--spec/ruby/core/kernel/public_send_spec.rb116
-rw-r--r--spec/ruby/core/kernel/putc_spec.rb39
-rw-r--r--spec/ruby/core/kernel/puts_spec.rb29
-rw-r--r--spec/ruby/core/kernel/raise_spec.rb292
-rw-r--r--spec/ruby/core/kernel/rand_spec.rb197
-rw-r--r--spec/ruby/core/kernel/readline_spec.rb12
-rw-r--r--spec/ruby/core/kernel/readlines_spec.rb12
-rw-r--r--spec/ruby/core/kernel/remove_instance_variable_spec.rb72
-rw-r--r--spec/ruby/core/kernel/require_relative_spec.rb437
-rw-r--r--spec/ruby/core/kernel/require_spec.rb60
-rw-r--r--spec/ruby/core/kernel/respond_to_missing_spec.rb100
-rw-r--r--spec/ruby/core/kernel/respond_to_spec.rb72
-rw-r--r--spec/ruby/core/kernel/select_spec.rb18
-rw-r--r--spec/ruby/core/kernel/send_spec.rb68
-rw-r--r--spec/ruby/core/kernel/set_trace_func_spec.rb12
-rw-r--r--spec/ruby/core/kernel/shared/dup_clone.rb91
-rw-r--r--spec/ruby/core/kernel/shared/kind_of.rb55
-rw-r--r--spec/ruby/core/kernel/shared/lambda.rb11
-rw-r--r--spec/ruby/core/kernel/shared/load.rb215
-rw-r--r--spec/ruby/core/kernel/shared/method.rb56
-rw-r--r--spec/ruby/core/kernel/shared/require.rb848
-rw-r--r--spec/ruby/core/kernel/shared/sprintf.rb987
-rw-r--r--spec/ruby/core/kernel/shared/sprintf_encoding.rb67
-rw-r--r--spec/ruby/core/kernel/shared/then.rb20
-rw-r--r--spec/ruby/core/kernel/singleton_class_spec.rb74
-rw-r--r--spec/ruby/core/kernel/singleton_method_spec.rb85
-rw-r--r--spec/ruby/core/kernel/singleton_methods_spec.rb192
-rw-r--r--spec/ruby/core/kernel/sleep_spec.rb126
-rw-r--r--spec/ruby/core/kernel/spawn_spec.rb25
-rw-r--r--spec/ruby/core/kernel/sprintf_spec.rb64
-rw-r--r--spec/ruby/core/kernel/srand_spec.rb73
-rw-r--r--spec/ruby/core/kernel/sub_spec.rb26
-rw-r--r--spec/ruby/core/kernel/syscall_spec.rb12
-rw-r--r--spec/ruby/core/kernel/system_spec.rb132
-rw-r--r--spec/ruby/core/kernel/taint_spec.rb8
-rw-r--r--spec/ruby/core/kernel/tainted_spec.rb8
-rw-r--r--spec/ruby/core/kernel/tap_spec.rb13
-rw-r--r--spec/ruby/core/kernel/test_spec.rb109
-rw-r--r--spec/ruby/core/kernel/then_spec.rb6
-rw-r--r--spec/ruby/core/kernel/throw_spec.rb80
-rw-r--r--spec/ruby/core/kernel/to_enum_spec.rb5
-rw-r--r--spec/ruby/core/kernel/to_s_spec.rb8
-rw-r--r--spec/ruby/core/kernel/trace_var_spec.rb54
-rw-r--r--spec/ruby/core/kernel/trap_spec.rb9
-rw-r--r--spec/ruby/core/kernel/trust_spec.rb8
-rw-r--r--spec/ruby/core/kernel/untaint_spec.rb8
-rw-r--r--spec/ruby/core/kernel/untrace_var_spec.rb12
-rw-r--r--spec/ruby/core/kernel/untrust_spec.rb8
-rw-r--r--spec/ruby/core/kernel/untrusted_spec.rb8
-rw-r--r--spec/ruby/core/kernel/warn_spec.rb298
-rw-r--r--spec/ruby/core/kernel/yield_self_spec.rb6
-rw-r--r--spec/ruby/core/main/define_method_spec.rb28
-rw-r--r--spec/ruby/core/main/fixtures/classes.rb26
-rw-r--r--spec/ruby/core/main/fixtures/string_refinement.rb7
-rw-r--r--spec/ruby/core/main/fixtures/string_refinement_user.rb11
-rw-r--r--spec/ruby/core/main/fixtures/using.rb1
-rw-r--r--spec/ruby/core/main/fixtures/using_in_main.rb5
-rw-r--r--spec/ruby/core/main/fixtures/using_in_method.rb5
-rw-r--r--spec/ruby/core/main/fixtures/wrapped_include.rb1
-rw-r--r--spec/ruby/core/main/include_spec.rb16
-rw-r--r--spec/ruby/core/main/private_spec.rb42
-rw-r--r--spec/ruby/core/main/public_spec.rb43
-rw-r--r--spec/ruby/core/main/ruby2_keywords_spec.rb9
-rw-r--r--spec/ruby/core/main/to_s_spec.rb7
-rw-r--r--spec/ruby/core/main/using_spec.rb150
-rw-r--r--spec/ruby/core/marshal/dump_spec.rb1070
-rw-r--r--spec/ruby/core/marshal/fixtures/classes.rb4
-rw-r--r--spec/ruby/core/marshal/fixtures/marshal_data.rb567
-rw-r--r--spec/ruby/core/marshal/fixtures/marshal_multibyte_data.rb12
-rw-r--r--spec/ruby/core/marshal/fixtures/random.dumpbin0 -> 2520 bytes-rw-r--r--spec/ruby/core/marshal/float_spec.rb77
-rw-r--r--spec/ruby/core/marshal/load_spec.rb6
-rw-r--r--spec/ruby/core/marshal/major_version_spec.rb7
-rw-r--r--spec/ruby/core/marshal/minor_version_spec.rb7
-rw-r--r--spec/ruby/core/marshal/restore_spec.rb6
-rw-r--r--spec/ruby/core/marshal/shared/load.rb1270
-rw-r--r--spec/ruby/core/matchdata/allocate_spec.rb8
-rw-r--r--spec/ruby/core/matchdata/begin_spec.rb132
-rw-r--r--spec/ruby/core/matchdata/bytebegin_spec.rb132
-rw-r--r--spec/ruby/core/matchdata/byteend_spec.rb104
-rw-r--r--spec/ruby/core/matchdata/byteoffset_spec.rb93
-rw-r--r--spec/ruby/core/matchdata/captures_spec.rb6
-rw-r--r--spec/ruby/core/matchdata/deconstruct_keys_spec.rb63
-rw-r--r--spec/ruby/core/matchdata/deconstruct_spec.rb6
-rw-r--r--spec/ruby/core/matchdata/dup_spec.rb14
-rw-r--r--spec/ruby/core/matchdata/element_reference_spec.rb124
-rw-r--r--spec/ruby/core/matchdata/end_spec.rb104
-rw-r--r--spec/ruby/core/matchdata/eql_spec.rb6
-rw-r--r--spec/ruby/core/matchdata/equal_value_spec.rb6
-rw-r--r--spec/ruby/core/matchdata/fixtures/classes.rb3
-rw-r--r--spec/ruby/core/matchdata/hash_spec.rb5
-rw-r--r--spec/ruby/core/matchdata/inspect_spec.rb23
-rw-r--r--spec/ruby/core/matchdata/length_spec.rb6
-rw-r--r--spec/ruby/core/matchdata/match_length_spec.rb32
-rw-r--r--spec/ruby/core/matchdata/match_spec.rb32
-rw-r--r--spec/ruby/core/matchdata/named_captures_spec.rb27
-rw-r--r--spec/ruby/core/matchdata/names_spec.rb33
-rw-r--r--spec/ruby/core/matchdata/offset_spec.rb102
-rw-r--r--spec/ruby/core/matchdata/post_match_spec.rb24
-rw-r--r--spec/ruby/core/matchdata/pre_match_spec.rb24
-rw-r--r--spec/ruby/core/matchdata/regexp_spec.rb24
-rw-r--r--spec/ruby/core/matchdata/shared/captures.rb13
-rw-r--r--spec/ruby/core/matchdata/shared/eql.rb26
-rw-r--r--spec/ruby/core/matchdata/shared/length.rb5
-rw-r--r--spec/ruby/core/matchdata/size_spec.rb6
-rw-r--r--spec/ruby/core/matchdata/string_spec.rb26
-rw-r--r--spec/ruby/core/matchdata/to_a_spec.rb13
-rw-r--r--spec/ruby/core/matchdata/to_s_spec.rb13
-rw-r--r--spec/ruby/core/matchdata/values_at_spec.rb76
-rw-r--r--spec/ruby/core/math/acos_spec.rb56
-rw-r--r--spec/ruby/core/math/acosh_spec.rb41
-rw-r--r--spec/ruby/core/math/asin_spec.rb48
-rw-r--r--spec/ruby/core/math/asinh_spec.rb42
-rw-r--r--spec/ruby/core/math/atan2_spec.rb54
-rw-r--r--spec/ruby/core/math/atan_spec.rb40
-rw-r--r--spec/ruby/core/math/atanh_spec.rb14
-rw-r--r--spec/ruby/core/math/cbrt_spec.rb27
-rw-r--r--spec/ruby/core/math/constants_spec.rb22
-rw-r--r--spec/ruby/core/math/cos_spec.rb50
-rw-r--r--spec/ruby/core/math/cosh_spec.rb37
-rw-r--r--spec/ruby/core/math/erf_spec.rb44
-rw-r--r--spec/ruby/core/math/erfc_spec.rb43
-rw-r--r--spec/ruby/core/math/exp_spec.rb37
-rw-r--r--spec/ruby/core/math/expm1_spec.rb37
-rw-r--r--spec/ruby/core/math/fixtures/classes.rb28
-rw-r--r--spec/ruby/core/math/fixtures/common.rb3
-rw-r--r--spec/ruby/core/math/frexp_spec.rb37
-rw-r--r--spec/ruby/core/math/gamma_spec.rb69
-rw-r--r--spec/ruby/core/math/hypot_spec.rb41
-rw-r--r--spec/ruby/core/math/ldexp_spec.rb60
-rw-r--r--spec/ruby/core/math/lgamma_spec.rb51
-rw-r--r--spec/ruby/core/math/log10_spec.rb43
-rw-r--r--spec/ruby/core/math/log1p_spec.rb49
-rw-r--r--spec/ruby/core/math/log2_spec.rb41
-rw-r--r--spec/ruby/core/math/log_spec.rb57
-rw-r--r--spec/ruby/core/math/shared/atanh.rb44
-rw-r--r--spec/ruby/core/math/sin_spec.rb39
-rw-r--r--spec/ruby/core/math/sinh_spec.rb37
-rw-r--r--spec/ruby/core/math/sqrt_spec.rb40
-rw-r--r--spec/ruby/core/math/tan_spec.rb42
-rw-r--r--spec/ruby/core/math/tanh_spec.rb39
-rw-r--r--spec/ruby/core/method/arity_spec.rb222
-rw-r--r--spec/ruby/core/method/call_spec.rb7
-rw-r--r--spec/ruby/core/method/case_compare_spec.rb7
-rw-r--r--spec/ruby/core/method/clone_spec.rb13
-rw-r--r--spec/ruby/core/method/compose_spec.rb99
-rw-r--r--spec/ruby/core/method/curry_spec.rb36
-rw-r--r--spec/ruby/core/method/dup_spec.rb15
-rw-r--r--spec/ruby/core/method/element_reference_spec.rb7
-rw-r--r--spec/ruby/core/method/eql_spec.rb6
-rw-r--r--spec/ruby/core/method/equal_value_spec.rb6
-rw-r--r--spec/ruby/core/method/fixtures/classes.rb246
-rw-r--r--spec/ruby/core/method/hash_spec.rb15
-rw-r--r--spec/ruby/core/method/inspect_spec.rb6
-rw-r--r--spec/ruby/core/method/name_spec.rb22
-rw-r--r--spec/ruby/core/method/original_name_spec.rb22
-rw-r--r--spec/ruby/core/method/owner_spec.rb30
-rw-r--r--spec/ruby/core/method/parameters_spec.rb304
-rw-r--r--spec/ruby/core/method/private_spec.rb9
-rw-r--r--spec/ruby/core/method/protected_spec.rb9
-rw-r--r--spec/ruby/core/method/public_spec.rb9
-rw-r--r--spec/ruby/core/method/receiver_spec.rb22
-rw-r--r--spec/ruby/core/method/shared/call.rb51
-rw-r--r--spec/ruby/core/method/shared/dup.rb32
-rw-r--r--spec/ruby/core/method/shared/eql.rb94
-rw-r--r--spec/ruby/core/method/shared/to_s.rb81
-rw-r--r--spec/ruby/core/method/source_location_spec.rb126
-rw-r--r--spec/ruby/core/method/super_method_spec.rb64
-rw-r--r--spec/ruby/core/method/to_proc_spec.rb104
-rw-r--r--spec/ruby/core/method/to_s_spec.rb6
-rw-r--r--spec/ruby/core/method/unbind_spec.rb46
-rw-r--r--spec/ruby/core/module/alias_method_spec.rb171
-rw-r--r--spec/ruby/core/module/ancestors_spec.rb88
-rw-r--r--spec/ruby/core/module/append_features_spec.rb61
-rw-r--r--spec/ruby/core/module/attr_accessor_spec.rb112
-rw-r--r--spec/ruby/core/module/attr_reader_spec.rb73
-rw-r--r--spec/ruby/core/module/attr_spec.rb159
-rw-r--r--spec/ruby/core/module/attr_writer_spec.rb83
-rw-r--r--spec/ruby/core/module/autoload_spec.rb1026
-rw-r--r--spec/ruby/core/module/case_compare_spec.rb31
-rw-r--r--spec/ruby/core/module/class_eval_spec.rb7
-rw-r--r--spec/ruby/core/module/class_exec_spec.rb7
-rw-r--r--spec/ruby/core/module/class_variable_defined_spec.rb72
-rw-r--r--spec/ruby/core/module/class_variable_get_spec.rb76
-rw-r--r--spec/ruby/core/module/class_variable_set_spec.rb62
-rw-r--r--spec/ruby/core/module/class_variables_spec.rb34
-rw-r--r--spec/ruby/core/module/comparison_spec.rb36
-rw-r--r--spec/ruby/core/module/const_added_spec.rb238
-rw-r--r--spec/ruby/core/module/const_defined_spec.rb169
-rw-r--r--spec/ruby/core/module/const_get_spec.rb273
-rw-r--r--spec/ruby/core/module/const_missing_spec.rb36
-rw-r--r--spec/ruby/core/module/const_set_spec.rb145
-rw-r--r--spec/ruby/core/module/const_source_location_spec.rb281
-rw-r--r--spec/ruby/core/module/constants_spec.rb97
-rw-r--r--spec/ruby/core/module/define_method_spec.rb846
-rw-r--r--spec/ruby/core/module/define_singleton_method_spec.rb15
-rw-r--r--spec/ruby/core/module/deprecate_constant_spec.rb70
-rw-r--r--spec/ruby/core/module/eql_spec.rb7
-rw-r--r--spec/ruby/core/module/equal_spec.rb7
-rw-r--r--spec/ruby/core/module/equal_value_spec.rb7
-rw-r--r--spec/ruby/core/module/extend_object_spec.rb56
-rw-r--r--spec/ruby/core/module/extended_spec.rb44
-rw-r--r--spec/ruby/core/module/fixtures/autoload.rb1
-rw-r--r--spec/ruby/core/module/fixtures/autoload_abc.rb11
-rw-r--r--spec/ruby/core/module/fixtures/autoload_c.rb11
-rw-r--r--spec/ruby/core/module/fixtures/autoload_callback.rb2
-rw-r--r--spec/ruby/core/module/fixtures/autoload_concur.rb9
-rw-r--r--spec/ruby/core/module/fixtures/autoload_const_source_location.rb6
-rw-r--r--spec/ruby/core/module/fixtures/autoload_d.rb11
-rw-r--r--spec/ruby/core/module/fixtures/autoload_during_autoload.rb7
-rw-r--r--spec/ruby/core/module/fixtures/autoload_during_autoload_after_define.rb6
-rw-r--r--spec/ruby/core/module/fixtures/autoload_during_require.rb4
-rw-r--r--spec/ruby/core/module/fixtures/autoload_during_require_current_file.rb5
-rw-r--r--spec/ruby/core/module/fixtures/autoload_e.rb7
-rw-r--r--spec/ruby/core/module/fixtures/autoload_empty.rb1
-rw-r--r--spec/ruby/core/module/fixtures/autoload_ex1.rb16
-rw-r--r--spec/ruby/core/module/fixtures/autoload_exception.rb3
-rw-r--r--spec/ruby/core/module/fixtures/autoload_f.rb7
-rw-r--r--spec/ruby/core/module/fixtures/autoload_g.rb7
-rw-r--r--spec/ruby/core/module/fixtures/autoload_h.rb7
-rw-r--r--spec/ruby/core/module/fixtures/autoload_i.rb5
-rw-r--r--spec/ruby/core/module/fixtures/autoload_j.rb3
-rw-r--r--spec/ruby/core/module/fixtures/autoload_k.rb7
-rw-r--r--spec/ruby/core/module/fixtures/autoload_lm.rb4
-rw-r--r--spec/ruby/core/module/fixtures/autoload_location.rb3
-rw-r--r--spec/ruby/core/module/fixtures/autoload_nested.rb8
-rw-r--r--spec/ruby/core/module/fixtures/autoload_never_set.rb1
-rw-r--r--spec/ruby/core/module/fixtures/autoload_o.rb2
-rw-r--r--spec/ruby/core/module/fixtures/autoload_overridden.rb3
-rw-r--r--spec/ruby/core/module/fixtures/autoload_r.rb4
-rw-r--r--spec/ruby/core/module/fixtures/autoload_raise.rb2
-rw-r--r--spec/ruby/core/module/fixtures/autoload_required_directly.rb7
-rw-r--r--spec/ruby/core/module/fixtures/autoload_required_directly_nested.rb1
-rw-r--r--spec/ruby/core/module/fixtures/autoload_required_directly_no_constant.rb2
-rw-r--r--spec/ruby/core/module/fixtures/autoload_s.rb5
-rw-r--r--spec/ruby/core/module/fixtures/autoload_self_during_require.rb5
-rw-r--r--spec/ruby/core/module/fixtures/autoload_subclass.rb11
-rw-r--r--spec/ruby/core/module/fixtures/autoload_t.rb3
-rw-r--r--spec/ruby/core/module/fixtures/autoload_v.rb7
-rw-r--r--spec/ruby/core/module/fixtures/autoload_w.rb2
-rw-r--r--spec/ruby/core/module/fixtures/autoload_w2.rb1
-rw-r--r--spec/ruby/core/module/fixtures/autoload_x.rb3
-rw-r--r--spec/ruby/core/module/fixtures/autoload_z.rb5
-rw-r--r--spec/ruby/core/module/fixtures/classes.rb653
-rw-r--r--spec/ruby/core/module/fixtures/const_added.rb4
-rw-r--r--spec/ruby/core/module/fixtures/constant_unicode.rb5
-rw-r--r--spec/ruby/core/module/fixtures/constants_autoload.rb6
-rw-r--r--spec/ruby/core/module/fixtures/constants_autoload_a.rb2
-rw-r--r--spec/ruby/core/module/fixtures/constants_autoload_b.rb2
-rw-r--r--spec/ruby/core/module/fixtures/constants_autoload_c.rb3
-rw-r--r--spec/ruby/core/module/fixtures/constants_autoload_d.rb4
-rw-r--r--spec/ruby/core/module/fixtures/module.rb8
-rw-r--r--spec/ruby/core/module/fixtures/multi/foo.rb6
-rw-r--r--spec/ruby/core/module/fixtures/multi/foo/bar_baz.rb11
-rw-r--r--spec/ruby/core/module/fixtures/name.rb13
-rw-r--r--spec/ruby/core/module/fixtures/path1/load_path.rb9
-rw-r--r--spec/ruby/core/module/fixtures/path2/load_path.rb1
-rw-r--r--spec/ruby/core/module/fixtures/refine.rb25
-rw-r--r--spec/ruby/core/module/fixtures/repeated_concurrent_autoload.rb8
-rw-r--r--spec/ruby/core/module/fixtures/set_temporary_name.rb4
-rw-r--r--spec/ruby/core/module/freeze_spec.rb6
-rw-r--r--spec/ruby/core/module/gt_spec.rb36
-rw-r--r--spec/ruby/core/module/gte_spec.rb33
-rw-r--r--spec/ruby/core/module/include_spec.rb628
-rw-r--r--spec/ruby/core/module/included_modules_spec.rb14
-rw-r--r--spec/ruby/core/module/included_spec.rb44
-rw-r--r--spec/ruby/core/module/initialize_copy_spec.rb18
-rw-r--r--spec/ruby/core/module/initialize_spec.rb18
-rw-r--r--spec/ruby/core/module/instance_method_spec.rb106
-rw-r--r--spec/ruby/core/module/instance_methods_spec.rb61
-rw-r--r--spec/ruby/core/module/lt_spec.rb36
-rw-r--r--spec/ruby/core/module/lte_spec.rb33
-rw-r--r--spec/ruby/core/module/method_added_spec.rb146
-rw-r--r--spec/ruby/core/module/method_defined_spec.rb98
-rw-r--r--spec/ruby/core/module/method_removed_spec.rb33
-rw-r--r--spec/ruby/core/module/method_undefined_spec.rb33
-rw-r--r--spec/ruby/core/module/module_eval_spec.rb7
-rw-r--r--spec/ruby/core/module/module_exec_spec.rb7
-rw-r--r--spec/ruby/core/module/module_function_spec.rb358
-rw-r--r--spec/ruby/core/module/name_spec.rb205
-rw-r--r--spec/ruby/core/module/nesting_spec.rb31
-rw-r--r--spec/ruby/core/module/new_spec.rb35
-rw-r--r--spec/ruby/core/module/prepend_features_spec.rb64
-rw-r--r--spec/ruby/core/module/prepend_spec.rb823
-rw-r--r--spec/ruby/core/module/prepended_spec.rb25
-rw-r--r--spec/ruby/core/module/private_class_method_spec.rb91
-rw-r--r--spec/ruby/core/module/private_constant_spec.rb32
-rw-r--r--spec/ruby/core/module/private_instance_methods_spec.rb54
-rw-r--r--spec/ruby/core/module/private_method_defined_spec.rb120
-rw-r--r--spec/ruby/core/module/private_spec.rb95
-rw-r--r--spec/ruby/core/module/protected_instance_methods_spec.rb57
-rw-r--r--spec/ruby/core/module/protected_method_defined_spec.rb120
-rw-r--r--spec/ruby/core/module/protected_spec.rb57
-rw-r--r--spec/ruby/core/module/public_class_method_spec.rb94
-rw-r--r--spec/ruby/core/module/public_constant_spec.rb38
-rw-r--r--spec/ruby/core/module/public_instance_method_spec.rb65
-rw-r--r--spec/ruby/core/module/public_instance_methods_spec.rb61
-rw-r--r--spec/ruby/core/module/public_method_defined_spec.rb72
-rw-r--r--spec/ruby/core/module/public_spec.rb45
-rw-r--r--spec/ruby/core/module/refine_spec.rb714
-rw-r--r--spec/ruby/core/module/refinements_spec.rb43
-rw-r--r--spec/ruby/core/module/remove_class_variable_spec.rb44
-rw-r--r--spec/ruby/core/module/remove_const_spec.rb107
-rw-r--r--spec/ruby/core/module/remove_method_spec.rb131
-rw-r--r--spec/ruby/core/module/ruby2_keywords_spec.rb248
-rw-r--r--spec/ruby/core/module/set_temporary_name_spec.rb147
-rw-r--r--spec/ruby/core/module/shared/attr_added.rb34
-rw-r--r--spec/ruby/core/module/shared/class_eval.rb174
-rw-r--r--spec/ruby/core/module/shared/class_exec.rb29
-rw-r--r--spec/ruby/core/module/shared/equal_value.rb14
-rw-r--r--spec/ruby/core/module/shared/set_visibility.rb184
-rw-r--r--spec/ruby/core/module/singleton_class_spec.rb27
-rw-r--r--spec/ruby/core/module/to_s_spec.rb70
-rw-r--r--spec/ruby/core/module/undef_method_spec.rb181
-rw-r--r--spec/ruby/core/module/undefined_instance_methods_spec.rb24
-rw-r--r--spec/ruby/core/module/used_refinements_spec.rb85
-rw-r--r--spec/ruby/core/module/using_spec.rb377
-rw-r--r--spec/ruby/core/mutex/lock_spec.rb30
-rw-r--r--spec/ruby/core/mutex/locked_spec.rb36
-rw-r--r--spec/ruby/core/mutex/owned_spec.rb53
-rw-r--r--spec/ruby/core/mutex/sleep_spec.rb103
-rw-r--r--spec/ruby/core/mutex/synchronize_spec.rb66
-rw-r--r--spec/ruby/core/mutex/try_lock_spec.rb32
-rw-r--r--spec/ruby/core/mutex/unlock_spec.rb38
-rw-r--r--spec/ruby/core/nil/and_spec.rb11
-rw-r--r--spec/ruby/core/nil/case_compare_spec.rb13
-rw-r--r--spec/ruby/core/nil/dup_spec.rb7
-rw-r--r--spec/ruby/core/nil/inspect_spec.rb7
-rw-r--r--spec/ruby/core/nil/match_spec.rb21
-rw-r--r--spec/ruby/core/nil/nil_spec.rb7
-rw-r--r--spec/ruby/core/nil/nilclass_spec.rb15
-rw-r--r--spec/ruby/core/nil/or_spec.rb11
-rw-r--r--spec/ruby/core/nil/rationalize_spec.rb16
-rw-r--r--spec/ruby/core/nil/singleton_method_spec.rb15
-rw-r--r--spec/ruby/core/nil/to_a_spec.rb7
-rw-r--r--spec/ruby/core/nil/to_c_spec.rb7
-rw-r--r--spec/ruby/core/nil/to_f_spec.rb11
-rw-r--r--spec/ruby/core/nil/to_h_spec.rb8
-rw-r--r--spec/ruby/core/nil/to_i_spec.rb11
-rw-r--r--spec/ruby/core/nil/to_r_spec.rb7
-rw-r--r--spec/ruby/core/nil/to_s_spec.rb15
-rw-r--r--spec/ruby/core/nil/xor_spec.rb11
-rw-r--r--spec/ruby/core/numeric/abs2_spec.rb34
-rw-r--r--spec/ruby/core/numeric/abs_spec.rb6
-rw-r--r--spec/ruby/core/numeric/angle_spec.rb6
-rw-r--r--spec/ruby/core/numeric/arg_spec.rb6
-rw-r--r--spec/ruby/core/numeric/ceil_spec.rb15
-rw-r--r--spec/ruby/core/numeric/clone_spec.rb30
-rw-r--r--spec/ruby/core/numeric/coerce_spec.rb59
-rw-r--r--spec/ruby/core/numeric/comparison_spec.rb48
-rw-r--r--spec/ruby/core/numeric/conj_spec.rb6
-rw-r--r--spec/ruby/core/numeric/conjugate_spec.rb6
-rw-r--r--spec/ruby/core/numeric/denominator_spec.rb24
-rw-r--r--spec/ruby/core/numeric/div_spec.rb22
-rw-r--r--spec/ruby/core/numeric/divmod_spec.rb15
-rw-r--r--spec/ruby/core/numeric/dup_spec.rb16
-rw-r--r--spec/ruby/core/numeric/eql_spec.rb22
-rw-r--r--spec/ruby/core/numeric/fdiv_spec.rb31
-rw-r--r--spec/ruby/core/numeric/finite_spec.rb8
-rw-r--r--spec/ruby/core/numeric/fixtures/classes.rb17
-rw-r--r--spec/ruby/core/numeric/floor_spec.rb14
-rw-r--r--spec/ruby/core/numeric/i_spec.rb15
-rw-r--r--spec/ruby/core/numeric/imag_spec.rb6
-rw-r--r--spec/ruby/core/numeric/imaginary_spec.rb6
-rw-r--r--spec/ruby/core/numeric/infinite_spec.rb8
-rw-r--r--spec/ruby/core/numeric/integer_spec.rb8
-rw-r--r--spec/ruby/core/numeric/magnitude_spec.rb6
-rw-r--r--spec/ruby/core/numeric/modulo_spec.rb24
-rw-r--r--spec/ruby/core/numeric/negative_spec.rb41
-rw-r--r--spec/ruby/core/numeric/nonzero_spec.rb18
-rw-r--r--spec/ruby/core/numeric/numerator_spec.rb33
-rw-r--r--spec/ruby/core/numeric/numeric_spec.rb7
-rw-r--r--spec/ruby/core/numeric/phase_spec.rb6
-rw-r--r--spec/ruby/core/numeric/polar_spec.rb50
-rw-r--r--spec/ruby/core/numeric/positive_spec.rb41
-rw-r--r--spec/ruby/core/numeric/quo_spec.rb63
-rw-r--r--spec/ruby/core/numeric/real_spec.rb37
-rw-r--r--spec/ruby/core/numeric/rect_spec.rb6
-rw-r--r--spec/ruby/core/numeric/rectangular_spec.rb6
-rw-r--r--spec/ruby/core/numeric/remainder_spec.rb70
-rw-r--r--spec/ruby/core/numeric/round_spec.rb14
-rw-r--r--spec/ruby/core/numeric/shared/abs.rb19
-rw-r--r--spec/ruby/core/numeric/shared/arg.rb38
-rw-r--r--spec/ruby/core/numeric/shared/conj.rb20
-rw-r--r--spec/ruby/core/numeric/shared/imag.rb26
-rw-r--r--spec/ruby/core/numeric/shared/rect.rb48
-rw-r--r--spec/ruby/core/numeric/shared/step.rb410
-rw-r--r--spec/ruby/core/numeric/singleton_method_added_spec.rb41
-rw-r--r--spec/ruby/core/numeric/step_spec.rb121
-rw-r--r--spec/ruby/core/numeric/to_c_spec.rb45
-rw-r--r--spec/ruby/core/numeric/to_int_spec.rb10
-rw-r--r--spec/ruby/core/numeric/truncate_spec.rb14
-rw-r--r--spec/ruby/core/numeric/uminus_spec.rb31
-rw-r--r--spec/ruby/core/numeric/uplus_spec.rb9
-rw-r--r--spec/ruby/core/numeric/zero_spec.rb18
-rw-r--r--spec/ruby/core/objectspace/_id2ref_spec.rb65
-rw-r--r--spec/ruby/core/objectspace/count_objects_spec.rb5
-rw-r--r--spec/ruby/core/objectspace/define_finalizer_spec.rb215
-rw-r--r--spec/ruby/core/objectspace/each_object_spec.rb213
-rw-r--r--spec/ruby/core/objectspace/fixtures/classes.rb64
-rw-r--r--spec/ruby/core/objectspace/garbage_collect_spec.rb22
-rw-r--r--spec/ruby/core/objectspace/undefine_finalizer_spec.rb33
-rw-r--r--spec/ruby/core/objectspace/weakkeymap/clear_spec.rb27
-rw-r--r--spec/ruby/core/objectspace/weakkeymap/delete_spec.rb51
-rw-r--r--spec/ruby/core/objectspace/weakkeymap/element_reference_spec.rb107
-rw-r--r--spec/ruby/core/objectspace/weakkeymap/element_set_spec.rb82
-rw-r--r--spec/ruby/core/objectspace/weakkeymap/fixtures/classes.rb5
-rw-r--r--spec/ruby/core/objectspace/weakkeymap/getkey_spec.rb28
-rw-r--r--spec/ruby/core/objectspace/weakkeymap/inspect_spec.rb21
-rw-r--r--spec/ruby/core/objectspace/weakkeymap/key_spec.rb44
-rw-r--r--spec/ruby/core/objectspace/weakmap/delete_spec.rb30
-rw-r--r--spec/ruby/core/objectspace/weakmap/each_key_spec.rb11
-rw-r--r--spec/ruby/core/objectspace/weakmap/each_pair_spec.rb11
-rw-r--r--spec/ruby/core/objectspace/weakmap/each_spec.rb11
-rw-r--r--spec/ruby/core/objectspace/weakmap/each_value_spec.rb11
-rw-r--r--spec/ruby/core/objectspace/weakmap/element_reference_spec.rb24
-rw-r--r--spec/ruby/core/objectspace/weakmap/element_set_spec.rb38
-rw-r--r--spec/ruby/core/objectspace/weakmap/include_spec.rb6
-rw-r--r--spec/ruby/core/objectspace/weakmap/inspect_spec.rb25
-rw-r--r--spec/ruby/core/objectspace/weakmap/key_spec.rb6
-rw-r--r--spec/ruby/core/objectspace/weakmap/keys_spec.rb6
-rw-r--r--spec/ruby/core/objectspace/weakmap/length_spec.rb6
-rw-r--r--spec/ruby/core/objectspace/weakmap/member_spec.rb6
-rw-r--r--spec/ruby/core/objectspace/weakmap/shared/each.rb10
-rw-r--r--spec/ruby/core/objectspace/weakmap/shared/include.rb30
-rw-r--r--spec/ruby/core/objectspace/weakmap/shared/members.rb14
-rw-r--r--spec/ruby/core/objectspace/weakmap/shared/size.rb14
-rw-r--r--spec/ruby/core/objectspace/weakmap/size_spec.rb6
-rw-r--r--spec/ruby/core/objectspace/weakmap/values_spec.rb6
-rw-r--r--spec/ruby/core/objectspace/weakmap_spec.rb12
-rw-r--r--spec/ruby/core/proc/allocate_spec.rb9
-rw-r--r--spec/ruby/core/proc/arity_spec.rb656
-rw-r--r--spec/ruby/core/proc/binding_spec.rb21
-rw-r--r--spec/ruby/core/proc/block_pass_spec.rb21
-rw-r--r--spec/ruby/core/proc/call_spec.rb16
-rw-r--r--spec/ruby/core/proc/case_compare_spec.rb16
-rw-r--r--spec/ruby/core/proc/clone_spec.rb30
-rw-r--r--spec/ruby/core/proc/compose_spec.rb142
-rw-r--r--spec/ruby/core/proc/curry_spec.rb179
-rw-r--r--spec/ruby/core/proc/dup_spec.rb28
-rw-r--r--spec/ruby/core/proc/element_reference_spec.rb27
-rw-r--r--spec/ruby/core/proc/eql_spec.rb6
-rw-r--r--spec/ruby/core/proc/equal_value_spec.rb6
-rw-r--r--spec/ruby/core/proc/fixtures/common.rb72
-rw-r--r--spec/ruby/core/proc/fixtures/proc_aref.rb10
-rw-r--r--spec/ruby/core/proc/fixtures/proc_aref_frozen.rb10
-rw-r--r--spec/ruby/core/proc/fixtures/source_location.rb55
-rw-r--r--spec/ruby/core/proc/hash_spec.rb17
-rw-r--r--spec/ruby/core/proc/inspect_spec.rb6
-rw-r--r--spec/ruby/core/proc/lambda_spec.rb62
-rw-r--r--spec/ruby/core/proc/new_spec.rb178
-rw-r--r--spec/ruby/core/proc/parameters_spec.rb175
-rw-r--r--spec/ruby/core/proc/ruby2_keywords_spec.rb66
-rw-r--r--spec/ruby/core/proc/shared/call.rb99
-rw-r--r--spec/ruby/core/proc/shared/call_arguments.rb29
-rw-r--r--spec/ruby/core/proc/shared/compose.rb22
-rw-r--r--spec/ruby/core/proc/shared/dup.rb39
-rw-r--r--spec/ruby/core/proc/shared/equal.rb83
-rw-r--r--spec/ruby/core/proc/shared/to_s.rb60
-rw-r--r--spec/ruby/core/proc/source_location_spec.rb104
-rw-r--r--spec/ruby/core/proc/to_proc_spec.rb9
-rw-r--r--spec/ruby/core/proc/to_s_spec.rb6
-rw-r--r--spec/ruby/core/proc/yield_spec.rb16
-rw-r--r--spec/ruby/core/process/_fork_spec.rb24
-rw-r--r--spec/ruby/core/process/abort_spec.rb6
-rw-r--r--spec/ruby/core/process/argv0_spec.rb25
-rw-r--r--spec/ruby/core/process/clock_getres_spec.rb33
-rw-r--r--spec/ruby/core/process/clock_gettime_spec.rb152
-rw-r--r--spec/ruby/core/process/constants_spec.rb114
-rw-r--r--spec/ruby/core/process/daemon_spec.rb118
-rw-r--r--spec/ruby/core/process/detach_spec.rb81
-rw-r--r--spec/ruby/core/process/egid_spec.rb58
-rw-r--r--spec/ruby/core/process/euid_spec.rb56
-rw-r--r--spec/ruby/core/process/exec_spec.rb241
-rw-r--r--spec/ruby/core/process/exit_spec.rb10
-rw-r--r--spec/ruby/core/process/fixtures/argv0.rb6
-rw-r--r--spec/ruby/core/process/fixtures/clocks.rb18
-rw-r--r--spec/ruby/core/process/fixtures/common.rb88
-rw-r--r--spec/ruby/core/process/fixtures/daemon.rb111
-rw-r--r--spec/ruby/core/process/fixtures/in.txt1
-rw-r--r--spec/ruby/core/process/fixtures/kill.rb43
-rw-r--r--spec/ruby/core/process/fixtures/map_fd.rb9
-rw-r--r--spec/ruby/core/process/fixtures/setpriority.rb12
-rw-r--r--spec/ruby/core/process/fork_spec.rb6
-rw-r--r--spec/ruby/core/process/getpgid_spec.rb17
-rw-r--r--spec/ruby/core/process/getpgrp_spec.rb7
-rw-r--r--spec/ruby/core/process/getpriority_spec.rb23
-rw-r--r--spec/ruby/core/process/getrlimit_spec.rb100
-rw-r--r--spec/ruby/core/process/gid/change_privilege_spec.rb5
-rw-r--r--spec/ruby/core/process/gid/eid_spec.rb9
-rw-r--r--spec/ruby/core/process/gid/grant_privilege_spec.rb5
-rw-r--r--spec/ruby/core/process/gid/re_exchange_spec.rb5
-rw-r--r--spec/ruby/core/process/gid/re_exchangeable_spec.rb5
-rw-r--r--spec/ruby/core/process/gid/rid_spec.rb5
-rw-r--r--spec/ruby/core/process/gid/sid_available_spec.rb5
-rw-r--r--spec/ruby/core/process/gid/switch_spec.rb5
-rw-r--r--spec/ruby/core/process/gid_spec.rb22
-rw-r--r--spec/ruby/core/process/groups_spec.rb67
-rw-r--r--spec/ruby/core/process/initgroups_spec.rb22
-rw-r--r--spec/ruby/core/process/kill_spec.rb132
-rw-r--r--spec/ruby/core/process/last_status_spec.rb18
-rw-r--r--spec/ruby/core/process/maxgroups_spec.rb19
-rw-r--r--spec/ruby/core/process/pid_spec.rb9
-rw-r--r--spec/ruby/core/process/ppid_spec.rb9
-rw-r--r--spec/ruby/core/process/set_proctitle_spec.rb23
-rw-r--r--spec/ruby/core/process/setpgid_spec.rb29
-rw-r--r--spec/ruby/core/process/setpgrp_spec.rb37
-rw-r--r--spec/ruby/core/process/setpriority_spec.rb60
-rw-r--r--spec/ruby/core/process/setrlimit_spec.rb237
-rw-r--r--spec/ruby/core/process/setsid_spec.rb16
-rw-r--r--spec/ruby/core/process/spawn_spec.rb756
-rw-r--r--spec/ruby/core/process/status/bit_and_spec.rb38
-rw-r--r--spec/ruby/core/process/status/coredump_spec.rb5
-rw-r--r--spec/ruby/core/process/status/equal_value_spec.rb15
-rw-r--r--spec/ruby/core/process/status/exited_spec.rb32
-rw-r--r--spec/ruby/core/process/status/exitstatus_spec.rb25
-rw-r--r--spec/ruby/core/process/status/inspect_spec.rb5
-rw-r--r--spec/ruby/core/process/status/pid_spec.rb15
-rw-r--r--spec/ruby/core/process/status/right_shift_spec.rb37
-rw-r--r--spec/ruby/core/process/status/signaled_spec.rb31
-rw-r--r--spec/ruby/core/process/status/stopped_spec.rb5
-rw-r--r--spec/ruby/core/process/status/stopsig_spec.rb5
-rw-r--r--spec/ruby/core/process/status/success_spec.rb41
-rw-r--r--spec/ruby/core/process/status/termsig_spec.rb43
-rw-r--r--spec/ruby/core/process/status/to_i_spec.rb13
-rw-r--r--spec/ruby/core/process/status/to_int_spec.rb5
-rw-r--r--spec/ruby/core/process/status/to_s_spec.rb5
-rw-r--r--spec/ruby/core/process/status/wait_spec.rb100
-rw-r--r--spec/ruby/core/process/sys/getegid_spec.rb5
-rw-r--r--spec/ruby/core/process/sys/geteuid_spec.rb5
-rw-r--r--spec/ruby/core/process/sys/getgid_spec.rb5
-rw-r--r--spec/ruby/core/process/sys/getuid_spec.rb5
-rw-r--r--spec/ruby/core/process/sys/issetugid_spec.rb5
-rw-r--r--spec/ruby/core/process/sys/setegid_spec.rb5
-rw-r--r--spec/ruby/core/process/sys/seteuid_spec.rb5
-rw-r--r--spec/ruby/core/process/sys/setgid_spec.rb5
-rw-r--r--spec/ruby/core/process/sys/setregid_spec.rb5
-rw-r--r--spec/ruby/core/process/sys/setresgid_spec.rb5
-rw-r--r--spec/ruby/core/process/sys/setresuid_spec.rb5
-rw-r--r--spec/ruby/core/process/sys/setreuid_spec.rb5
-rw-r--r--spec/ruby/core/process/sys/setrgid_spec.rb5
-rw-r--r--spec/ruby/core/process/sys/setruid_spec.rb5
-rw-r--r--spec/ruby/core/process/sys/setuid_spec.rb5
-rw-r--r--spec/ruby/core/process/times_spec.rb19
-rw-r--r--spec/ruby/core/process/tms/cstime_spec.rb17
-rw-r--r--spec/ruby/core/process/tms/cutime_spec.rb17
-rw-r--r--spec/ruby/core/process/tms/stime_spec.rb17
-rw-r--r--spec/ruby/core/process/tms/utime_spec.rb17
-rw-r--r--spec/ruby/core/process/uid/change_privilege_spec.rb5
-rw-r--r--spec/ruby/core/process/uid/eid_spec.rb9
-rw-r--r--spec/ruby/core/process/uid/grant_privilege_spec.rb5
-rw-r--r--spec/ruby/core/process/uid/re_exchange_spec.rb5
-rw-r--r--spec/ruby/core/process/uid/re_exchangeable_spec.rb5
-rw-r--r--spec/ruby/core/process/uid/rid_spec.rb5
-rw-r--r--spec/ruby/core/process/uid/sid_available_spec.rb5
-rw-r--r--spec/ruby/core/process/uid/switch_spec.rb5
-rw-r--r--spec/ruby/core/process/uid_spec.rb57
-rw-r--r--spec/ruby/core/process/wait2_spec.rb45
-rw-r--r--spec/ruby/core/process/wait_spec.rb91
-rw-r--r--spec/ruby/core/process/waitall_spec.rb48
-rw-r--r--spec/ruby/core/process/waitpid2_spec.rb5
-rw-r--r--spec/ruby/core/process/waitpid_spec.rb14
-rw-r--r--spec/ruby/core/process/warmup_spec.rb11
-rw-r--r--spec/ruby/core/queue/append_spec.rb6
-rw-r--r--spec/ruby/core/queue/clear_spec.rb6
-rw-r--r--spec/ruby/core/queue/close_spec.rb6
-rw-r--r--spec/ruby/core/queue/closed_spec.rb6
-rw-r--r--spec/ruby/core/queue/deq_spec.rb11
-rw-r--r--spec/ruby/core/queue/empty_spec.rb6
-rw-r--r--spec/ruby/core/queue/enq_spec.rb6
-rw-r--r--spec/ruby/core/queue/freeze_spec.rb6
-rw-r--r--spec/ruby/core/queue/initialize_spec.rb60
-rw-r--r--spec/ruby/core/queue/length_spec.rb6
-rw-r--r--spec/ruby/core/queue/num_waiting_spec.rb6
-rw-r--r--spec/ruby/core/queue/pop_spec.rb11
-rw-r--r--spec/ruby/core/queue/push_spec.rb6
-rw-r--r--spec/ruby/core/queue/shift_spec.rb11
-rw-r--r--spec/ruby/core/queue/size_spec.rb6
-rw-r--r--spec/ruby/core/random/bytes_spec.rb29
-rw-r--r--spec/ruby/core/random/default_spec.rb7
-rw-r--r--spec/ruby/core/random/equal_value_spec.rb37
-rw-r--r--spec/ruby/core/random/fixtures/classes.rb15
-rw-r--r--spec/ruby/core/random/new_seed_spec.rb24
-rw-r--r--spec/ruby/core/random/new_spec.rb38
-rw-r--r--spec/ruby/core/random/rand_spec.rb224
-rw-r--r--spec/ruby/core/random/random_number_spec.rb8
-rw-r--r--spec/ruby/core/random/seed_spec.rb29
-rw-r--r--spec/ruby/core/random/shared/bytes.rb17
-rw-r--r--spec/ruby/core/random/shared/rand.rb9
-rw-r--r--spec/ruby/core/random/srand_spec.rb39
-rw-r--r--spec/ruby/core/random/urandom_spec.rb25
-rw-r--r--spec/ruby/core/range/begin_spec.rb6
-rw-r--r--spec/ruby/core/range/bsearch_spec.rb466
-rw-r--r--spec/ruby/core/range/case_compare_spec.rb19
-rw-r--r--spec/ruby/core/range/clone_spec.rb26
-rw-r--r--spec/ruby/core/range/count_spec.rb12
-rw-r--r--spec/ruby/core/range/cover_spec.rb14
-rw-r--r--spec/ruby/core/range/dup_spec.rb23
-rw-r--r--spec/ruby/core/range/each_spec.rb101
-rw-r--r--spec/ruby/core/range/end_spec.rb6
-rw-r--r--spec/ruby/core/range/eql_spec.rb10
-rw-r--r--spec/ruby/core/range/equal_value_spec.rb18
-rw-r--r--spec/ruby/core/range/exclude_end_spec.rb19
-rw-r--r--spec/ruby/core/range/first_spec.rb53
-rw-r--r--spec/ruby/core/range/fixtures/classes.rb90
-rw-r--r--spec/ruby/core/range/frozen_spec.rb25
-rw-r--r--spec/ruby/core/range/hash_spec.rb24
-rw-r--r--spec/ruby/core/range/include_spec.rb14
-rw-r--r--spec/ruby/core/range/initialize_spec.rb41
-rw-r--r--spec/ruby/core/range/inspect_spec.rb29
-rw-r--r--spec/ruby/core/range/last_spec.rb57
-rw-r--r--spec/ruby/core/range/max_spec.rb115
-rw-r--r--spec/ruby/core/range/member_spec.rb10
-rw-r--r--spec/ruby/core/range/min_spec.rb88
-rw-r--r--spec/ruby/core/range/minmax_spec.rb130
-rw-r--r--spec/ruby/core/range/new_spec.rb77
-rw-r--r--spec/ruby/core/range/overlap_spec.rb89
-rw-r--r--spec/ruby/core/range/percent_spec.rb16
-rw-r--r--spec/ruby/core/range/range_spec.rb7
-rw-r--r--spec/ruby/core/range/reverse_each_spec.rb103
-rw-r--r--spec/ruby/core/range/shared/begin.rb10
-rw-r--r--spec/ruby/core/range/shared/cover.rb193
-rw-r--r--spec/ruby/core/range/shared/cover_and_include.rb86
-rw-r--r--spec/ruby/core/range/shared/end.rb10
-rw-r--r--spec/ruby/core/range/shared/equal_value.rb51
-rw-r--r--spec/ruby/core/range/shared/include.rb91
-rw-r--r--spec/ruby/core/range/size_spec.rb92
-rw-r--r--spec/ruby/core/range/step_spec.rb683
-rw-r--r--spec/ruby/core/range/to_a_spec.rb39
-rw-r--r--spec/ruby/core/range/to_s_spec.rb23
-rw-r--r--spec/ruby/core/range/to_set_spec.rb55
-rw-r--r--spec/ruby/core/rational/abs_spec.rb6
-rw-r--r--spec/ruby/core/rational/ceil_spec.rb45
-rw-r--r--spec/ruby/core/rational/comparison_spec.rb93
-rw-r--r--spec/ruby/core/rational/denominator_spec.rb14
-rw-r--r--spec/ruby/core/rational/div_spec.rb54
-rw-r--r--spec/ruby/core/rational/divide_spec.rb74
-rw-r--r--spec/ruby/core/rational/divmod_spec.rb42
-rw-r--r--spec/ruby/core/rational/equal_value_spec.rb39
-rw-r--r--spec/ruby/core/rational/exponent_spec.rb236
-rw-r--r--spec/ruby/core/rational/fdiv_spec.rb5
-rw-r--r--spec/ruby/core/rational/fixtures/rational.rb14
-rw-r--r--spec/ruby/core/rational/floor_spec.rb45
-rw-r--r--spec/ruby/core/rational/hash_spec.rb9
-rw-r--r--spec/ruby/core/rational/inspect_spec.rb14
-rw-r--r--spec/ruby/core/rational/integer_spec.rb13
-rw-r--r--spec/ruby/core/rational/magnitude_spec.rb6
-rw-r--r--spec/ruby/core/rational/marshal_dump_spec.rb11
-rw-r--r--spec/ruby/core/rational/minus_spec.rb51
-rw-r--r--spec/ruby/core/rational/modulo_spec.rb43
-rw-r--r--spec/ruby/core/rational/multiply_spec.rb65
-rw-r--r--spec/ruby/core/rational/numerator_spec.rb10
-rw-r--r--spec/ruby/core/rational/plus_spec.rb50
-rw-r--r--spec/ruby/core/rational/quo_spec.rb25
-rw-r--r--spec/ruby/core/rational/rational_spec.rb11
-rw-r--r--spec/ruby/core/rational/rationalize_spec.rb36
-rw-r--r--spec/ruby/core/rational/remainder_spec.rb5
-rw-r--r--spec/ruby/core/rational/round_spec.rb106
-rw-r--r--spec/ruby/core/rational/shared/abs.rb11
-rw-r--r--spec/ruby/core/rational/shared/arithmetic_exception_in_coerce.rb11
-rw-r--r--spec/ruby/core/rational/to_f_spec.rb16
-rw-r--r--spec/ruby/core/rational/to_i_spec.rb12
-rw-r--r--spec/ruby/core/rational/to_r_spec.rb26
-rw-r--r--spec/ruby/core/rational/to_s_spec.rb14
-rw-r--r--spec/ruby/core/rational/truncate_spec.rb71
-rw-r--r--spec/ruby/core/rational/zero_spec.rb14
-rw-r--r--spec/ruby/core/refinement/append_features_spec.rb19
-rw-r--r--spec/ruby/core/refinement/extend_object_spec.rb21
-rw-r--r--spec/ruby/core/refinement/fixtures/classes.rb10
-rw-r--r--spec/ruby/core/refinement/import_methods_spec.rb267
-rw-r--r--spec/ruby/core/refinement/include_spec.rb13
-rw-r--r--spec/ruby/core/refinement/prepend_features_spec.rb19
-rw-r--r--spec/ruby/core/refinement/prepend_spec.rb13
-rw-r--r--spec/ruby/core/refinement/refined_class_spec.rb38
-rw-r--r--spec/ruby/core/refinement/shared/target.rb13
-rw-r--r--spec/ruby/core/refinement/target_spec.rb8
-rw-r--r--spec/ruby/core/regexp/case_compare_spec.rb35
-rw-r--r--spec/ruby/core/regexp/casefold_spec.rb8
-rw-r--r--spec/ruby/core/regexp/compile_spec.rb19
-rw-r--r--spec/ruby/core/regexp/encoding_spec.rb62
-rw-r--r--spec/ruby/core/regexp/eql_spec.rb6
-rw-r--r--spec/ruby/core/regexp/equal_value_spec.rb6
-rw-r--r--spec/ruby/core/regexp/escape_spec.rb6
-rw-r--r--spec/ruby/core/regexp/fixed_encoding_spec.rb36
-rw-r--r--spec/ruby/core/regexp/hash_spec.rb20
-rw-r--r--spec/ruby/core/regexp/initialize_spec.rb15
-rw-r--r--spec/ruby/core/regexp/inspect_spec.rb44
-rw-r--r--spec/ruby/core/regexp/last_match_spec.rb56
-rw-r--r--spec/ruby/core/regexp/linear_time_spec.rb33
-rw-r--r--spec/ruby/core/regexp/match_spec.rb146
-rw-r--r--spec/ruby/core/regexp/named_captures_spec.rb35
-rw-r--r--spec/ruby/core/regexp/names_spec.rb29
-rw-r--r--spec/ruby/core/regexp/new_spec.rb19
-rw-r--r--spec/ruby/core/regexp/options_spec.rb54
-rw-r--r--spec/ruby/core/regexp/quote_spec.rb6
-rw-r--r--spec/ruby/core/regexp/shared/equal_value.rb31
-rw-r--r--spec/ruby/core/regexp/shared/new.rb315
-rw-r--r--spec/ruby/core/regexp/shared/quote.rb41
-rw-r--r--spec/ruby/core/regexp/source_spec.rb47
-rw-r--r--spec/ruby/core/regexp/timeout_spec.rb33
-rw-r--r--spec/ruby/core/regexp/to_s_spec.rb62
-rw-r--r--spec/ruby/core/regexp/try_convert_spec.rb27
-rw-r--r--spec/ruby/core/regexp/union_spec.rb182
-rw-r--r--spec/ruby/core/set/add_spec.rb34
-rw-r--r--spec/ruby/core/set/append_spec.rb6
-rw-r--r--spec/ruby/core/set/case_compare_spec.rb11
-rw-r--r--spec/ruby/core/set/case_equality_spec.rb6
-rw-r--r--spec/ruby/core/set/classify_spec.rb26
-rw-r--r--spec/ruby/core/set/clear_spec.rb16
-rw-r--r--spec/ruby/core/set/collect_spec.rb6
-rw-r--r--spec/ruby/core/set/compare_by_identity_spec.rb153
-rw-r--r--spec/ruby/core/set/comparison_spec.rb26
-rw-r--r--spec/ruby/core/set/constructor_spec.rb14
-rw-r--r--spec/ruby/core/set/delete_if_spec.rb37
-rw-r--r--spec/ruby/core/set/delete_spec.rb36
-rw-r--r--spec/ruby/core/set/difference_spec.rb6
-rw-r--r--spec/ruby/core/set/disjoint_spec.rb22
-rw-r--r--spec/ruby/core/set/divide_spec.rb68
-rw-r--r--spec/ruby/core/set/each_spec.rb26
-rw-r--r--spec/ruby/core/set/empty_spec.rb9
-rw-r--r--spec/ruby/core/set/enumerable/to_set_spec.rb12
-rw-r--r--spec/ruby/core/set/eql_spec.rb14
-rw-r--r--spec/ruby/core/set/equal_value_spec.rb34
-rw-r--r--spec/ruby/core/set/exclusion_spec.rb17
-rw-r--r--spec/ruby/core/set/filter_spec.rb6
-rw-r--r--spec/ruby/core/set/fixtures/set_like.rb30
-rw-r--r--spec/ruby/core/set/flatten_merge_spec.rb24
-rw-r--r--spec/ruby/core/set/flatten_spec.rb59
-rw-r--r--spec/ruby/core/set/hash_spec.rb19
-rw-r--r--spec/ruby/core/set/include_spec.rb6
-rw-r--r--spec/ruby/core/set/initialize_clone_spec.rb15
-rw-r--r--spec/ruby/core/set/initialize_spec.rb72
-rw-r--r--spec/ruby/core/set/inspect_spec.rb6
-rw-r--r--spec/ruby/core/set/intersect_spec.rb22
-rw-r--r--spec/ruby/core/set/intersection_spec.rb10
-rw-r--r--spec/ruby/core/set/join_spec.rb30
-rw-r--r--spec/ruby/core/set/keep_if_spec.rb37
-rw-r--r--spec/ruby/core/set/length_spec.rb6
-rw-r--r--spec/ruby/core/set/map_spec.rb6
-rw-r--r--spec/ruby/core/set/member_spec.rb6
-rw-r--r--spec/ruby/core/set/merge_spec.rb37
-rw-r--r--spec/ruby/core/set/minus_spec.rb6
-rw-r--r--spec/ruby/core/set/plus_spec.rb6
-rw-r--r--spec/ruby/core/set/pretty_print_cycle_spec.rb14
-rw-r--r--spec/ruby/core/set/proper_subset_spec.rb45
-rw-r--r--spec/ruby/core/set/proper_superset_spec.rb42
-rw-r--r--spec/ruby/core/set/reject_spec.rb41
-rw-r--r--spec/ruby/core/set/replace_spec.rb24
-rw-r--r--spec/ruby/core/set/select_spec.rb6
-rw-r--r--spec/ruby/core/set/set_spec.rb10
-rw-r--r--spec/ruby/core/set/shared/add.rb14
-rw-r--r--spec/ruby/core/set/shared/collect.rb20
-rw-r--r--spec/ruby/core/set/shared/difference.rb15
-rw-r--r--spec/ruby/core/set/shared/include.rb29
-rw-r--r--spec/ruby/core/set/shared/inspect.rb45
-rw-r--r--spec/ruby/core/set/shared/intersection.rb15
-rw-r--r--spec/ruby/core/set/shared/length.rb6
-rw-r--r--spec/ruby/core/set/shared/select.rb41
-rw-r--r--spec/ruby/core/set/shared/union.rb15
-rw-r--r--spec/ruby/core/set/size_spec.rb6
-rw-r--r--spec/ruby/core/set/sortedset/sortedset_spec.rb13
-rw-r--r--spec/ruby/core/set/subset_spec.rb45
-rw-r--r--spec/ruby/core/set/subtract_spec.rb16
-rw-r--r--spec/ruby/core/set/superset_spec.rb42
-rw-r--r--spec/ruby/core/set/to_a_spec.rb7
-rw-r--r--spec/ruby/core/set/to_s_spec.rb11
-rw-r--r--spec/ruby/core/set/union_spec.rb10
-rw-r--r--spec/ruby/core/signal/fixtures/trap_all.rb15
-rw-r--r--spec/ruby/core/signal/list_spec.rb68
-rw-r--r--spec/ruby/core/signal/signame_spec.rb34
-rw-r--r--spec/ruby/core/signal/trap_spec.rb320
-rw-r--r--spec/ruby/core/sizedqueue/append_spec.rb16
-rw-r--r--spec/ruby/core/sizedqueue/clear_spec.rb6
-rw-r--r--spec/ruby/core/sizedqueue/close_spec.rb6
-rw-r--r--spec/ruby/core/sizedqueue/closed_spec.rb6
-rw-r--r--spec/ruby/core/sizedqueue/deq_spec.rb11
-rw-r--r--spec/ruby/core/sizedqueue/empty_spec.rb6
-rw-r--r--spec/ruby/core/sizedqueue/enq_spec.rb16
-rw-r--r--spec/ruby/core/sizedqueue/freeze_spec.rb6
-rw-r--r--spec/ruby/core/sizedqueue/length_spec.rb6
-rw-r--r--spec/ruby/core/sizedqueue/max_spec.rb10
-rw-r--r--spec/ruby/core/sizedqueue/new_spec.rb6
-rw-r--r--spec/ruby/core/sizedqueue/num_waiting_spec.rb6
-rw-r--r--spec/ruby/core/sizedqueue/pop_spec.rb11
-rw-r--r--spec/ruby/core/sizedqueue/push_spec.rb16
-rw-r--r--spec/ruby/core/sizedqueue/shift_spec.rb11
-rw-r--r--spec/ruby/core/sizedqueue/size_spec.rb6
-rw-r--r--spec/ruby/core/string/allocate_spec.rb19
-rw-r--r--spec/ruby/core/string/append_as_bytes_spec.rb58
-rw-r--r--spec/ruby/core/string/append_spec.rb14
-rw-r--r--spec/ruby/core/string/ascii_only_spec.rb82
-rw-r--r--spec/ruby/core/string/b_spec.rb16
-rw-r--r--spec/ruby/core/string/byteindex_spec.rb298
-rw-r--r--spec/ruby/core/string/byterindex_spec.rb353
-rw-r--r--spec/ruby/core/string/bytes_spec.rb55
-rw-r--r--spec/ruby/core/string/bytesize_spec.rb33
-rw-r--r--spec/ruby/core/string/byteslice_spec.rb33
-rw-r--r--spec/ruby/core/string/bytesplice_spec.rb294
-rw-r--r--spec/ruby/core/string/capitalize_spec.rb207
-rw-r--r--spec/ruby/core/string/case_compare_spec.rb8
-rw-r--r--spec/ruby/core/string/casecmp_spec.rb204
-rw-r--r--spec/ruby/core/string/center_spec.rb117
-rw-r--r--spec/ruby/core/string/chars_spec.rb16
-rw-r--r--spec/ruby/core/string/chilled_string_spec.rb151
-rw-r--r--spec/ruby/core/string/chomp_spec.rb366
-rw-r--r--spec/ruby/core/string/chop_spec.rb119
-rw-r--r--spec/ruby/core/string/chr_spec.rb42
-rw-r--r--spec/ruby/core/string/clear_spec.rb38
-rw-r--r--spec/ruby/core/string/clone_spec.rb61
-rw-r--r--spec/ruby/core/string/codepoints_spec.rb18
-rw-r--r--spec/ruby/core/string/comparison_spec.rb112
-rw-r--r--spec/ruby/core/string/concat_spec.rb27
-rw-r--r--spec/ruby/core/string/count_spec.rb105
-rw-r--r--spec/ruby/core/string/crypt_spec.rb92
-rw-r--r--spec/ruby/core/string/dedup_spec.rb6
-rw-r--r--spec/ruby/core/string/delete_prefix_spec.rb83
-rw-r--r--spec/ruby/core/string/delete_spec.rb117
-rw-r--r--spec/ruby/core/string/delete_suffix_spec.rb83
-rw-r--r--spec/ruby/core/string/downcase_spec.rb195
-rw-r--r--spec/ruby/core/string/dump_spec.rb396
-rw-r--r--spec/ruby/core/string/dup_spec.rb65
-rw-r--r--spec/ruby/core/string/each_byte_spec.rb61
-rw-r--r--spec/ruby/core/string/each_char_spec.rb8
-rw-r--r--spec/ruby/core/string/each_codepoint_spec.rb8
-rw-r--r--spec/ruby/core/string/each_grapheme_cluster_spec.rb16
-rw-r--r--spec/ruby/core/string/each_line_spec.rb9
-rw-r--r--spec/ruby/core/string/element_reference_spec.rb35
-rw-r--r--spec/ruby/core/string/element_set_spec.rb589
-rw-r--r--spec/ruby/core/string/empty_spec.rb12
-rw-r--r--spec/ruby/core/string/encode_spec.rb240
-rw-r--r--spec/ruby/core/string/encoding_spec.rb184
-rw-r--r--spec/ruby/core/string/end_with_spec.rb8
-rw-r--r--spec/ruby/core/string/eql_spec.rb21
-rw-r--r--spec/ruby/core/string/equal_value_spec.rb8
-rw-r--r--spec/ruby/core/string/fixtures/classes.rb60
-rw-r--r--spec/ruby/core/string/fixtures/freeze_magic_comment.rb3
-rw-r--r--spec/ruby/core/string/fixtures/iso-8859-9-encoding.rb9
-rw-r--r--spec/ruby/core/string/fixtures/to_c.rb5
-rw-r--r--spec/ruby/core/string/force_encoding_spec.rb72
-rw-r--r--spec/ruby/core/string/freeze_spec.rb18
-rw-r--r--spec/ruby/core/string/getbyte_spec.rb69
-rw-r--r--spec/ruby/core/string/grapheme_clusters_spec.rb14
-rw-r--r--spec/ruby/core/string/gsub_spec.rb615
-rw-r--r--spec/ruby/core/string/hash_spec.rb9
-rw-r--r--spec/ruby/core/string/hex_spec.rb49
-rw-r--r--spec/ruby/core/string/include_spec.rb49
-rw-r--r--spec/ruby/core/string/index_spec.rb350
-rw-r--r--spec/ruby/core/string/initialize_spec.rb26
-rw-r--r--spec/ruby/core/string/insert_spec.rb81
-rw-r--r--spec/ruby/core/string/inspect_spec.rb520
-rw-r--r--spec/ruby/core/string/intern_spec.rb7
-rw-r--r--spec/ruby/core/string/length_spec.rb7
-rw-r--r--spec/ruby/core/string/lines_spec.rb19
-rw-r--r--spec/ruby/core/string/ljust_spec.rb100
-rw-r--r--spec/ruby/core/string/lstrip_spec.rb74
-rw-r--r--spec/ruby/core/string/match_spec.rb167
-rw-r--r--spec/ruby/core/string/modulo_spec.rb797
-rw-r--r--spec/ruby/core/string/multiply_spec.rb7
-rw-r--r--spec/ruby/core/string/new_spec.rb61
-rw-r--r--spec/ruby/core/string/next_spec.rb11
-rw-r--r--spec/ruby/core/string/oct_spec.rb88
-rw-r--r--spec/ruby/core/string/ord_spec.rb33
-rw-r--r--spec/ruby/core/string/partition_spec.rb63
-rw-r--r--spec/ruby/core/string/plus_spec.rb37
-rw-r--r--spec/ruby/core/string/prepend_spec.rb55
-rw-r--r--spec/ruby/core/string/replace_spec.rb7
-rw-r--r--spec/ruby/core/string/reverse_spec.rb70
-rw-r--r--spec/ruby/core/string/rindex_spec.rb384
-rw-r--r--spec/ruby/core/string/rjust_spec.rb100
-rw-r--r--spec/ruby/core/string/rpartition_spec.rb71
-rw-r--r--spec/ruby/core/string/rstrip_spec.rb80
-rw-r--r--spec/ruby/core/string/scan_spec.rb173
-rw-r--r--spec/ruby/core/string/scrub_spec.rb164
-rw-r--r--spec/ruby/core/string/setbyte_spec.rb112
-rw-r--r--spec/ruby/core/string/shared/byte_index_common.rb63
-rw-r--r--spec/ruby/core/string/shared/chars.rb66
-rw-r--r--spec/ruby/core/string/shared/codepoints.rb62
-rw-r--r--spec/ruby/core/string/shared/concat.rb159
-rw-r--r--spec/ruby/core/string/shared/dedup.rb51
-rw-r--r--spec/ruby/core/string/shared/each_char_without_block.rb26
-rw-r--r--spec/ruby/core/string/shared/each_codepoint_without_block.rb33
-rw-r--r--spec/ruby/core/string/shared/each_line.rb162
-rw-r--r--spec/ruby/core/string/shared/each_line_without_block.rb17
-rw-r--r--spec/ruby/core/string/shared/encode.rb432
-rw-r--r--spec/ruby/core/string/shared/eql.rb38
-rw-r--r--spec/ruby/core/string/shared/equal_value.rb29
-rw-r--r--spec/ruby/core/string/shared/grapheme_clusters.rb16
-rw-r--r--spec/ruby/core/string/shared/length.rb55
-rw-r--r--spec/ruby/core/string/shared/partition.rb33
-rw-r--r--spec/ruby/core/string/shared/replace.rb48
-rw-r--r--spec/ruby/core/string/shared/slice.rb517
-rw-r--r--spec/ruby/core/string/shared/strip.rb14
-rw-r--r--spec/ruby/core/string/shared/succ.rb87
-rw-r--r--spec/ruby/core/string/shared/to_s.rb13
-rw-r--r--spec/ruby/core/string/shared/to_sym.rb72
-rw-r--r--spec/ruby/core/string/size_spec.rb7
-rw-r--r--spec/ruby/core/string/slice_spec.rb390
-rw-r--r--spec/ruby/core/string/split_spec.rb546
-rw-r--r--spec/ruby/core/string/squeeze_spec.rb111
-rw-r--r--spec/ruby/core/string/start_with_spec.rb27
-rw-r--r--spec/ruby/core/string/string_spec.rb7
-rw-r--r--spec/ruby/core/string/strip_spec.rb58
-rw-r--r--spec/ruby/core/string/sub_spec.rb512
-rw-r--r--spec/ruby/core/string/succ_spec.rb11
-rw-r--r--spec/ruby/core/string/sum_spec.rb22
-rw-r--r--spec/ruby/core/string/swapcase_spec.rb193
-rw-r--r--spec/ruby/core/string/to_c_spec.rb53
-rw-r--r--spec/ruby/core/string/to_f_spec.rb142
-rw-r--r--spec/ruby/core/string/to_i_spec.rb349
-rw-r--r--spec/ruby/core/string/to_r_spec.rb62
-rw-r--r--spec/ruby/core/string/to_s_spec.rb7
-rw-r--r--spec/ruby/core/string/to_str_spec.rb7
-rw-r--r--spec/ruby/core/string/to_sym_spec.rb7
-rw-r--r--spec/ruby/core/string/tr_s_spec.rb133
-rw-r--r--spec/ruby/core/string/tr_spec.rb128
-rw-r--r--spec/ruby/core/string/try_convert_spec.rb50
-rw-r--r--spec/ruby/core/string/uminus_spec.rb6
-rw-r--r--spec/ruby/core/string/undump_spec.rb441
-rw-r--r--spec/ruby/core/string/unicode_normalize_spec.rb116
-rw-r--r--spec/ruby/core/string/unicode_normalized_spec.rb75
-rw-r--r--spec/ruby/core/string/unpack/a_spec.rb66
-rw-r--r--spec/ruby/core/string/unpack/at_spec.rb29
-rw-r--r--spec/ruby/core/string/unpack/b_spec.rb221
-rw-r--r--spec/ruby/core/string/unpack/c_spec.rb75
-rw-r--r--spec/ruby/core/string/unpack/comment_spec.rb25
-rw-r--r--spec/ruby/core/string/unpack/d_spec.rb28
-rw-r--r--spec/ruby/core/string/unpack/e_spec.rb14
-rw-r--r--spec/ruby/core/string/unpack/f_spec.rb28
-rw-r--r--spec/ruby/core/string/unpack/g_spec.rb14
-rw-r--r--spec/ruby/core/string/unpack/h_spec.rb159
-rw-r--r--spec/ruby/core/string/unpack/i_spec.rb152
-rw-r--r--spec/ruby/core/string/unpack/j_spec.rb272
-rw-r--r--spec/ruby/core/string/unpack/l_spec.rb265
-rw-r--r--spec/ruby/core/string/unpack/m_spec.rb192
-rw-r--r--spec/ruby/core/string/unpack/n_spec.rb18
-rw-r--r--spec/ruby/core/string/unpack/p_spec.rb44
-rw-r--r--spec/ruby/core/string/unpack/percent_spec.rb7
-rw-r--r--spec/ruby/core/string/unpack/q_spec.rb64
-rw-r--r--spec/ruby/core/string/unpack/s_spec.rb152
-rw-r--r--spec/ruby/core/string/unpack/shared/basic.rb37
-rw-r--r--spec/ruby/core/string/unpack/shared/float.rb319
-rw-r--r--spec/ruby/core/string/unpack/shared/integer.rb411
-rw-r--r--spec/ruby/core/string/unpack/shared/string.rb51
-rw-r--r--spec/ruby/core/string/unpack/shared/taint.rb2
-rw-r--r--spec/ruby/core/string/unpack/shared/unicode.rb72
-rw-r--r--spec/ruby/core/string/unpack/u_spec.rb97
-rw-r--r--spec/ruby/core/string/unpack/v_spec.rb18
-rw-r--r--spec/ruby/core/string/unpack/w_spec.rb47
-rw-r--r--spec/ruby/core/string/unpack/x_spec.rb62
-rw-r--r--spec/ruby/core/string/unpack/z_spec.rb28
-rw-r--r--spec/ruby/core/string/unpack1_spec.rb47
-rw-r--r--spec/ruby/core/string/unpack_spec.rb32
-rw-r--r--spec/ruby/core/string/upcase_spec.rb187
-rw-r--r--spec/ruby/core/string/uplus_spec.rb60
-rw-r--r--spec/ruby/core/string/upto_spec.rb110
-rw-r--r--spec/ruby/core/string/valid_encoding/utf_8_spec.rb214
-rw-r--r--spec/ruby/core/string/valid_encoding_spec.rb133
-rw-r--r--spec/ruby/core/struct/clone_spec.rb7
-rw-r--r--spec/ruby/core/struct/constants_spec.rb13
-rw-r--r--spec/ruby/core/struct/deconstruct_keys_spec.rb130
-rw-r--r--spec/ruby/core/struct/deconstruct_spec.rb10
-rw-r--r--spec/ruby/core/struct/dig_spec.rb52
-rw-r--r--spec/ruby/core/struct/dup_spec.rb23
-rw-r--r--spec/ruby/core/struct/each_pair_spec.rb33
-rw-r--r--spec/ruby/core/struct/each_spec.rb27
-rw-r--r--spec/ruby/core/struct/element_reference_spec.rb52
-rw-r--r--spec/ruby/core/struct/element_set_spec.rb36
-rw-r--r--spec/ruby/core/struct/eql_spec.rb13
-rw-r--r--spec/ruby/core/struct/equal_value_spec.rb7
-rw-r--r--spec/ruby/core/struct/filter_spec.rb10
-rw-r--r--spec/ruby/core/struct/fixtures/classes.rb34
-rw-r--r--spec/ruby/core/struct/hash_spec.rb64
-rw-r--r--spec/ruby/core/struct/initialize_spec.rb51
-rw-r--r--spec/ruby/core/struct/inspect_spec.rb7
-rw-r--r--spec/ruby/core/struct/instance_variable_get_spec.rb16
-rw-r--r--spec/ruby/core/struct/instance_variables_spec.rb16
-rw-r--r--spec/ruby/core/struct/keyword_init_spec.rb45
-rw-r--r--spec/ruby/core/struct/length_spec.rb12
-rw-r--r--spec/ruby/core/struct/members_spec.rb25
-rw-r--r--spec/ruby/core/struct/new_spec.rb263
-rw-r--r--spec/ruby/core/struct/select_spec.rb10
-rw-r--r--spec/ruby/core/struct/shared/accessor.rb7
-rw-r--r--spec/ruby/core/struct/shared/dup.rb9
-rw-r--r--spec/ruby/core/struct/shared/equal_value.rb37
-rw-r--r--spec/ruby/core/struct/shared/inspect.rb40
-rw-r--r--spec/ruby/core/struct/shared/select.rb26
-rw-r--r--spec/ruby/core/struct/size_spec.rb11
-rw-r--r--spec/ruby/core/struct/struct_spec.rb50
-rw-r--r--spec/ruby/core/struct/to_a_spec.rb12
-rw-r--r--spec/ruby/core/struct/to_h_spec.rb68
-rw-r--r--spec/ruby/core/struct/to_s_spec.rb12
-rw-r--r--spec/ruby/core/struct/values_at_spec.rb59
-rw-r--r--spec/ruby/core/struct/values_spec.rb11
-rw-r--r--spec/ruby/core/symbol/all_symbols_spec.rb19
-rw-r--r--spec/ruby/core/symbol/capitalize_spec.rb41
-rw-r--r--spec/ruby/core/symbol/case_compare_spec.rb11
-rw-r--r--spec/ruby/core/symbol/casecmp_spec.rb152
-rw-r--r--spec/ruby/core/symbol/comparison_spec.rb51
-rw-r--r--spec/ruby/core/symbol/downcase_spec.rb25
-rw-r--r--spec/ruby/core/symbol/dup_spec.rb7
-rw-r--r--spec/ruby/core/symbol/element_reference_spec.rb6
-rw-r--r--spec/ruby/core/symbol/empty_spec.rb11
-rw-r--r--spec/ruby/core/symbol/encoding_spec.rb23
-rw-r--r--spec/ruby/core/symbol/end_with_spec.rb8
-rw-r--r--spec/ruby/core/symbol/equal_value_spec.rb14
-rw-r--r--spec/ruby/core/symbol/fixtures/classes.rb3
-rw-r--r--spec/ruby/core/symbol/id2name_spec.rb6
-rw-r--r--spec/ruby/core/symbol/inspect_spec.rb112
-rw-r--r--spec/ruby/core/symbol/intern_spec.rb11
-rw-r--r--spec/ruby/core/symbol/length_spec.rb6
-rw-r--r--spec/ruby/core/symbol/match_spec.rb77
-rw-r--r--spec/ruby/core/symbol/name_spec.rb17
-rw-r--r--spec/ruby/core/symbol/next_spec.rb6
-rw-r--r--spec/ruby/core/symbol/shared/id2name.rb30
-rw-r--r--spec/ruby/core/symbol/shared/length.rb23
-rw-r--r--spec/ruby/core/symbol/shared/slice.rb262
-rw-r--r--spec/ruby/core/symbol/shared/succ.rb18
-rw-r--r--spec/ruby/core/symbol/size_spec.rb6
-rw-r--r--spec/ruby/core/symbol/slice_spec.rb6
-rw-r--r--spec/ruby/core/symbol/start_with_spec.rb8
-rw-r--r--spec/ruby/core/symbol/succ_spec.rb6
-rw-r--r--spec/ruby/core/symbol/swapcase_spec.rb29
-rw-r--r--spec/ruby/core/symbol/symbol_spec.rb19
-rw-r--r--spec/ruby/core/symbol/to_proc_spec.rb78
-rw-r--r--spec/ruby/core/symbol/to_s_spec.rb6
-rw-r--r--spec/ruby/core/symbol/to_sym_spec.rb9
-rw-r--r--spec/ruby/core/symbol/upcase_spec.rb21
-rw-r--r--spec/ruby/core/systemexit/initialize_spec.rb26
-rw-r--r--spec/ruby/core/systemexit/success_spec.rb13
-rw-r--r--spec/ruby/core/thread/abort_on_exception_spec.rb106
-rw-r--r--spec/ruby/core/thread/add_trace_func_spec.rb5
-rw-r--r--spec/ruby/core/thread/alive_spec.rb58
-rw-r--r--spec/ruby/core/thread/allocate_spec.rb9
-rw-r--r--spec/ruby/core/thread/backtrace/limit_spec.rb13
-rw-r--r--spec/ruby/core/thread/backtrace/location/absolute_path_spec.rb93
-rw-r--r--spec/ruby/core/thread/backtrace/location/base_label_spec.rb49
-rw-r--r--spec/ruby/core/thread/backtrace/location/fixtures/absolute_path.rb4
-rw-r--r--spec/ruby/core/thread/backtrace/location/fixtures/absolute_path_main.rb2
-rw-r--r--spec/ruby/core/thread/backtrace/location/fixtures/absolute_path_method_added.rb10
-rw-r--r--spec/ruby/core/thread/backtrace/location/fixtures/classes.rb35
-rw-r--r--spec/ruby/core/thread/backtrace/location/fixtures/locations_in_main.rb5
-rw-r--r--spec/ruby/core/thread/backtrace/location/fixtures/locations_in_required.rb3
-rw-r--r--spec/ruby/core/thread/backtrace/location/fixtures/main.rb5
-rw-r--r--spec/ruby/core/thread/backtrace/location/fixtures/path.rb2
-rw-r--r--spec/ruby/core/thread/backtrace/location/fixtures/subdir/absolute_path_main_chdir.rb11
-rw-r--r--spec/ruby/core/thread/backtrace/location/fixtures/subdir/sibling.rb1
-rw-r--r--spec/ruby/core/thread/backtrace/location/inspect_spec.rb13
-rw-r--r--spec/ruby/core/thread/backtrace/location/label_spec.rb37
-rw-r--r--spec/ruby/core/thread/backtrace/location/lineno_spec.rb23
-rw-r--r--spec/ruby/core/thread/backtrace/location/path_spec.rb124
-rw-r--r--spec/ruby/core/thread/backtrace/location/to_s_spec.rb13
-rw-r--r--spec/ruby/core/thread/backtrace_locations_spec.rb79
-rw-r--r--spec/ruby/core/thread/backtrace_spec.rb69
-rw-r--r--spec/ruby/core/thread/current_spec.rb31
-rw-r--r--spec/ruby/core/thread/each_caller_location_spec.rb47
-rw-r--r--spec/ruby/core/thread/element_reference_spec.rb55
-rw-r--r--spec/ruby/core/thread/element_set_spec.rb74
-rw-r--r--spec/ruby/core/thread/exit_spec.rb15
-rw-r--r--spec/ruby/core/thread/fetch_spec.rb66
-rw-r--r--spec/ruby/core/thread/fixtures/classes.rb322
-rw-r--r--spec/ruby/core/thread/fork_spec.rb9
-rw-r--r--spec/ruby/core/thread/group_spec.rb16
-rw-r--r--spec/ruby/core/thread/handle_interrupt_spec.rb125
-rw-r--r--spec/ruby/core/thread/ignore_deadlock_spec.rb19
-rw-r--r--spec/ruby/core/thread/initialize_spec.rb27
-rw-r--r--spec/ruby/core/thread/inspect_spec.rb6
-rw-r--r--spec/ruby/core/thread/join_spec.rb70
-rw-r--r--spec/ruby/core/thread/key_spec.rb60
-rw-r--r--spec/ruby/core/thread/keys_spec.rb44
-rw-r--r--spec/ruby/core/thread/kill_spec.rb21
-rw-r--r--spec/ruby/core/thread/list_spec.rb55
-rw-r--r--spec/ruby/core/thread/main_spec.rb10
-rw-r--r--spec/ruby/core/thread/name_spec.rb54
-rw-r--r--spec/ruby/core/thread/native_thread_id_spec.rb35
-rw-r--r--spec/ruby/core/thread/new_spec.rb83
-rw-r--r--spec/ruby/core/thread/pass_spec.rb8
-rw-r--r--spec/ruby/core/thread/pending_interrupt_spec.rb32
-rw-r--r--spec/ruby/core/thread/priority_spec.rb72
-rw-r--r--spec/ruby/core/thread/raise_spec.rb235
-rw-r--r--spec/ruby/core/thread/report_on_exception_spec.rb155
-rw-r--r--spec/ruby/core/thread/run_spec.rb8
-rw-r--r--spec/ruby/core/thread/set_trace_func_spec.rb5
-rw-r--r--spec/ruby/core/thread/shared/exit.rb219
-rw-r--r--spec/ruby/core/thread/shared/start.rb41
-rw-r--r--spec/ruby/core/thread/shared/to_s.rb53
-rw-r--r--spec/ruby/core/thread/shared/wakeup.rb62
-rw-r--r--spec/ruby/core/thread/start_spec.rb9
-rw-r--r--spec/ruby/core/thread/status_spec.rb60
-rw-r--r--spec/ruby/core/thread/stop_spec.rb54
-rw-r--r--spec/ruby/core/thread/terminate_spec.rb7
-rw-r--r--spec/ruby/core/thread/thread_variable_get_spec.rb60
-rw-r--r--spec/ruby/core/thread/thread_variable_set_spec.rb62
-rw-r--r--spec/ruby/core/thread/thread_variable_spec.rb60
-rw-r--r--spec/ruby/core/thread/thread_variables_spec.rb39
-rw-r--r--spec/ruby/core/thread/to_s_spec.rb6
-rw-r--r--spec/ruby/core/thread/value_spec.rb31
-rw-r--r--spec/ruby/core/thread/wakeup_spec.rb7
-rw-r--r--spec/ruby/core/threadgroup/add_spec.rb39
-rw-r--r--spec/ruby/core/threadgroup/default_spec.rb11
-rw-r--r--spec/ruby/core/threadgroup/enclose_spec.rb24
-rw-r--r--spec/ruby/core/threadgroup/enclosed_spec.rb14
-rw-r--r--spec/ruby/core/threadgroup/list_spec.rb23
-rw-r--r--spec/ruby/core/time/_dump_spec.rb55
-rw-r--r--spec/ruby/core/time/_load_spec.rb51
-rw-r--r--spec/ruby/core/time/asctime_spec.rb6
-rw-r--r--spec/ruby/core/time/at_spec.rb316
-rw-r--r--spec/ruby/core/time/ceil_spec.rb44
-rw-r--r--spec/ruby/core/time/comparison_spec.rb130
-rw-r--r--spec/ruby/core/time/ctime_spec.rb6
-rw-r--r--spec/ruby/core/time/day_spec.rb6
-rw-r--r--spec/ruby/core/time/deconstruct_keys_spec.rb43
-rw-r--r--spec/ruby/core/time/dst_spec.rb6
-rw-r--r--spec/ruby/core/time/dup_spec.rb46
-rw-r--r--spec/ruby/core/time/eql_spec.rb29
-rw-r--r--spec/ruby/core/time/fixtures/classes.rb105
-rw-r--r--spec/ruby/core/time/floor_spec.rb36
-rw-r--r--spec/ruby/core/time/friday_spec.rb11
-rw-r--r--spec/ruby/core/time/getgm_spec.rb6
-rw-r--r--spec/ruby/core/time/getlocal_spec.rb206
-rw-r--r--spec/ruby/core/time/getutc_spec.rb6
-rw-r--r--spec/ruby/core/time/gm_spec.rb10
-rw-r--r--spec/ruby/core/time/gmt_offset_spec.rb6
-rw-r--r--spec/ruby/core/time/gmt_spec.rb8
-rw-r--r--spec/ruby/core/time/gmtime_spec.rb6
-rw-r--r--spec/ruby/core/time/gmtoff_spec.rb6
-rw-r--r--spec/ruby/core/time/hash_spec.rb11
-rw-r--r--spec/ruby/core/time/hour_spec.rb17
-rw-r--r--spec/ruby/core/time/inspect_spec.rb33
-rw-r--r--spec/ruby/core/time/isdst_spec.rb6
-rw-r--r--spec/ruby/core/time/iso8601_spec.rb6
-rw-r--r--spec/ruby/core/time/local_spec.rb11
-rw-r--r--spec/ruby/core/time/localtime_spec.rb203
-rw-r--r--spec/ruby/core/time/mday_spec.rb6
-rw-r--r--spec/ruby/core/time/min_spec.rb17
-rw-r--r--spec/ruby/core/time/minus_spec.rb121
-rw-r--r--spec/ruby/core/time/mktime_spec.rb11
-rw-r--r--spec/ruby/core/time/mon_spec.rb6
-rw-r--r--spec/ruby/core/time/monday_spec.rb11
-rw-r--r--spec/ruby/core/time/month_spec.rb6
-rw-r--r--spec/ruby/core/time/new_spec.rb753
-rw-r--r--spec/ruby/core/time/now_spec.rb181
-rw-r--r--spec/ruby/core/time/nsec_spec.rb31
-rw-r--r--spec/ruby/core/time/plus_spec.rb118
-rw-r--r--spec/ruby/core/time/round_spec.rb35
-rw-r--r--spec/ruby/core/time/saturday_spec.rb11
-rw-r--r--spec/ruby/core/time/sec_spec.rb7
-rw-r--r--spec/ruby/core/time/shared/asctime.rb6
-rw-r--r--spec/ruby/core/time/shared/day.rb15
-rw-r--r--spec/ruby/core/time/shared/getgm.rb9
-rw-r--r--spec/ruby/core/time/shared/gm.rb70
-rw-r--r--spec/ruby/core/time/shared/gmt_offset.rb59
-rw-r--r--spec/ruby/core/time/shared/gmtime.rb40
-rw-r--r--spec/ruby/core/time/shared/inspect.rb21
-rw-r--r--spec/ruby/core/time/shared/isdst.rb8
-rw-r--r--spec/ruby/core/time/shared/local.rb42
-rw-r--r--spec/ruby/core/time/shared/month.rb15
-rw-r--r--spec/ruby/core/time/shared/now.rb33
-rw-r--r--spec/ruby/core/time/shared/time_params.rb271
-rw-r--r--spec/ruby/core/time/shared/to_i.rb16
-rw-r--r--spec/ruby/core/time/shared/xmlschema.rb31
-rw-r--r--spec/ruby/core/time/strftime_spec.rb91
-rw-r--r--spec/ruby/core/time/subsec_spec.rb27
-rw-r--r--spec/ruby/core/time/sunday_spec.rb11
-rw-r--r--spec/ruby/core/time/thursday_spec.rb11
-rw-r--r--spec/ruby/core/time/time_spec.rb7
-rw-r--r--spec/ruby/core/time/to_a_spec.rb12
-rw-r--r--spec/ruby/core/time/to_f_spec.rb7
-rw-r--r--spec/ruby/core/time/to_i_spec.rb6
-rw-r--r--spec/ruby/core/time/to_r_spec.rb11
-rw-r--r--spec/ruby/core/time/to_s_spec.rb6
-rw-r--r--spec/ruby/core/time/tuesday_spec.rb11
-rw-r--r--spec/ruby/core/time/tv_nsec_spec.rb5
-rw-r--r--spec/ruby/core/time/tv_sec_spec.rb6
-rw-r--r--spec/ruby/core/time/tv_usec_spec.rb5
-rw-r--r--spec/ruby/core/time/usec_spec.rb43
-rw-r--r--spec/ruby/core/time/utc_offset_spec.rb6
-rw-r--r--spec/ruby/core/time/utc_spec.rb66
-rw-r--r--spec/ruby/core/time/wday_spec.rb9
-rw-r--r--spec/ruby/core/time/wednesday_spec.rb11
-rw-r--r--spec/ruby/core/time/xmlschema_spec.rb6
-rw-r--r--spec/ruby/core/time/yday_spec.rb12
-rw-r--r--spec/ruby/core/time/year_spec.rb17
-rw-r--r--spec/ruby/core/time/zone_spec.rb111
-rw-r--r--spec/ruby/core/tracepoint/allow_reentry_spec.rb30
-rw-r--r--spec/ruby/core/tracepoint/binding_spec.rb21
-rw-r--r--spec/ruby/core/tracepoint/callee_id_spec.rb18
-rw-r--r--spec/ruby/core/tracepoint/defined_class_spec.rb27
-rw-r--r--spec/ruby/core/tracepoint/disable_spec.rb76
-rw-r--r--spec/ruby/core/tracepoint/enable_spec.rb543
-rw-r--r--spec/ruby/core/tracepoint/enabled_spec.rb15
-rw-r--r--spec/ruby/core/tracepoint/eval_script_spec.rb23
-rw-r--r--spec/ruby/core/tracepoint/event_spec.rb22
-rw-r--r--spec/ruby/core/tracepoint/fixtures/classes.rb40
-rw-r--r--spec/ruby/core/tracepoint/inspect_spec.rb141
-rw-r--r--spec/ruby/core/tracepoint/lineno_spec.rb20
-rw-r--r--spec/ruby/core/tracepoint/method_id_spec.rb15
-rw-r--r--spec/ruby/core/tracepoint/new_spec.rb72
-rw-r--r--spec/ruby/core/tracepoint/parameters_spec.rb28
-rw-r--r--spec/ruby/core/tracepoint/path_spec.rb41
-rw-r--r--spec/ruby/core/tracepoint/raised_exception_spec.rb38
-rw-r--r--spec/ruby/core/tracepoint/return_value_spec.rb17
-rw-r--r--spec/ruby/core/tracepoint/self_spec.rb26
-rw-r--r--spec/ruby/core/tracepoint/trace_spec.rb10
-rw-r--r--spec/ruby/core/true/and_spec.rb11