From c92490f9945835a7f24f5f45b0c0722fccbd4d69 Mon Sep 17 00:00:00 2001 From: mimaki Date: Sun, 20 Apr 2025 13:15:02 +0900 Subject: [PATCH 01/72] mruby 3.4.0 released. --- .../2025-04-20-mruby-3.4.0-released.markdown | 273 ++++++++++++++++++ 1 file changed, 273 insertions(+) create mode 100644 _posts/2025-04-20-mruby-3.4.0-released.markdown diff --git a/_posts/2025-04-20-mruby-3.4.0-released.markdown b/_posts/2025-04-20-mruby-3.4.0-released.markdown new file mode 100644 index 0000000..f935f5b --- /dev/null +++ b/_posts/2025-04-20-mruby-3.4.0-released.markdown @@ -0,0 +1,273 @@ +--- +layout: post +title: "mruby 3.4.0 released" +date: 2025-04-20 00:00:00 +categories: releases +--- + +# mruby 3.4.0 + +We are announcing the first stable release of mruby 3.4 series - [mruby 3.4.0](https://github.com/mruby/mruby/releases/tag/3.4.0). + +Describes the new features and changes in mruby 3.4. +The main changes in mruby 3.4 are also described in [doc/mruby3.4.md](https://github.com/mruby/mruby/blob/master/doc/mruby3.4.md). + +--- + +# User visible changes in `mruby3.4` from `mruby3.3` + +"**_NOTE_**:" are changes to be aware of. + +# The language + +- mruby now supports `private` and `protected` visibitily ([b0db0bd](https://github.com/mruby/mruby/commit/b0db0bd)) +- Maximum length of inlined symbols reduced from 5 to 4 characters to provide space for visibility flags ([6442a01](https://github.com/mruby/mruby/commit/6442a01)) +- Many methods are made private according to CRuby visibility ([4a0e806](https://github.com/mruby/mruby/commit/4a0e806)) +- Generate OP_SSEND for `self.method` type calls ([111fe4b](https://github.com/mruby/mruby/commit/111fe4b)) +- `initialize` method will be always private ([eb8b412](https://github.com/mruby/mruby/commit/eb8b412)) +- Add new hooks `method_removed`, `method_undefined` ([9c74f6e](https://github.com/mruby/mruby/commit/9c74f6e)) +- Add new hooks `singleton_method_removed`, `singleton_method_undefined` ([0863c08](https://github.com/mruby/mruby/commit/0863c08)) +- Updated `OP_DEF` output from codedump ([3a3e877](https://github.com/mruby/mruby/commit/3a3e877)) +- Better handling of binary strings, e.g. String#b ([b0127f0](https://github.com/mruby/mruby/commit/b0127f0)) +- Hash `to_s` format has changed ([baeeb5e](https://github.com/mruby/mruby/commit/baeeb5e)) +- Some encoding related method such as `#force_encoding` ([e47b4ca](https://github.com/mruby/mruby/commit/e47b4ca)), `#b` ([b0127f0](https://github.com/mruby/mruby/commit/b0127f0)) +- Constant folding for `String#+` ([6687bdd](https://github.com/mruby/mruby/commit/6687bdd)) +- Remove Float bit-operation ([db8368f](https://github.com/mruby/mruby/commit/db8368f)) +- use SWAR technique for strlen performance ([cbb31e6](https://github.com/mruby/mruby/commit/cbb31e6)) +- use merge sort for `Array#sort` ([5bd63d6](https://github.com/mruby/mruby/commit/5bd63d6)) + +# Changes in C API + +- pool.c renamed to mempool.c (and mrb_pool to mrb_mempool) ([49525fa](https://github.com/mruby/mruby/commit/49525fa)) +- mrb_pool_value renamed to mrb_irep_pool to reduce confusion ([62ef5db](https://github.com/mruby/mruby/commit/62ef5db)) +- rename BOXNIX_SET_VALUE to BOXNO_SET_VALUE ([#6397](https://github.com/mruby/mruby/pull/6397)) +- `MRB_FROZEN_P()` is replaced by `mrb_frozen_p()` ([c11d18e](https://github.com/mruby/mruby/commit/c11d18e)) +- rename `color` to `gc_color` ([0e79f6b](https://github.com/mruby/mruby/commit/0e79f6b), [1e36d76](https://github.com/mruby/mruby/commit/1e36d76)) +- add `obj->frozen` instead of flags `MRB_SET_FROZEN_FLAG`/`MRB_UNSET_FROZEN_FLAG` ([8276143](https://github.com/mruby/mruby/commit/8276143)) + +# Build & Configuration + +- New Build Target: `test:run:serial`, `test:run:serial:lib`, `test:run:serial:bin` ([#6423](https://github.com/mruby/mruby/pull/6423)) +- New Platform: Playstation Portable ([#6022](https://github.com/mruby/mruby/pull/6465)) +- New Platform: emscripten ([#6487](https://github.com/mruby/mruby/pull/6487)) +- New Config: no-float (with MRB_NO_FLOAT) ([32200f1](https://github.com/mruby/mruby/commit/32200f1)) + +# Changes in mrbgems + +- **mruby-print**: removed; if you do not use `mruby-io`, mruby use `#print` etc. in the core ([8c8bbd9](https://github.com/mruby/mruby/commit/8c8bbd9)) +- **mruby-enum-lazy**: Add Enumerable::Lazy#grep_v to mruby-enum-lazy ([#6171](https://github.com/mruby/mruby/pull/6171)) +- **mruby-io**: Add `level` argument to `File.dirname` ([#6463](https://github.com/mruby/mruby/pull/6463)) +- **mruby-io**: File.absolute_path? ([#6482](https://github.com/mruby/mruby/pull/6482)) +- **mruby-io**: File.absolute_path ([96113a2](https://github.com/mruby/mruby/commit/96113a2)) +- **mruby-toplevel-ext**: top-level public/private/protected moved to the core ([2a876d2](https://github.com/mruby/mruby/commit/2a876d2)) +- **mruby-metaprog**: method list methods now works according to the visibility ([9229da1](https://github.com/mruby/mruby/commit/9229da1)) +- **mruby-metaprog**: `public_instance_methods`, `private_instance_methods`, `protected_instance_methods` ([9e3e7b2](https://github.com/mruby/mruby/commit/9e3e7b2)) +- **mruby-encoding**: MRB_UTF8_STRING turned on automatically with this gem ([74bdae9](https://github.com/mruby/mruby/commit/74bdae9)) + +# Fixed GitHub Issues + +- [#6173](https://github.com/mruby/mruby/issues/6173) Fails to build with tcc(Tiny C Compiler) +- [#6156](https://github.com/mruby/mruby/issues/6156) '/LIBPATH' issue +- [#6183](https://github.com/mruby/mruby/issues/6183) ".e".to_f returns NAN +- [#6182](https://github.com/mruby/mruby/issues/6182) mrb_read_float() converts "0.3" with a small error compared to strtod() +- [#6210](https://github.com/mruby/mruby/issues/6210) Unary minus seems broken +- [#6255](https://github.com/mruby/mruby/issues/6255) Wrong number of characters in broken UTF-8 string +- [#4038](https://github.com/mruby/mruby/issues/4038) Heap buffer overflow in OP_ENTER +- [#6262](https://github.com/mruby/mruby/issues/6262) Unable to define == for objects when using Array#delete +- [#6267](https://github.com/mruby/mruby/issues/6267) When MRB_UTF8_STRING is enabled, giving byte characters for String#index and String#split gives wrong results +- [#6277](https://github.com/mruby/mruby/issues/6277) MSVC: can't use malloc() in string.c with WIN32_LEAN_AND_MEAN +- [#6240](https://github.com/mruby/mruby/issues/6240) Differentiate between lib and lib64 in the build settings. +- [#6304](https://github.com/mruby/mruby/issues/6304) Calling method_missing with only Kwargs passes arguments incorrectly +- [#6317](https://github.com/mruby/mruby/issues/6317) mrb_gc_register() may cause GC and collect the object being protected +- [#6307](https://github.com/mruby/mruby/issues/6307) Planned change patch for mrb_vm_exec() +- [#6298](https://github.com/mruby/mruby/issues/6298) foo :bar {} is legal in mruby? +- [#6326](https://github.com/mruby/mruby/issues/6326) Detect “Use-after-free” with address sanitizer +- [#5358](https://github.com/mruby/mruby/issues/5358) static warning from getpwnam +- [#6339](https://github.com/mruby/mruby/issues/6339) mrb_ary_delete() may refer to an invalid address (use-after-free) +- [#6346](https://github.com/mruby/mruby/issues/6346) Block kwargs are passed as last positional arg when using yield +- [#6365](https://github.com/mruby/mruby/issues/6365) powl() not available when compiling for Dreamcast +- [#6369](https://github.com/mruby/mruby/issues/6369) 100x Performance Regression from 3.1 +- [#6270](https://github.com/mruby/mruby/issues/6270) NODE_ZSUPER from deeply nested blocks will result in a truncated digits for block index in OP_ARGARY +- [#6297](https://github.com/mruby/mruby/issues/6297) Assigning to a block variable changes the actual block (thus affecting block_given? and yield) +- [#6389](https://github.com/mruby/mruby/issues/6389) instance_exec named block args don't work properly +- [#6388](https://github.com/mruby/mruby/issues/6388) Recent commit broke my windows build +- [#6411](https://github.com/mruby/mruby/issues/6411) Wrong function unwinding when using return in a block +- [#6439](https://github.com/mruby/mruby/issues/6439) OP_JMPUW does not call the ensure block when it jumps to the beginning of the begin block +- [#6441](https://github.com/mruby/mruby/issues/6441) break inside while loop will execute the ensure block outside of the while loop +- [#6453](https://github.com/mruby/mruby/issues/6453) Bigint: incorrect behavior of ^ operator +- [#6452](https://github.com/mruby/mruby/issues/6452) Bigint: weird mod behavior +- [#6451](https://github.com/mruby/mruby/issues/6451) Bigint: incorrect division behavior +- [#6456](https://github.com/mruby/mruby/issues/6456) bigint: bug with division of a small number by a bigint +- [#6466](https://github.com/mruby/mruby/issues/6466) mruby-bin-mruby using Kernel#p and Kernel#print in bintest fails test +- [#6467](https://github.com/mruby/mruby/issues/6467) Heap-Use-After-Free due to Recursive group_by Calls +- [#6471](https://github.com/mruby/mruby/issues/6471) Discrepancy in codegen for binary operations between master branch and 3.3.0 +- [#6477](https://github.com/mruby/mruby/issues/6477) heap-buffer-overflow in mrb_vm_exec +- [#6485](https://github.com/mruby/mruby/issues/6485) Hash#rehash does not check if the hash is frozen +- [#6483](https://github.com/mruby/mruby/issues/6483) Hash#default_proc= accepts arbitrary objects that are not callable +- [#6491](https://github.com/mruby/mruby/issues/6491) Destroy existing string literals when composing string literals + +# Merged Pull Requests (User Visible Ones) + +- [#6171](https://github.com/mruby/mruby/pull/6171) Add Enumerable::Lazy#grep_v to mruby-enum-lazy +- [#6174](https://github.com/mruby/mruby/pull/6174) Fix MRUBY_PACKAGE_DIR in mruby-config.bat +- [#6175](https://github.com/mruby/mruby/pull/6175) Corrected strange conditional in mrb_vm_run() +- [#6176](https://github.com/mruby/mruby/pull/6176) Stop assuming alias proc in CI_PROC_SET() +- [#6177](https://github.com/mruby/mruby/pull/6177) gha: add macOS 14 to the build +- [#6184](https://github.com/mruby/mruby/pull/6184) Remove the L_STOP label +- [#6185](https://github.com/mruby/mruby/pull/6185) Added mrb_callinfo::u.keep_context for clarity +- [#6186](https://github.com/mruby/mruby/pull/6186) Omit NULL check of e->cxt in OP_RETURN_BLK +- [#6191](https://github.com/mruby/mruby/pull/6191) Speed up symbol equality comparison +- [#6192](https://github.com/mruby/mruby/pull/6192) Fix `OP_STOP` with exception +- [#6193](https://github.com/mruby/mruby/pull/6193) Fix wrong assertion in `OP_SENDB`. +- [#6194](https://github.com/mruby/mruby/pull/6194) Simplify the calculation of the number of closures in `MRB_TT_FIBER` +- [#6197](https://github.com/mruby/mruby/pull/6197) Fix int_xor to call flo_xor. +- [#6201](https://github.com/mruby/mruby/pull/6201) tasks/doc.rake: standardize the `rake doc` error messages +- [#6202](https://github.com/mruby/mruby/pull/6202) Remove the `.yardoc` folder with `rake doc:clean:api` +- [#6204](https://github.com/mruby/mruby/pull/6204) Clean up the `.editorconfig` file +- [#6209](https://github.com/mruby/mruby/pull/6209) Minor `.gitignore` clean up +- [#6211](https://github.com/mruby/mruby/pull/6211) Minor `.gitignore` clean up; order entries +- [#6216](https://github.com/mruby/mruby/pull/6216) Shared empty `iv_tbl` of module +- [#6217](https://github.com/mruby/mruby/pull/6217) Strict declaration for `mrb_istruct_size()` +- [#6219](https://github.com/mruby/mruby/pull/6219) Avoid assigning a fixed value in the loop +- [#6220](https://github.com/mruby/mruby/pull/6220) Reorganize `mrb_cache_entry` and `mrb_method_t` types +- [#6221](https://github.com/mruby/mruby/pull/6221) Arranging `each_backtrace()` +- [#6222](https://github.com/mruby/mruby/pull/6222) Need to synchronize `dbg->regs` after VM call in `mrdb` +- [#6224](https://github.com/mruby/mruby/pull/6224) `mrb_env_unshare()` to break the link to fiber +- [#6225](https://github.com/mruby/mruby/pull/6225) Revert "Adjust environment when `mrb_exec_irep` happened." +- [#6227](https://github.com/mruby/mruby/pull/6227) fix: `Array#shuffle(!)` result distribution +- [#6228](https://github.com/mruby/mruby/pull/6228) Revert "`env` referred from top-level callinfo should not be unshared; fix #4019" +- [#6230](https://github.com/mruby/mruby/pull/6230) Fix status of fiber after switched by exception raised +- [#6231](https://github.com/mruby/mruby/pull/6231) Add a way to let other gems handle closing of fds in mruby-io +- [#6232](https://github.com/mruby/mruby/pull/6232) Fold the code for freeing `env` +- [#6233](https://github.com/mruby/mruby/pull/6233) Free stack memory at end of fiber +- [#6235](https://github.com/mruby/mruby/pull/6235) fix `Array#delete` always firing the block when deleting `nil` +- [#6236](https://github.com/mruby/mruby/pull/6236) unify the code for filter methods (and speed up `#reject!`) +- [#6237](https://github.com/mruby/mruby/pull/6237) Stricter env objects to attach to ci +- [#6238](https://github.com/mruby/mruby/pull/6238) Minimize zero initialization of the stack +- [#6243](https://github.com/mruby/mruby/pull/6243) Fixed base64 decoding in `mruby-pack` +- [#6244](https://github.com/mruby/mruby/pull/6244) Revise scope of role of `mrb_vm_run()` +- [#6246](https://github.com/mruby/mruby/pull/6246) Fix typo in `test/t/hash.rb` +- [#6249](https://github.com/mruby/mruby/pull/6249) Fix grammar in `src/vm.c`; `catched` -> `caught` +- [#6250](https://github.com/mruby/mruby/pull/6250) Fix spelling +- [#6251](https://github.com/mruby/mruby/pull/6251) Clean up root move `CODEOWNERS` to `.github` directory +- [#6253](https://github.com/mruby/mruby/pull/6253) Allow recycling fibers by GC if not referenced directly +- [#6256](https://github.com/mruby/mruby/pull/6256) Update documentation for `mrb_top_run()` +- [#6257](https://github.com/mruby/mruby/pull/6257) fix some mrbconf.md typos +- [#6260](https://github.com/mruby/mruby/pull/6260) Remove `exc_caught` from `mrb_vm_exec()` +- [#6261](https://github.com/mruby/mruby/pull/6261) fix: `to_a` integer ranges with `begin > end` failing +- [#6263](https://github.com/mruby/mruby/pull/6263) fix: `Array#delete` mistakenly calling block even if not passed +- [#6264](https://github.com/mruby/mruby/pull/6264) Must pass keyword arguments for `Kernel#to_enum` +- [#6265](https://github.com/mruby/mruby/pull/6265) Fixes `Dir.children` and `Dir.each_child` +- [#6266](https://github.com/mruby/mruby/pull/6266) Passes the nonexistent key as a block argument in `Array#delete` +- [#6273](https://github.com/mruby/mruby/pull/6273) Improvements to `mrb_protect_atexit()` +- [#6275](https://github.com/mruby/mruby/pull/6275) Fixed `Binding#eval` that failed to assign to the same variable +- [#6276](https://github.com/mruby/mruby/pull/6276) Always run `atexit` on the top-level call frame +- [#6279](https://github.com/mruby/mruby/pull/6279) Include headers for malloc() explicitly; fix #6277 +- [#6280](https://github.com/mruby/mruby/pull/6280) Remove `MRB_ENV_CLOSED` flag +- [#6281](https://github.com/mruby/mruby/pull/6281) Fixes local variables in `mruby-binding`. +- [#6283](https://github.com/mruby/mruby/pull/6283) Simplify `uvenv()` +- [#6288](https://github.com/mruby/mruby/pull/6288) Detach `env` of ci explicitly on atexit +- [#6289](https://github.com/mruby/mruby/pull/6289) Simplify `OP_RETURN_BLK` and `OP_BREAK` +- [#6290](https://github.com/mruby/mruby/pull/6290) Allow to change the output directory name of the `libmruby` file +- [#6293](https://github.com/mruby/mruby/pull/6293) Changed the instruction table in `opcode.md` +- [#6294](https://github.com/mruby/mruby/pull/6294) Optimise `mrb_iv_get` +- [#6302](https://github.com/mruby/mruby/pull/6302) Minor cleanup in mrb_str_init +- [#6303](https://github.com/mruby/mruby/pull/6303) mrb_str_aset_m() should return replace instead of str +- [#6305](https://github.com/mruby/mruby/pull/6305) Protect keyword arguments in `prepare_missing()` +- [#6308](https://github.com/mruby/mruby/pull/6308) Assume that `MRB_CATCH()` has `mrb->exc` set +- [#6310](https://github.com/mruby/mruby/pull/6310) Doubling the call stack when extending it +- [#6311](https://github.com/mruby/mruby/pull/6311) Added fast-path for positional arguments less than 15 in `OP_SEND` +- [#6312](https://github.com/mruby/mruby/pull/6312) Omit error checking at `OP_RETURN`, `OP_RETURN_BLK` and `OP_BREAK` +- [#6313](https://github.com/mruby/mruby/pull/6313) Fix wrong column number in opcode.md +- [#6314](https://github.com/mruby/mruby/pull/6314) Optimize even?/odd? for big integers +- [#6318](https://github.com/mruby/mruby/pull/6318) Shrink variables in `mrb_vm_exec()` +- [#6320](https://github.com/mruby/mruby/pull/6320) Shrinking the code in `OP_BREAK` and `OP_RETURN_BLK` +- [#6321](https://github.com/mruby/mruby/pull/6321) Avoid warnings in `lib/**/*.rb` +- [#6322](https://github.com/mruby/mruby/pull/6322) Fix mrb_ro_data_p on Intel Mac +- [#6324](https://github.com/mruby/mruby/pull/6324) Remove `localjump_error()` +- [#6327](https://github.com/mruby/mruby/pull/6327) fix ncurses linking issues +- [#6328](https://github.com/mruby/mruby/pull/6328) Fix use-after-free in `obj_free()` for env objects +- [#6329](https://github.com/mruby/mruby/pull/6329) Fix use-after-free in `mrb_obj_alloc()` +- [#6330](https://github.com/mruby/mruby/pull/6330) Add a precondition to call `mrb_env_unshare()`. +- [#6331](https://github.com/mruby/mruby/pull/6331) Restore the GC arena with tests +- [#6332](https://github.com/mruby/mruby/pull/6332) Must not depend on the “host” build to generate `mruby-compiler/core/y.tab.c` +- [#6333](https://github.com/mruby/mruby/pull/6333) Reduce the number of branch instructions in the `heap_p()` +- [#6335](https://github.com/mruby/mruby/pull/6335) Add `return_ci` in `CHECKPOINT_MAIN()` of `OP_RETURN` +- [#6338](https://github.com/mruby/mruby/pull/6338) Need to place static proc objects into 8-byte alignments +- [#6340](https://github.com/mruby/mruby/pull/6340) Fix use-after-free for `Array#<=>` +- [#6341](https://github.com/mruby/mruby/pull/6341) Need to restore the GC arena after some function calls +- [#6344](https://github.com/mruby/mruby/pull/6344) prefer using `mrb_yield` to call block arguments +- [#6347](https://github.com/mruby/mruby/pull/6347) codegen.c,parse.y: remove flattening of `yield` arguments; fix #6346 +- [#6348](https://github.com/mruby/mruby/pull/6348) Cancel the warning disablement +- [#6349](https://github.com/mruby/mruby/pull/6349) Perform GC before deleting directories +- [#6350](https://github.com/mruby/mruby/pull/6350) Fixed character encoding conversion function mismatch +- [#6351](https://github.com/mruby/mruby/pull/6351) Remove unnecessary `mrb_gc_arena_restore()` +- [#6353](https://github.com/mruby/mruby/pull/6353) Fix use-after-free in `mrb_ary_delete()` +- [#6356](https://github.com/mruby/mruby/pull/6356) Making splat argument objects invisible from Ruby side +- [#6373](https://github.com/mruby/mruby/pull/6373) Add build config for Milk-V Duo (RISC-V Linux) board +- [#6382](https://github.com/mruby/mruby/pull/6382) Make array objects invisible in `mrb_gc_register()` +- [#6385](https://github.com/mruby/mruby/pull/6385) Small improvements for `mrb_gc_register()` +- [#6386](https://github.com/mruby/mruby/pull/6386) Avoid calling `mrb_gv_set()` from `mrb_gc_unregister()` +- [#6387](https://github.com/mruby/mruby/pull/6387) Small improvements for `mrb_gc_unregister()` +- [#6390](https://github.com/mruby/mruby/pull/6390) Fix use-after-free by `mrb_gc_unregistor()` +- [#6391](https://github.com/mruby/mruby/pull/6391) Fixed argument forwarding in `instance_exec` +- [#6392](https://github.com/mruby/mruby/pull/6392) Fix argument forwarding in `mrb_exec_irep()` +- [#6393](https://github.com/mruby/mruby/pull/6393) Follow-up to #6391 +- [#6395](https://github.com/mruby/mruby/pull/6395) Storing method-id inside Symbol#to_proc +- [#6396](https://github.com/mruby/mruby/pull/6396) Milk-V Build Config: update GPIO gem URL +- [#6397](https://github.com/mruby/mruby/pull/6397) boxing_no.h: rename BOXNIX_SET_VALUE -> BOXNO_SET_VALUE +- [#6399](https://github.com/mruby/mruby/pull/6399) Add macOS 15 to the build +- [#6405](https://github.com/mruby/mruby/pull/6405) `io_read`: use `%i` instead of `%d` in call to `mrb_raisef` +- [#6407](https://github.com/mruby/mruby/pull/6407) Allow to exclude specific files in `rake install` +- [#6408](https://github.com/mruby/mruby/pull/6408) Improve compliance with C++ standards +- [#6410](https://github.com/mruby/mruby/pull/6410) Put `#include ` in `parse.y` +- [#6412](https://github.com/mruby/mruby/pull/6412) Distinguish the call frame of the generator with `OP_RETURN_BLK` +- [#6413](https://github.com/mruby/mruby/pull/6413) Add links to documentation in `README.md` +- [#6415](https://github.com/mruby/mruby/pull/6415) Fix numbered parameters when used as a singleton +- [#6416](https://github.com/mruby/mruby/pull/6416) Optimize the "new" method's iseq +- [#6419](https://github.com/mruby/mruby/pull/6419) Follow Ruby's behavior for numbered parameters in -> {} +- [#6420](https://github.com/mruby/mruby/pull/6420) Update `labeler.yml`: add label for the `tools` directory +- [#6422](https://github.com/mruby/mruby/pull/6422) Add annotations for function names defined in the preprocessor +- [#6423](https://github.com/mruby/mruby/pull/6423) Adding a serialized test task +- [#6427](https://github.com/mruby/mruby/pull/6427) Need to update `ci` variable after re-entry to VM +- [#6428](https://github.com/mruby/mruby/pull/6428) Change the limits of OP_ADDI and OP_SUBI from 0-127 to 0-255. +- [#6429](https://github.com/mruby/mruby/pull/6429) Fix numbered parameters when used as hash keys +- [#6432](https://github.com/mruby/mruby/pull/6432) Moving code in macro arguments out of macros +- [#6434](https://github.com/mruby/mruby/pull/6434) Added document "Layout of the mruby filesystem" +- [#6436](https://github.com/mruby/mruby/pull/6436) Make `rake doc:update-index` prettier friendly +- [#6437](https://github.com/mruby/mruby/pull/6437) Add more details to the pre-commit config +- [#6438](https://github.com/mruby/mruby/pull/6438) Remove unused `MRuby::Build#list_install_excludes` method +- [#6440](https://github.com/mruby/mruby/pull/6440) Fix `redo` keyword +- [#6442](https://github.com/mruby/mruby/pull/6442) Fixed wrong range condition in `OP_JMPUW` +- [#6443](https://github.com/mruby/mruby/pull/6443) Fix NODE_NEGATE for bigints +- [#6444](https://github.com/mruby/mruby/pull/6444) Add test cases for bigints +- [#6446](https://github.com/mruby/mruby/pull/6446) Omit the `_WIN64` definition check +- [#6447](https://github.com/mruby/mruby/pull/6447) Fixed `File.expand_path` +- [#6448](https://github.com/mruby/mruby/pull/6448) Suppress presym in `mruby/ext/io.h` file +- [#6449](https://github.com/mruby/mruby/pull/6449) Using presym in the `mruby-io/src/file_test.c` file +- [#6450](https://github.com/mruby/mruby/pull/6450) Change `MRB_WITH_IO_PREAD_PWRITE` configuration name +- [#6454](https://github.com/mruby/mruby/pull/6454) mruby-bigint: handle rhs bigint in int_mod and int_divmod functions +- [#6455](https://github.com/mruby/mruby/pull/6455) mruby-bigint: fix rounding behavior in mpz_mdiv and mpz_mdivmod functions +- [#6457](https://github.com/mruby/mruby/pull/6457) bigint: fix bug with division of a small number by a bigint +- [#6459](https://github.com/mruby/mruby/pull/6459) `FileTest` is a module +- [#6461](https://github.com/mruby/mruby/pull/6461) To create a release package file in draft +- [#6462](https://github.com/mruby/mruby/pull/6462) Properly cast the return value of `memchr()` +- [#6463](https://github.com/mruby/mruby/pull/6463) Add `level` argument to `File.dirname` +- [#6465](https://github.com/mruby/mruby/pull/6465) Add initial playstation portable crossbuild support +- [#6468](https://github.com/mruby/mruby/pull/6468) Fixed missing changes to `IB_FIND_BY_KEY()` parameter names +- [#6469](https://github.com/mruby/mruby/pull/6469) Add more `const` qualifier for `RProc` +- [#6472](https://github.com/mruby/mruby/pull/6472) Moved tests for `Integer#quo` +- [#6473](https://github.com/mruby/mruby/pull/6473) Hide `mpz_and()` symbol +- [#6473](https://github.com/mruby/mruby/pull/6473) Hide mpz_and() symbol +- [#6474](https://github.com/mruby/mruby/pull/6474) Avoid array object creation with “unknown keyword” error +- [#6475](https://github.com/mruby/mruby/pull/6475) Don't include deleted mruby-print +- [#6478](https://github.com/mruby/mruby/pull/6478) Fixed buffer overrun in function `chars2bytes()` +- [#6479](https://github.com/mruby/mruby/pull/6479) Reimplementation of `File.expand_path` method +- [#6482](https://github.com/mruby/mruby/pull/6482) Add `File.absolute_path?` method +- [#6487](https://github.com/mruby/mruby/pull/6487) Add Emscripten toolchain & build_config + +--- + +We have done 1,188 commits to 354 files with 20,650 additions and 21,537 deletions since mruby 3.3.0. For more detail of the updates, [see Commit Log](https://github.com/mruby/mruby/compare/3.3.0...3.4.0). + +Thanks to all the contributors who have worked on bug fixes and improvements in the release of `mruby 3.4.0`. From 09a4ebef39322774c9ba0b89225155c5a563d684 Mon Sep 17 00:00:00 2001 From: Hir0 Date: Mon, 21 Apr 2025 14:34:58 +0900 Subject: [PATCH 02/72] Update index.html update download link --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 7e4893c..0b16f73 100644 --- a/index.html +++ b/index.html @@ -11,7 +11,7 @@

From 2068841c136c467cde8a1a350084b1fc76ad26c5 Mon Sep 17 00:00:00 2001 From: Hir0 Date: Mon, 21 Apr 2025 14:37:01 +0900 Subject: [PATCH 03/72] Update index.html Update download link --- downloads/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/downloads/index.html b/downloads/index.html index 359ed42..0160650 100644 --- a/downloads/index.html +++ b/downloads/index.html @@ -7,7 +7,7 @@

Downloads

- Current stable: mruby 3.3.0 + Current stable: mruby 3.3.0

From 946c31ffde3e374cf2c90c46d1d151ee61b44d68 Mon Sep 17 00:00:00 2001 From: Hir0 Date: Mon, 21 Apr 2025 15:54:28 +0900 Subject: [PATCH 04/72] Update index.html Update 3.4.0 --- downloads/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/downloads/index.html b/downloads/index.html index 0160650..4981bf3 100644 --- a/downloads/index.html +++ b/downloads/index.html @@ -7,7 +7,7 @@

Downloads

- Current stable: mruby 3.3.0 + Current stable: mruby 3.4.0

From 8f20ff3ac81afbf1da4cbc2413e103d45713f13f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 22 Apr 2025 04:50:51 +0000 Subject: [PATCH 05/72] Bump nokogiri from 1.18.4 to 1.18.8 Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.18.4 to 1.18.8. - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.18.4...v1.18.8) --- updated-dependencies: - dependency-name: nokogiri dependency-version: 1.18.8 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 623a225..f14c384 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -239,10 +239,10 @@ GEM minitest (5.25.4) net-http (0.4.1) uri - nokogiri (1.18.4) + nokogiri (1.18.8) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.18.4-x86_64-darwin) + nokogiri (1.18.8-x86_64-darwin) racc (~> 1.4) octokit (4.25.1) faraday (>= 1, < 3) From 2b9e8ab24facda97e47c5fbac83eaaeab4dd3523 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 15 May 2025 18:26:58 +0000 Subject: [PATCH 06/72] Bump git from 3.0.0 to 3.0.2 Bumps [git](https://github.com/ruby-git/ruby-git) from 3.0.0 to 3.0.2. - [Release notes](https://github.com/ruby-git/ruby-git/releases) - [Changelog](https://github.com/ruby-git/ruby-git/blob/master/CHANGELOG.md) - [Commits](https://github.com/ruby-git/ruby-git/compare/v3.0.0...v3.0.2) --- updated-dependencies: - dependency-name: git dependency-version: 3.0.2 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index f14c384..cbbceb0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ GEM remote: https://rubygems.org/ specs: - activesupport (7.2.2.1) + activesupport (8.0.2) base64 benchmark (>= 0.3) bigdecimal @@ -13,6 +13,7 @@ GEM minitest (>= 5.1) securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) base64 (0.2.0) @@ -26,7 +27,7 @@ GEM colorator (1.1.0) commonmarker (0.23.10) concurrent-ruby (1.3.5) - connection_pool (2.5.0) + connection_pool (2.5.3) csv (3.3.0) dnsruby (1.72.2) simpleidn (~> 0.2.1) @@ -47,7 +48,7 @@ GEM ffi (1.17.0-x86_64-darwin) forwardable-extended (2.6.0) gemoji (4.1.0) - git (3.0.0) + git (3.0.2) activesupport (>= 5.0) addressable (~> 2.8) process_executer (~> 1.3) @@ -228,7 +229,7 @@ GEM listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - logger (1.6.6) + logger (1.7.0) mercenary (0.3.6) mgem (0.3.0) mini_portile2 (2.8.8) @@ -236,7 +237,7 @@ GEM jekyll (>= 3.5, < 5.0) jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) - minitest (5.25.4) + minitest (5.25.5) net-http (0.4.1) uri nokogiri (1.18.8) From 76ca6def71f073f7cef390066b8f193da691b746 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 May 2025 18:28:35 +0000 Subject: [PATCH 07/72] Bump git from 3.0.2 to 3.1.0 Bumps [git](https://github.com/ruby-git/ruby-git) from 3.0.2 to 3.1.0. - [Release notes](https://github.com/ruby-git/ruby-git/releases) - [Changelog](https://github.com/ruby-git/ruby-git/blob/master/CHANGELOG.md) - [Commits](https://github.com/ruby-git/ruby-git/compare/v3.0.2...v3.1.0) --- updated-dependencies: - dependency-name: git dependency-version: 3.1.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index cbbceb0..2b7bd2d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -48,7 +48,7 @@ GEM ffi (1.17.0-x86_64-darwin) forwardable-extended (2.6.0) gemoji (4.1.0) - git (3.0.2) + git (3.1.0) activesupport (>= 5.0) addressable (~> 2.8) process_executer (~> 1.3) @@ -278,7 +278,7 @@ GEM tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (1.8.0) - uri (0.13.2) + uri (1.0.3) webrick (1.8.2) yard (0.9.36) yard-coderay (0.1.0) From 813a9eb11f27340363d0f8d68105d080e669acf0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Jul 2025 18:14:11 +0000 Subject: [PATCH 08/72] Bump git from 3.1.0 to 3.1.1 --- updated-dependencies: - dependency-name: git dependency-version: 3.1.1 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2b7bd2d..6788d8b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -16,9 +16,9 @@ GEM uri (>= 0.13.1) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) - base64 (0.2.0) - benchmark (0.4.0) - bigdecimal (3.1.9) + base64 (0.3.0) + benchmark (0.4.1) + bigdecimal (3.2.2) coderay (1.1.3) coffee-script (2.4.1) coffee-script-source @@ -31,7 +31,7 @@ GEM csv (3.3.0) dnsruby (1.72.2) simpleidn (~> 0.2.1) - drb (2.2.1) + drb (2.2.3) em-websocket (0.5.3) eventmachine (>= 0.12.9) http_parser.rb (~> 0) @@ -48,7 +48,7 @@ GEM ffi (1.17.0-x86_64-darwin) forwardable-extended (2.6.0) gemoji (4.1.0) - git (3.1.0) + git (3.1.1) activesupport (>= 5.0) addressable (~> 2.8) process_executer (~> 1.3) From 6c9658488b1890d1c4c4823a570f58bb8013e817 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 3 Jul 2025 18:26:15 +0000 Subject: [PATCH 09/72] Bump git from 3.1.1 to 4.0.0 Bumps [git](https://github.com/ruby-git/ruby-git) from 3.1.1 to 4.0.0. - [Release notes](https://github.com/ruby-git/ruby-git/releases) - [Changelog](https://github.com/ruby-git/ruby-git/blob/main/CHANGELOG.md) - [Commits](https://github.com/ruby-git/ruby-git/compare/v3.1.1...v4.0.0) --- updated-dependencies: - dependency-name: git dependency-version: 4.0.0 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6788d8b..6275339 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -48,10 +48,10 @@ GEM ffi (1.17.0-x86_64-darwin) forwardable-extended (2.6.0) gemoji (4.1.0) - git (3.1.1) + git (4.0.0) activesupport (>= 5.0) addressable (~> 2.8) - process_executer (~> 1.3) + process_executer (~> 4.0) rchardet (~> 1.9) github-pages (232) github-pages-health-check (= 1.18.2) @@ -250,7 +250,8 @@ GEM sawyer (~> 0.9) pathutil (0.16.2) forwardable-extended (~> 2.6) - process_executer (1.3.0) + process_executer (4.0.0) + track_open_instances (~> 0.1) public_suffix (5.1.1) racc (1.8.1) rb-fsevent (0.11.2) @@ -273,6 +274,7 @@ GEM simpleidn (0.2.3) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) + track_open_instances (0.1.15) typhoeus (1.4.1) ethon (>= 0.9.0) tzinfo (2.0.6) From f95bddfe47aa4ca9a1450ce64b938de85490185c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Jul 2025 21:13:57 +0000 Subject: [PATCH 10/72] Bump git from 4.0.0 to 4.0.1 Bumps [git](https://github.com/ruby-git/ruby-git) from 4.0.0 to 4.0.1. - [Release notes](https://github.com/ruby-git/ruby-git/releases) - [Changelog](https://github.com/ruby-git/ruby-git/blob/main/CHANGELOG.md) - [Commits](https://github.com/ruby-git/ruby-git/compare/v4.0.0...v4.0.1) --- updated-dependencies: - dependency-name: git dependency-version: 4.0.1 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6275339..1d83a43 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -48,7 +48,7 @@ GEM ffi (1.17.0-x86_64-darwin) forwardable-extended (2.6.0) gemoji (4.1.0) - git (4.0.0) + git (4.0.1) activesupport (>= 5.0) addressable (~> 2.8) process_executer (~> 4.0) From 391521bddd0fcb56feefc2bfb8e12e99dcf125e6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Jul 2025 18:21:08 +0000 Subject: [PATCH 11/72] Bump git from 4.0.1 to 4.0.2 Bumps [git](https://github.com/ruby-git/ruby-git) from 4.0.1 to 4.0.2. - [Release notes](https://github.com/ruby-git/ruby-git/releases) - [Changelog](https://github.com/ruby-git/ruby-git/blob/main/CHANGELOG.md) - [Commits](https://github.com/ruby-git/ruby-git/compare/v4.0.1...v4.0.2) --- updated-dependencies: - dependency-name: git dependency-version: 4.0.2 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1d83a43..fe40cd7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -48,7 +48,7 @@ GEM ffi (1.17.0-x86_64-darwin) forwardable-extended (2.6.0) gemoji (4.1.0) - git (4.0.1) + git (4.0.2) activesupport (>= 5.0) addressable (~> 2.8) process_executer (~> 4.0) From 8059d00c555d6d80116745a8879252d7c182e8b1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Jul 2025 18:43:01 +0000 Subject: [PATCH 12/72] Bump git from 4.0.2 to 4.0.4 Bumps [git](https://github.com/ruby-git/ruby-git) from 4.0.2 to 4.0.4. - [Release notes](https://github.com/ruby-git/ruby-git/releases) - [Changelog](https://github.com/ruby-git/ruby-git/blob/main/CHANGELOG.md) - [Commits](https://github.com/ruby-git/ruby-git/compare/v4.0.2...v4.0.4) --- updated-dependencies: - dependency-name: git dependency-version: 4.0.4 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index fe40cd7..e90ed09 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -48,7 +48,7 @@ GEM ffi (1.17.0-x86_64-darwin) forwardable-extended (2.6.0) gemoji (4.1.0) - git (4.0.2) + git (4.0.4) activesupport (>= 5.0) addressable (~> 2.8) process_executer (~> 4.0) From be06fa77fa5d44bf8b20644b64f7bc1534f81f28 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 22 Aug 2025 18:02:07 +0000 Subject: [PATCH 13/72] Bump git from 4.0.4 to 4.0.5 Bumps [git](https://github.com/ruby-git/ruby-git) from 4.0.4 to 4.0.5. - [Release notes](https://github.com/ruby-git/ruby-git/releases) - [Changelog](https://github.com/ruby-git/ruby-git/blob/main/CHANGELOG.md) - [Commits](https://github.com/ruby-git/ruby-git/compare/v4.0.4...v4.0.5) --- updated-dependencies: - dependency-name: git dependency-version: 4.0.5 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e90ed09..c65b60e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ GEM remote: https://rubygems.org/ specs: - activesupport (8.0.2) + activesupport (8.0.2.1) base64 benchmark (>= 0.3) bigdecimal @@ -48,7 +48,7 @@ GEM ffi (1.17.0-x86_64-darwin) forwardable-extended (2.6.0) gemoji (4.1.0) - git (4.0.4) + git (4.0.5) activesupport (>= 5.0) addressable (~> 2.8) process_executer (~> 4.0) From bf9e8017fff2159890bd7bb2f487d5ec045f33a4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 23 Aug 2025 01:45:37 +0000 Subject: [PATCH 14/72] Bump nokogiri from 1.18.8 to 1.18.9 Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.18.8 to 1.18.9. - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.18.8...v1.18.9) --- updated-dependencies: - dependency-name: nokogiri dependency-version: 1.18.9 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index c65b60e..dab69e8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -232,7 +232,7 @@ GEM logger (1.7.0) mercenary (0.3.6) mgem (0.3.0) - mini_portile2 (2.8.8) + mini_portile2 (2.8.9) minima (2.5.1) jekyll (>= 3.5, < 5.0) jekyll-feed (~> 0.9) @@ -240,10 +240,10 @@ GEM minitest (5.25.5) net-http (0.4.1) uri - nokogiri (1.18.8) + nokogiri (1.18.9) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.18.8-x86_64-darwin) + nokogiri (1.18.9-x86_64-darwin) racc (~> 1.4) octokit (4.25.1) faraday (>= 1, < 3) From 7577ab943818ae7f32efbb9e7cc1303a7d437ccc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Sep 2025 18:41:21 +0000 Subject: [PATCH 15/72] Bump rexml from 3.3.9 to 3.4.2 Bumps [rexml](https://github.com/ruby/rexml) from 3.3.9 to 3.4.2. - [Release notes](https://github.com/ruby/rexml/releases) - [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md) - [Commits](https://github.com/ruby/rexml/compare/v3.3.9...v3.4.2) --- updated-dependencies: - dependency-name: rexml dependency-version: 3.4.2 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index dab69e8..132b29d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -258,7 +258,7 @@ GEM rb-inotify (0.11.1) ffi (~> 1.0) rchardet (1.9.0) - rexml (3.3.9) + rexml (3.4.2) rouge (3.30.0) rubyzip (2.3.2) safe_yaml (1.0.5) From 534c42422ffeead09890c0fa39348cc37c5f6abc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Nov 2025 18:00:54 +0000 Subject: [PATCH 16/72] Bump git from 4.0.5 to 4.0.6 Bumps [git](https://github.com/ruby-git/ruby-git) from 4.0.5 to 4.0.6. - [Release notes](https://github.com/ruby-git/ruby-git/releases) - [Changelog](https://github.com/ruby-git/ruby-git/blob/main/CHANGELOG.md) - [Commits](https://github.com/ruby-git/ruby-git/compare/v4.0.5...v4.0.6) --- updated-dependencies: - dependency-name: git dependency-version: 4.0.6 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 132b29d..2fe930b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,14 +1,14 @@ GEM remote: https://rubygems.org/ specs: - activesupport (8.0.2.1) + activesupport (8.1.1) base64 - benchmark (>= 0.3) bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) + json logger (>= 1.4.2) minitest (>= 5.1) securerandom (>= 0.3) @@ -17,8 +17,7 @@ GEM addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) base64 (0.3.0) - benchmark (0.4.1) - bigdecimal (3.2.2) + bigdecimal (3.3.1) coderay (1.1.3) coffee-script (2.4.1) coffee-script-source @@ -27,7 +26,7 @@ GEM colorator (1.1.0) commonmarker (0.23.10) concurrent-ruby (1.3.5) - connection_pool (2.5.3) + connection_pool (2.5.4) csv (3.3.0) dnsruby (1.72.2) simpleidn (~> 0.2.1) @@ -48,7 +47,7 @@ GEM ffi (1.17.0-x86_64-darwin) forwardable-extended (2.6.0) gemoji (4.1.0) - git (4.0.5) + git (4.0.6) activesupport (>= 5.0) addressable (~> 2.8) process_executer (~> 4.0) @@ -221,6 +220,7 @@ GEM gemoji (>= 3, < 5) html-pipeline (~> 2.2) jekyll (>= 3.0, < 5.0) + json (2.16.0) kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) @@ -237,7 +237,7 @@ GEM jekyll (>= 3.5, < 5.0) jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) - minitest (5.25.5) + minitest (5.26.1) net-http (0.4.1) uri nokogiri (1.18.9) @@ -257,7 +257,7 @@ GEM rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) - rchardet (1.9.0) + rchardet (1.10.0) rexml (3.4.2) rouge (3.30.0) rubyzip (2.3.2) @@ -280,7 +280,7 @@ GEM tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (1.8.0) - uri (1.0.3) + uri (1.1.1) webrick (1.8.2) yard (0.9.36) yard-coderay (0.1.0) From d754d1919ce8c9143207d6cadc702e87c6fd81a8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Dec 2025 18:00:51 +0000 Subject: [PATCH 17/72] Bump git from 4.0.6 to 4.0.7 Bumps [git](https://github.com/ruby-git/ruby-git) from 4.0.6 to 4.0.7. - [Release notes](https://github.com/ruby-git/ruby-git/releases) - [Changelog](https://github.com/ruby-git/ruby-git/blob/main/CHANGELOG.md) - [Commits](https://github.com/ruby-git/ruby-git/compare/v4.0.6...v4.0.7) --- updated-dependencies: - dependency-name: git dependency-version: 4.0.7 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2fe930b..7956ce1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -14,10 +14,10 @@ GEM securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) uri (>= 0.13.1) - addressable (2.8.7) - public_suffix (>= 2.0.2, < 7.0) + addressable (2.8.8) + public_suffix (>= 2.0.2, < 8.0) base64 (0.3.0) - bigdecimal (3.3.1) + bigdecimal (4.0.1) coderay (1.1.3) coffee-script (2.4.1) coffee-script-source @@ -25,8 +25,8 @@ GEM coffee-script-source (1.12.2) colorator (1.1.0) commonmarker (0.23.10) - concurrent-ruby (1.3.5) - connection_pool (2.5.4) + concurrent-ruby (1.3.6) + connection_pool (3.0.2) csv (3.3.0) dnsruby (1.72.2) simpleidn (~> 0.2.1) @@ -47,7 +47,7 @@ GEM ffi (1.17.0-x86_64-darwin) forwardable-extended (2.6.0) gemoji (4.1.0) - git (4.0.6) + git (4.0.7) activesupport (>= 5.0) addressable (~> 2.8) process_executer (~> 4.0) @@ -108,7 +108,7 @@ GEM activesupport (>= 2) nokogiri (>= 1.4) http_parser.rb (0.8.0) - i18n (1.14.7) + i18n (1.14.8) concurrent-ruby (~> 1.0) jekyll (3.10.0) addressable (~> 2.4) @@ -220,7 +220,7 @@ GEM gemoji (>= 3, < 5) html-pipeline (~> 2.2) jekyll (>= 3.0, < 5.0) - json (2.16.0) + json (2.18.0) kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) @@ -237,7 +237,8 @@ GEM jekyll (>= 3.5, < 5.0) jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) - minitest (5.26.1) + minitest (6.0.1) + prism (~> 1.5) net-http (0.4.1) uri nokogiri (1.18.9) @@ -250,7 +251,8 @@ GEM sawyer (~> 0.9) pathutil (0.16.2) forwardable-extended (~> 2.6) - process_executer (4.0.0) + prism (1.7.0) + process_executer (4.0.1) track_open_instances (~> 0.1) public_suffix (5.1.1) racc (1.8.1) From b07e06a6311a48c9b38fef514e5b481d99a3b55a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Jan 2026 18:00:54 +0000 Subject: [PATCH 18/72] Bump git from 4.0.7 to 4.1.0 Bumps [git](https://github.com/ruby-git/ruby-git) from 4.0.7 to 4.1.0. - [Release notes](https://github.com/ruby-git/ruby-git/releases) - [Changelog](https://github.com/ruby-git/ruby-git/blob/main/CHANGELOG.md) - [Commits](https://github.com/ruby-git/ruby-git/compare/v4.0.7...v4.1.0) --- updated-dependencies: - dependency-name: git dependency-version: 4.1.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7956ce1..c9f44fa 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -47,7 +47,7 @@ GEM ffi (1.17.0-x86_64-darwin) forwardable-extended (2.6.0) gemoji (4.1.0) - git (4.0.7) + git (4.1.0) activesupport (>= 5.0) addressable (~> 2.8) process_executer (~> 4.0) @@ -252,7 +252,7 @@ GEM pathutil (0.16.2) forwardable-extended (~> 2.6) prism (1.7.0) - process_executer (4.0.1) + process_executer (4.0.2) track_open_instances (~> 0.1) public_suffix (5.1.1) racc (1.8.1) From 4a0b5ea32726126bc216c81b1f21fb57a8536460 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 9 Jan 2026 18:40:54 +0000 Subject: [PATCH 19/72] Bump git from 4.1.0 to 4.1.1 Bumps [git](https://github.com/ruby-git/ruby-git) from 4.1.0 to 4.1.1. - [Release notes](https://github.com/ruby-git/ruby-git/releases) - [Changelog](https://github.com/ruby-git/ruby-git/blob/main/CHANGELOG.md) - [Commits](https://github.com/ruby-git/ruby-git/compare/v4.1.0...v4.1.1) --- updated-dependencies: - dependency-name: git dependency-version: 4.1.1 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index c9f44fa..35952c2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ GEM remote: https://rubygems.org/ specs: - activesupport (8.1.1) + activesupport (8.1.2) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) @@ -47,7 +47,7 @@ GEM ffi (1.17.0-x86_64-darwin) forwardable-extended (2.6.0) gemoji (4.1.0) - git (4.1.0) + git (4.1.1) activesupport (>= 5.0) addressable (~> 2.8) process_executer (~> 4.0) From 1ab70f63f20f5c8bd1bbf4a28f87291ebe737ea6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Jan 2026 22:59:09 +0000 Subject: [PATCH 20/72] Bump git from 4.1.1 to 4.2.0 Bumps [git](https://github.com/ruby-git/ruby-git) from 4.1.1 to 4.2.0. - [Release notes](https://github.com/ruby-git/ruby-git/releases) - [Changelog](https://github.com/ruby-git/ruby-git/blob/v4.2.0/CHANGELOG.md) - [Commits](https://github.com/ruby-git/ruby-git/compare/v4.1.1...v4.2.0) --- updated-dependencies: - dependency-name: git dependency-version: 4.2.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 35952c2..610b373 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -47,7 +47,7 @@ GEM ffi (1.17.0-x86_64-darwin) forwardable-extended (2.6.0) gemoji (4.1.0) - git (4.1.1) + git (4.2.0) activesupport (>= 5.0) addressable (~> 2.8) process_executer (~> 4.0) From 7bf946d2eca3b25b81fac9264e45abd20a66dac9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 15 Jan 2026 18:42:19 +0000 Subject: [PATCH 21/72] Bump git from 4.2.0 to 4.3.0 Bumps [git](https://github.com/ruby-git/ruby-git) from 4.2.0 to 4.3.0. - [Release notes](https://github.com/ruby-git/ruby-git/releases) - [Changelog](https://github.com/ruby-git/ruby-git/blob/v4.3.0/CHANGELOG.md) - [Commits](https://github.com/ruby-git/ruby-git/compare/v4.2.0...v4.3.0) --- updated-dependencies: - dependency-name: git dependency-version: 4.3.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 610b373..96dbae0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -47,7 +47,7 @@ GEM ffi (1.17.0-x86_64-darwin) forwardable-extended (2.6.0) gemoji (4.1.0) - git (4.2.0) + git (4.3.0) activesupport (>= 5.0) addressable (~> 2.8) process_executer (~> 4.0) @@ -251,7 +251,7 @@ GEM sawyer (~> 0.9) pathutil (0.16.2) forwardable-extended (~> 2.6) - prism (1.7.0) + prism (1.8.0) process_executer (4.0.2) track_open_instances (~> 0.1) public_suffix (5.1.1) From 6f5e32abd37ed26126c5d39d8c4f314f6c80b401 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Feb 2026 22:08:45 +0000 Subject: [PATCH 22/72] Bump faraday from 2.10.1 to 2.14.1 Bumps [faraday](https://github.com/lostisland/faraday) from 2.10.1 to 2.14.1. - [Release notes](https://github.com/lostisland/faraday/releases) - [Changelog](https://github.com/lostisland/faraday/blob/main/CHANGELOG.md) - [Commits](https://github.com/lostisland/faraday/compare/v2.10.1...v2.14.1) --- updated-dependencies: - dependency-name: faraday dependency-version: 2.14.1 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 96dbae0..ce4566c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -38,11 +38,12 @@ GEM ffi (>= 1.15.0) eventmachine (1.2.7) execjs (2.9.1) - faraday (2.10.1) - faraday-net_http (>= 2.0, < 3.2) + faraday (2.14.1) + faraday-net_http (>= 2.0, < 3.5) + json logger - faraday-net_http (3.1.1) - net-http + faraday-net_http (3.4.2) + net-http (~> 0.5) ffi (1.17.0) ffi (1.17.0-x86_64-darwin) forwardable-extended (2.6.0) @@ -239,8 +240,8 @@ GEM jekyll-seo-tag (~> 2.1) minitest (6.0.1) prism (~> 1.5) - net-http (0.4.1) - uri + net-http (0.9.1) + uri (>= 0.11.1) nokogiri (1.18.9) mini_portile2 (~> 2.8.2) racc (~> 1.4) From f2229f33cffa63d31136bea2a8427be4be100ab3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 20 Feb 2026 00:55:04 +0000 Subject: [PATCH 23/72] Bump nokogiri from 1.18.9 to 1.19.1 Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.18.9 to 1.19.1. - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.18.9...v1.19.1) --- updated-dependencies: - dependency-name: nokogiri dependency-version: 1.19.1 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ce4566c..4712021 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -242,10 +242,10 @@ GEM prism (~> 1.5) net-http (0.9.1) uri (>= 0.11.1) - nokogiri (1.18.9) + nokogiri (1.19.1) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.18.9-x86_64-darwin) + nokogiri (1.19.1-x86_64-darwin) racc (~> 1.4) octokit (4.25.1) faraday (>= 1, < 3) From 0b9960feb6c0f17e8aad1895e728a512c0d2ebd5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 20 Feb 2026 18:42:27 +0000 Subject: [PATCH 24/72] Bump git from 4.3.0 to 4.3.1 Bumps [git](https://github.com/ruby-git/ruby-git) from 4.3.0 to 4.3.1. - [Release notes](https://github.com/ruby-git/ruby-git/releases) - [Changelog](https://github.com/ruby-git/ruby-git/blob/v4.3.1/CHANGELOG.md) - [Commits](https://github.com/ruby-git/ruby-git/compare/v4.3.0...v4.3.1) --- updated-dependencies: - dependency-name: git dependency-version: 4.3.1 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4712021..45b12cc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -48,7 +48,7 @@ GEM ffi (1.17.0-x86_64-darwin) forwardable-extended (2.6.0) gemoji (4.1.0) - git (4.3.0) + git (4.3.1) activesupport (>= 5.0) addressable (~> 2.8) process_executer (~> 4.0) @@ -221,7 +221,7 @@ GEM gemoji (>= 3, < 5) html-pipeline (~> 2.2) jekyll (>= 3.0, < 5.0) - json (2.18.0) + json (2.18.1) kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) @@ -252,7 +252,7 @@ GEM sawyer (~> 0.9) pathutil (0.16.2) forwardable-extended (~> 2.6) - prism (1.8.0) + prism (1.9.0) process_executer (4.0.2) track_open_instances (~> 0.1) public_suffix (5.1.1) From 927f86a0f1e0c04dca968c4f62592d74a87a6f14 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Mar 2026 12:54:45 +0000 Subject: [PATCH 25/72] Bump json from 2.18.1 to 2.19.2 Bumps [json](https://github.com/ruby/json) from 2.18.1 to 2.19.2. - [Release notes](https://github.com/ruby/json/releases) - [Changelog](https://github.com/ruby/json/blob/master/CHANGES.md) - [Commits](https://github.com/ruby/json/compare/v2.18.1...v2.19.2) --- updated-dependencies: - dependency-name: json dependency-version: 2.19.2 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 45b12cc..4f5c2bd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -221,7 +221,7 @@ GEM gemoji (>= 3, < 5) html-pipeline (~> 2.2) jekyll (>= 3.0, < 5.0) - json (2.18.1) + json (2.19.2) kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) From c4ddd3345a38acd4bbb03801234b726ef1a178e7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Mar 2026 20:58:42 +0000 Subject: [PATCH 26/72] Bump activesupport from 8.1.2 to 8.1.2.1 Bumps [activesupport](https://github.com/rails/rails) from 8.1.2 to 8.1.2.1. - [Release notes](https://github.com/rails/rails/releases) - [Changelog](https://github.com/rails/rails/blob/v8.1.2.1/activesupport/CHANGELOG.md) - [Commits](https://github.com/rails/rails/compare/v8.1.2...v8.1.2.1) --- updated-dependencies: - dependency-name: activesupport dependency-version: 8.1.2.1 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4f5c2bd..6b39c1a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ GEM remote: https://rubygems.org/ specs: - activesupport (8.1.2) + activesupport (8.1.2.1) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) @@ -238,7 +238,8 @@ GEM jekyll (>= 3.5, < 5.0) jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) - minitest (6.0.1) + minitest (6.0.2) + drb (~> 2.0) prism (~> 1.5) net-http (0.9.1) uri (>= 0.11.1) From 76e839318bfcd5c222e4bed4f61130e630044fe8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 31 Mar 2026 18:42:22 +0000 Subject: [PATCH 27/72] Bump git from 4.3.1 to 4.3.2 Bumps [git](https://github.com/ruby-git/ruby-git) from 4.3.1 to 4.3.2. - [Release notes](https://github.com/ruby-git/ruby-git/releases) - [Changelog](https://github.com/ruby-git/ruby-git/blob/v4.3.2/CHANGELOG.md) - [Commits](https://github.com/ruby-git/ruby-git/compare/v4.3.1...v4.3.2) --- updated-dependencies: - dependency-name: git dependency-version: 4.3.2 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6b39c1a..714544e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ GEM remote: https://rubygems.org/ specs: - activesupport (8.1.2.1) + activesupport (8.1.3) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) @@ -14,10 +14,10 @@ GEM securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) uri (>= 0.13.1) - addressable (2.8.8) + addressable (2.8.9) public_suffix (>= 2.0.2, < 8.0) base64 (0.3.0) - bigdecimal (4.0.1) + bigdecimal (4.1.0) coderay (1.1.3) coffee-script (2.4.1) coffee-script-source @@ -48,7 +48,7 @@ GEM ffi (1.17.0-x86_64-darwin) forwardable-extended (2.6.0) gemoji (4.1.0) - git (4.3.1) + git (4.3.2) activesupport (>= 5.0) addressable (~> 2.8) process_executer (~> 4.0) @@ -221,7 +221,7 @@ GEM gemoji (>= 3, < 5) html-pipeline (~> 2.2) jekyll (>= 3.0, < 5.0) - json (2.19.2) + json (2.19.3) kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) From ea28cbe88e9c74b5bde12ec3da100a17a64dd910 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Apr 2026 08:56:36 +0000 Subject: [PATCH 28/72] Bump addressable from 2.8.9 to 2.9.0 Bumps [addressable](https://github.com/sporkmonger/addressable) from 2.8.9 to 2.9.0. - [Changelog](https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md) - [Commits](https://github.com/sporkmonger/addressable/compare/addressable-2.8.9...addressable-2.9.0) --- updated-dependencies: - dependency-name: addressable dependency-version: 2.9.0 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 714544e..6848599 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -14,7 +14,7 @@ GEM securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) uri (>= 0.13.1) - addressable (2.8.9) + addressable (2.9.0) public_suffix (>= 2.0.2, < 8.0) base64 (0.3.0) bigdecimal (4.1.0) From d4f4864c709e540bffe259c0464aaa1cc31a6491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20=C5=A0im=C3=A1nek?= Date: Fri, 10 Apr 2026 23:48:53 +0200 Subject: [PATCH 29/72] Update API docs for 3.4.0. --- docs/api/Addrinfo.html | 572 +- docs/api/ArgumentError.html | 59 +- docs/api/Array.html | 7913 ++------- docs/api/BasicObject.html | 186 + docs/api/BasicSocket.html | 1726 +- docs/api/CMath.html | 928 ++ docs/api/Comparable.html | 321 +- docs/api/Complex.html | 480 +- docs/api/Dir.html | 633 + docs/api/EOFError.html | 46 +- docs/api/Enumerable.html | 1927 ++- docs/api/Enumerator.html | 1073 +- docs/api/Enumerator/Chain.html | 47 +- docs/api/Enumerator/Generator.html | 64 +- docs/api/Enumerator/Lazy.html | 388 +- docs/api/Enumerator/Yielder.html | 73 +- docs/api/Errno.html | 321 + docs/api/Exception.html | 671 +- docs/api/FalseClass.html | 721 - docs/api/Fiber.html | 813 - docs/api/File.html | 785 +- docs/api/File/Constants.html | 89 +- docs/api/Fixnum.html | 1825 --- docs/api/Float.html | 2805 +--- docs/api/FloatDomainError.html | 46 +- docs/api/FrozenError.html | 20 +- docs/api/GC.html | 109 - docs/api/Hash.html | 5588 ++----- docs/api/IO.html | 3477 +--- docs/api/IOError.html | 57 +- docs/api/IPSocket.html | 150 +- docs/api/IndexError.html | 55 +- docs/api/Integer.html | 706 +- docs/api/Integral.html | 1592 -- docs/api/Kernel.html | 7102 +------- docs/api/KeyError.html | 46 +- docs/api/LocalJumpError.html | 55 +- docs/api/Math.html | 1085 +- docs/api/Method.html | 1410 +- docs/api/Module.html | 224 +- docs/api/NameError.html | 89 +- docs/api/NilClass.html | 1163 -- docs/api/NoMemoryError.html | 144 - docs/api/NoMethodError.html | 87 +- docs/api/NotImplementedError.html | 48 +- docs/api/Numeric.html | 276 +- docs/api/ObjectSpace.html | 20 +- docs/api/Proc.html | 60 +- docs/api/Random.html | 381 - docs/api/Range.html | 584 +- docs/api/RangeError.html | 55 +- docs/api/Rational.html | 398 +- docs/api/RegexpError.html | 55 +- docs/api/ScriptError.html | 160 - docs/api/Set.html | 3239 ++++ docs/api/Socket.html | 249 +- docs/api/Socket/Option.html | 957 -- docs/api/SocketError.html | 48 +- docs/api/StandardError.html | 160 - docs/api/StopIteration.html | 64 +- docs/api/String.html | 12070 ++------------ docs/api/Struct.html | 2167 +-- docs/api/Symbol.html | 723 +- docs/api/SystemStackError.html | 156 - docs/api/TCPServer.html | 94 +- docs/api/TCPSocket.html | 75 +- docs/api/Time.html | 3480 ---- docs/api/TrueClass.html | 585 - docs/api/TypeError.html | 55 +- docs/api/UDPSocket.html | 91 +- docs/api/UNIXServer.html | 82 +- docs/api/UNIXSocket.html | 94 +- docs/api/UnboundMethod.html | 1329 -- docs/api/UncaughtThrowError.html | 382 + .../{FileTest.html => ZeroDivisionError.html} | 52 +- docs/api/_index.html | 208 +- docs/api/class_list.html | 13 +- docs/api/css/full_list.css | 6 +- docs/api/css/style.css | 11 +- docs/api/file.AUTHORS.html | 80 +- docs/api/file.CONTRIBUTING.html | 218 +- docs/api/file.LEGAL.html | 116 + docs/api/file.LICENSE.html | 47 +- docs/api/file.NEWS.html | 558 + docs/api/file.README.html | 163 +- docs/api/file.SECURITY.html | 100 + docs/api/file.TODO.html | 94 + docs/api/file.boxing.html | 193 + docs/api/file.compile.html | 914 +- docs/api/file.debugger.html | 420 +- docs/api/file.gc-arena-howto.html | 236 +- docs/api/file.hier.html | 134 + docs/api/file.limitations.html | 233 + docs/api/file.link.html | 152 + docs/api/file.memory.html | 99 + docs/api/file.mrbconf.html | 525 +- docs/api/file.mrbgems.html | 660 +- docs/api/file.mruby3.0.html | 282 + docs/api/file.mruby3.1.html | 407 + docs/api/file.mruby3.2.html | 185 + docs/api/file.mruby3.3.html | 385 + docs/api/file.mruby3.4.html | 556 + docs/api/file.opcode.html | 746 + docs/api/file.symbol.html | 149 + docs/api/file_list.html | 111 +- docs/api/frames.html | 17 +- docs/api/function_list.html | 5215 +++--- docs/api/header_list.html | 500 +- docs/api/headers.html | 166 +- docs/api/headers/mrbconf.h.html | 239 +- docs/api/headers/mruby.h.html | 13426 +++++++++------- docs/api/headers/mruby_2Farray.h.html | 1741 +- docs/api/headers/mruby_2Fboxing_nan.h.html | 185 +- docs/api/headers/mruby_2Fboxing_no.h.html | 296 +- docs/api/headers/mruby_2Fboxing_word.h.html | 436 +- docs/api/headers/mruby_2Fclass.h.html | 673 +- docs/api/headers/mruby_2Fcommon.h.html | 247 +- docs/api/headers/mruby_2Fcompile.h.html | 1278 +- docs/api/headers/mruby_2Fdata.h.html | 479 +- docs/api/headers/mruby_2Fdebug.h.html | 375 +- docs/api/headers/mruby_2Fdump.h.html | 612 +- docs/api/headers/mruby_2Fendian.h.html | 130 + docs/api/headers/mruby_2Ferror.h.html | 837 +- docs/api/headers/mruby_2Fext_2Fio.h.html | 60 +- docs/api/headers/mruby_2Fgc.h.html | 232 +- docs/api/headers/mruby_2Fhash.h.html | 1356 +- docs/api/headers/mruby_2Finternal.h.html | 106 + docs/api/headers/mruby_2Firep.h.html | 440 +- docs/api/headers/mruby_2Fistruct.h.html | 280 +- docs/api/headers/mruby_2Fkhash.h.html | 492 +- docs/api/headers/mruby_2Fmempool.h.html | 253 + docs/api/headers/mruby_2Fnumeric.h.html | 761 +- docs/api/headers/mruby_2Fobject.h.html | 150 +- docs/api/headers/mruby_2Fopcode.h.html | 506 +- .../mruby_2Fpresym.h.html} | 76 +- .../headers/mruby_2Fpresym_2Fdisable.h.html | 251 + .../headers/mruby_2Fpresym_2Fenable.h.html | 186 + .../headers/mruby_2Fpresym_2Fscanning.h.html | 186 + docs/api/headers/mruby_2Fproc.h.html | 935 +- docs/api/headers/mruby_2Frange.h.html | 371 +- docs/api/headers/mruby_2Fre.h.html | 70 +- docs/api/headers/mruby_2Fstring.h.html | 2448 ++- docs/api/headers/mruby_2Fthrow.h.html | 130 +- docs/api/headers/mruby_2Ftime.h.html | 133 +- docs/api/headers/mruby_2Fvalue.h.html | 1727 +- docs/api/headers/mruby_2Fvariable.h.html | 1414 +- docs/api/headers/mruby_2Fversion.h.html | 402 +- docs/api/index.html | 163 +- docs/api/js/app.js | 549 +- docs/api/js/full_list.js | 34 +- docs/api/method_list.html | 4793 ++---- docs/api/top-level-namespace.html | 245 +- 152 files changed, 44973 insertions(+), 84489 deletions(-) create mode 100644 docs/api/BasicObject.html create mode 100644 docs/api/CMath.html create mode 100644 docs/api/Dir.html create mode 100644 docs/api/Errno.html delete mode 100644 docs/api/FalseClass.html delete mode 100644 docs/api/Fiber.html delete mode 100644 docs/api/Fixnum.html delete mode 100644 docs/api/GC.html delete mode 100644 docs/api/Integral.html delete mode 100644 docs/api/NilClass.html delete mode 100644 docs/api/NoMemoryError.html delete mode 100644 docs/api/Random.html delete mode 100644 docs/api/ScriptError.html create mode 100644 docs/api/Set.html delete mode 100644 docs/api/Socket/Option.html delete mode 100644 docs/api/StandardError.html delete mode 100644 docs/api/SystemStackError.html delete mode 100644 docs/api/Time.html delete mode 100644 docs/api/TrueClass.html delete mode 100644 docs/api/UnboundMethod.html create mode 100644 docs/api/UncaughtThrowError.html rename docs/api/{FileTest.html => ZeroDivisionError.html} (62%) create mode 100644 docs/api/file.LEGAL.html create mode 100644 docs/api/file.NEWS.html create mode 100644 docs/api/file.SECURITY.html create mode 100644 docs/api/file.TODO.html create mode 100644 docs/api/file.boxing.html create mode 100644 docs/api/file.hier.html create mode 100644 docs/api/file.limitations.html create mode 100644 docs/api/file.link.html create mode 100644 docs/api/file.memory.html create mode 100644 docs/api/file.mruby3.0.html create mode 100644 docs/api/file.mruby3.1.html create mode 100644 docs/api/file.mruby3.2.html create mode 100644 docs/api/file.mruby3.3.html create mode 100644 docs/api/file.mruby3.4.html create mode 100644 docs/api/file.opcode.html create mode 100644 docs/api/file.symbol.html create mode 100644 docs/api/headers/mruby_2Fendian.h.html create mode 100644 docs/api/headers/mruby_2Finternal.h.html create mode 100644 docs/api/headers/mruby_2Fmempool.h.html rename docs/api/{Socket/Constants.html => headers/mruby_2Fpresym.h.html} (62%) create mode 100644 docs/api/headers/mruby_2Fpresym_2Fdisable.h.html create mode 100644 docs/api/headers/mruby_2Fpresym_2Fenable.h.html create mode 100644 docs/api/headers/mruby_2Fpresym_2Fscanning.h.html diff --git a/docs/api/Addrinfo.html b/docs/api/Addrinfo.html index ddd5386..c1b3f7a 100644 --- a/docs/api/Addrinfo.html +++ b/docs/api/Addrinfo.html @@ -6,17 +6,17 @@ Class: Addrinfo - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -98,9 +98,7 @@
Defined in:
-
mrbgems/mruby-socket/src/socket.c,
- mrbgems/mruby-socket/mrblib/socket.rb
-
+
mrbgems/mruby-socket/mrblib/socket.rb
@@ -112,34 +110,6 @@

Instance Attribute Summary collapse

    -
  • - - - #canonname ⇒ Object - - - - - - - - - readonly - - - - - - - - - -

    def bind.

    -
    - -
  • - -
  • @@ -162,7 +132,8 @@

    Instance Attribute Summary collaps -

    Returns the value of attribute protocol.

    +
    +

    Returns the value of attribute protocol.

  • @@ -190,7 +161,8 @@

    Instance Attribute Summary collaps -

    Returns the value of attribute socktype.

    +
    +

    Returns the value of attribute socktype.

    @@ -226,8 +198,7 @@

    -
    -
    +
    @@ -249,8 +220,7 @@

    -
    -
    +
    @@ -272,8 +242,7 @@

    -
    -
    +
    @@ -295,8 +264,7 @@

    -
    -
    +
    @@ -318,8 +286,7 @@

    -
    -
    +
    @@ -350,8 +317,7 @@

    -
    -
    +
    @@ -373,31 +339,7 @@

    -
    -
    - - - - -
  • - - - #getnameinfo ⇒ Object - - - - - - - - - - - - - -
    -
    +
  • @@ -421,7 +363,8 @@

    -

    A new instance of Addrinfo.

    +
    +

    A new instance of Addrinfo.

    @@ -444,7 +387,8 @@

    -

    def family_addrinfo(host, port=nil) def getnameinfo(flags=0) Socket.getnameinfo end.

    +
    +

    def family_addrinfo(host, port=nil) def getnameinfo(flags=0) Socket.getnameinfo end.

    @@ -467,8 +411,7 @@

    -
    -
    +
    @@ -490,8 +433,7 @@

    -
    -
    +
    @@ -513,8 +455,7 @@

    -
    -
    +
    @@ -536,8 +477,7 @@

    -
    -
    +
    @@ -559,8 +499,7 @@

    -
    -
    +
    @@ -582,8 +521,7 @@

    -
    -
    +
    @@ -605,7 +543,8 @@

    -

    def ipv4_loopback? def ipv4_multicast? def ipv4_private?.

    +
    +

    def ipv4_loopback? def ipv4_multicast? def ipv4_private?.

    @@ -628,7 +567,8 @@

    -

    def ipv6_loopback? def ipv6_mc_global? def ipv6_mc_linklocal? def ipv6_mc_nodelocal? def ipv6_mc_orilocal? def ipv6_mc_sitelocal? def ipv6_multicast? def ipv6_to_ipv4 def ipv6_unspecified def ipv6_v4compat? def ipv6_v4mapped? def listen(backlog=5).

    +
    +

    def ipv6_loopback? def ipv6_mc_global? def ipv6_mc_linklocal? def ipv6_mc_nodelocal? def ipv6_mc_orilocal? def ipv6_mc_sitelocal? def ipv6_multicast? def ipv6_to_ipv4 def ipv6_unspecified def ipv6_v4compat? def ipv6_v4mapped? def listen(backlog=5).

    @@ -653,8 +593,7 @@

    -
    -
    +
    @@ -676,31 +615,7 @@

    -
    -
    - - - - -
  • - - - #unix_path ⇒ Object - - - - - - - - - - - - - -
    -
    +
  • @@ -722,7 +637,8 @@

    -

    Returns a new instance of Addrinfo

    + +

    Returns a new instance of Addrinfo.

    @@ -730,8 +646,8 @@

    -
    - +

    + @@ -799,9 +713,9 @@

    Instance Attribute Details

    -

    +

    - #canonnameObject (readonly) + #protocolObject (readonly) @@ -809,7 +723,8 @@

    -

    def bind

    + +

    Returns the value of attribute protocol.

    @@ -817,64 +732,20 @@

    -
    - -

    @@ -758,8 +674,7 @@

    19 20 21 -22 -23 +22

    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 2
    @@ -784,7 +699,6 @@ 

    end @socktype = socktype @protocol = protocol - @canonname = nil end

    - - - - -
    -
    -
    -
    -53
    -54
    -55
    -
    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 53
    -
    -def canonname
    -  @canonname
    -end
    -
    -
    - - - -
    -

    - - #protocolObject (readonly) - - - - - -

    -
    -

    Returns the value of attribute protocol

    - - -
    -
    - -
    -
     
     
    -139
    -140
    -141
    +136 +137 +138
    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 139
    +      
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 136
     
     def protocol
       @protocol
    @@ -897,7 +768,8 @@ 

    -

    Returns the value of attribute socktype

    + +

    Returns the value of attribute socktype.

    @@ -905,20 +777,20 @@

    -
    - +

    +
     
     
    -140
    -141
    -142
    +137 +138 +139
    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 140
    +      
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 137
     
     def socktype
       @socktype
    @@ -950,14 +822,14 @@ 

     
     
    +24
     25
     26
     27
    -28
    -29
    +28

    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 25
    +      
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 24
     
     def self.foreach(nodename, service, family=nil, socktype=nil, protocol=nil, flags=0, &block)
       a = self.getaddrinfo(nodename, service, family, socktype, protocol, flags)
    @@ -984,12 +856,12 @@ 

     
     
    +30
     31
    -32
    -33
    +32

    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 31
    +      
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 30
     
     def self.ip(host)
       Addrinfo.new(Socket.sockaddr_in(0, host))
    @@ -1014,12 +886,12 @@ 

     
     
    +34
     35
    -36
    -37
    +36

    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 35
    +      
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 34
     
     def self.tcp(host, port)
       Addrinfo.getaddrinfo(host, port, nil, Socket::SOCK_STREAM, Socket::IPPROTO_TCP)[0]
    @@ -1044,12 +916,12 @@ 

     
     
    +38
     39
    -40
    -41
    +40

    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 39
    +      
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 38
     
     def self.udp(host, port)
       Addrinfo.getaddrinfo(host, port, nil, Socket::SOCK_DGRAM, Socket::IPPROTO_UDP)[0]
    @@ -1074,12 +946,12 @@ 

     
     
    +42
     43
    -44
    -45
    +44

    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 43
    +      
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 42
     
     def self.unix(path, socktype=Socket::SOCK_STREAM)
       Addrinfo.new(Socket.sockaddr_un(path), Socket::AF_UNIX, socktype)
    @@ -1110,6 +982,9 @@ 

     
     
    +139
    +140
    +141
     142
     143
     144
    @@ -1120,13 +995,10 @@ 

    149 150 151 -152 -153 -154 -155

    +152

    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 142
    +      
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 139
     
     def _to_array
       case @family
    @@ -1162,12 +1034,12 @@ 

     
     
    +46
     47
    -48
    -49
    +48

    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 47
    +      
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 46
     
     def afamily
       @family
    @@ -1175,84 +1047,6 @@ 

    - - -
    -

    - - #getnameinfoObject - - - - - -

    - - - - -
    -
    -
    -
    -191
    -192
    -193
    -194
    -195
    -196
    -197
    -198
    -199
    -200
    -201
    -202
    -203
    -204
    -205
    -206
    -207
    -208
    -209
    -210
    -211
    -212
    -213
    -214
    -215
    -216
    -217
    -
    -
    # File 'mrbgems/mruby-socket/src/socket.c', line 191
    -
    -static mrb_value
    -mrb_addrinfo_getnameinfo(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_int flags;
    -  mrb_value ary, host, sastr, serv;
    -  int error;
    -
    -  flags = 0;
    -  mrb_get_args(mrb, "|i", &flags);
    -  host = mrb_str_buf_new(mrb, NI_MAXHOST);
    -  serv = mrb_str_buf_new(mrb, NI_MAXSERV);
    -
    -  sastr = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "@sockaddr"));
    -  if (!mrb_string_p(sastr)) {
    -    mrb_raise(mrb, E_SOCKET_ERROR, "invalid sockaddr");
    -  }
    -  error = getnameinfo((struct sockaddr *)RSTRING_PTR(sastr), (socklen_t)RSTRING_LEN(sastr), RSTRING_PTR(host), NI_MAXHOST, RSTRING_PTR(serv), NI_MAXSERV, (int)flags);
    -  if (error) {
    -    mrb_raisef(mrb, E_SOCKET_ERROR, "getnameinfo: %s", gai_strerror(error));
    -  }
    -  ary = mrb_ary_new_capa(mrb, 2);
    -  mrb_str_resize(mrb, host, strlen(RSTRING_PTR(host)));
    -  mrb_ary_push(mrb, ary, host);
    -  mrb_str_resize(mrb, serv, strlen(RSTRING_PTR(serv)));
    -  mrb_ary_push(mrb, ary, serv);
    -  return ary;
    -}
    -
    @@ -1266,10 +1060,8 @@

    -

    def family_addrinfo(host, port=nil) -def getnameinfo(flags=0) - Socket.getnameinfo -end

    + +

    def family_addrinfo(host, port=nil) def getnameinfo(flags=0) Socket.getnameinfo end

    @@ -1277,14 +1069,17 @@

    -
    - +

    + @@ -1337,6 +1129,9 @@

     
     
    +76
    +77
    +78
     79
     80
     81
    @@ -1346,13 +1141,10 @@ 

    85 86 87 -88 -89 -90 -91

    +88

     
     
    +61
    +62
    +63
     64
     65
     66
    @@ -1295,13 +1090,10 @@ 

    71 72 73 -74 -75 -76 -77

    +74
    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 64
    +      
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 61
     
     def inspect
       if ipv4? or ipv6?
    @@ -1312,10 +1104,10 @@ 

    else proto = '???' end - "#<Addrinfo: #{inspect_sockaddr} #{proto}>" else - "#<Addrinfo: #{self.unix_path} SOCK_STREAM>" + proto = "SOCK_STREAM" end + "#<Addrinfo: #{inspect_sockaddr} #{proto}>" end

    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 79
    +      
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 76
     
     def inspect_sockaddr
       if ipv4?
    @@ -1385,7 +1177,6 @@ 

    -
    @@ -1404,20 +1195,20 @@

    -

    - + +
     
     
    -93
    -94
    -95
    +90 +91 +92
    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 93
    +      
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 90
     
     def ip?
       ipv4? or ipv6?
    @@ -1442,12 +1233,12 @@ 

     
     
    -97
    -98
    -99
    +94 +95 +96

    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 97
    +      
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 94
     
     def ip_address
       ip_unpack[0]
    @@ -1472,12 +1263,12 @@ 

     
     
    -101
    -102
    -103
    +98 +99 +100

    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 101
    +      
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 98
     
     def ip_port
       ip_unpack[1]
    @@ -1502,13 +1293,13 @@ 

     
     
    -105
    -106
    -107
    -108
    +102 +103 +104 +105

    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 105
    +      
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 102
     
     def ip_unpack
       h, p = getnameinfo(Socket::NI_NUMERICHOST|Socket::NI_NUMERICSERV)
    @@ -1532,7 +1323,6 @@ 

    -
    @@ -1551,20 +1341,20 @@

    -

    - + +
     
     
    -110
    -111
    -112
    +107 +108 +109
    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 110
    +      
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 107
     
     def ipv4?
       @family == Socket::AF_INET
    @@ -1585,9 +1375,8 @@ 

    -

    def ipv4_loopback? -def ipv4_multicast? -def ipv4_private?

    + +

    def ipv4_loopback? def ipv4_multicast? def ipv4_private?

    @@ -1608,20 +1397,20 @@

    -

    - + +
     
     
    -118
    -119
    -120
    +115 +116 +117
    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 118
    +      
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 115
     
     def ipv6?
       @family == Socket::AF_INET6
    @@ -1642,18 +1431,8 @@ 

    -

    def ipv6_loopback? -def ipv6_mc_global? -def ipv6_mc_linklocal? -def ipv6_mc_nodelocal? -def ipv6_mc_orilocal? -def ipv6_mc_sitelocal? -def ipv6_multicast? -def ipv6_to_ipv4 -def ipv6_unspecified -def ipv6_v4compat? -def ipv6_v4mapped? -def listen(backlog=5)

    + +

    def ipv6_loopback? def ipv6_mc_global? def ipv6_mc_linklocal? def ipv6_mc_nodelocal? def ipv6_mc_orilocal? def ipv6_mc_sitelocal? def ipv6_multicast? def ipv6_to_ipv4 def ipv6_unspecified def ipv6_v4compat? def ipv6_v4mapped? def listen(backlog=5)

    @@ -1661,20 +1440,20 @@

    -
    - +

    +
     
     
    -135
    -136
    -137
    +132 +133 +134
    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 135
    +      
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 132
     
     def pfamily
       @family
    @@ -1703,12 +1482,12 @@ 

     
     
    -157
    -158
    -159
    +154 +155 +156

    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 157
    +      
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 154
     
     def to_sockaddr
       @sockaddr
    @@ -1731,7 +1510,6 @@ 

    -
    @@ -1750,20 +1528,20 @@

    -

    - + +
     
     
    -163
    -164
    -165
    +160 +161 +162
    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 163
    +      
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 160
     
     def unix?
       @family == Socket::AF_UNIX
    @@ -1771,69 +1549,17 @@ 

    - - -
    -

    - - #unix_pathObject - - - - - -

    - - - - -
    -
    -
    -
    -220
    -221
    -222
    -223
    -224
    -225
    -226
    -227
    -228
    -229
    -230
    -231
    -232
    -233
    -
    -
    # File 'mrbgems/mruby-socket/src/socket.c', line 220
    -
    -static mrb_value
    -mrb_addrinfo_unix_path(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value sastr;
    -
    -  sastr = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "@sockaddr"));
    -  if (((struct sockaddr *)RSTRING_PTR(sastr))->sa_family != AF_UNIX)
    -    mrb_raise(mrb, E_SOCKET_ERROR, "need AF_UNIX address");
    -  if (RSTRING_LEN(sastr) < (mrb_int)offsetof(struct sockaddr_un, sun_path) + 1) {
    -    return mrb_str_new(mrb, "", 0);
    -  } else {
    -    return mrb_str_new_cstr(mrb, ((struct sockaddr_un *)RSTRING_PTR(sastr))->sun_path);
    -  }
    -}
    -
    - + diff --git a/docs/api/ArgumentError.html b/docs/api/ArgumentError.html index 71f3c7f..96f3fd2 100644 --- a/docs/api/ArgumentError.html +++ b/docs/api/ArgumentError.html @@ -6,17 +6,17 @@ Exception: ArgumentError - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -73,14 +73,12 @@
    Inherits:
    - StandardError + StandardError + + - - - constructor +

    Methods included from Enumerable

    +

    #all?, #any?, #chain, #chunk, #chunk_while, #collect, #count, #cycle, #detect, #drop, #drop_while, #each_cons, #each_entry, #each_slice, #each_with_index, #each_with_object, #filter_map, #find_all, #find_index, #first, #flat_map, #grep, #grep_v, #group_by, #hash, #include?, #inject, #lazy, #max, #max_by, #min, #min_by, #minmax, #minmax_by, #none?, #one?, #partition, #reject, #sum, #take, #take_while, #tally, #zip

    - -

    Private method for Array creation.

    -
    - - - -
  • - - - #initialize_copy ⇒ Object - +
    +

    Instance Method Details

    - - - - - - +
    +

    + #&(elem) ⇒ Object -

    15.2.12.5.16.

    -
    - -

  • - -
  • - - - #insert(idx, *args) ⇒ Object + +
  • +
    +

    call-seq: ary & other_ary -> new_ary

    - - - - - - - - - +

    Set Intersection—Returns a new array containing elements common to the two arrays, with no duplicates.

    - -

    call-seq: ary.insert(index, obj…) -> ary.

    -
    - - +

    [ 1, 1, 3, 5 ] & [ 1, 2, 3 ] #=> [ 1, 3 ]

    - -
  • - - - #inspect ⇒ Object - - - (also: #to_s) - - - - - - +
  • +
    +
    +

    Raises:

    + - -

    Return the contents of this array as a string.

    -
    - - +
    - -
  • - - - #intersection(*args) ⇒ Object - + + + + + +
    +
    +
    +
    +152
    +153
    +154
    +155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    +172
    +173
    +174
    +
    +
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 152
    +
    +def &(elem)
    +  raise TypeError, "cannot convert #{elem.class} into Array" unless elem.class == Array
     
    +  hash = {}
    +  array = []
    +  idx = 0
    +  len = elem.size
    +  while idx < len
    +    hash[elem[idx]] = true
    +    idx += 1
    +  end
    +  idx = 0
    +  len = size
    +  while idx < len
    +    v = self[idx]
    +    if hash[v]
    +      array << v
    +      hash.delete v
    +    end
    +    idx += 1
    +  end
    +  array
    +end
    +
    + -
    - - - - - +
    +

    - - - -

    call-seq: ary.intersection(other_ary,…) -> new_ary.

    -
    - -

  • - - -
  • - - - #join(sep = "") ⇒ String - - - - - - - - - - - - - -

    Returns a string created by converting each element of the array to a string, separated by sep.

    -
    - -
  • - - -
  • - - - #keep_if(&block) ⇒ Object - - - - - - - - - - - - - -
    - - - - - - - -
    call-seq: ary.keep_if {itemblock } -> ary ary.keep_if -> Enumerator.
    -
    - -
  • - - -
  • - - - #last ⇒ Object - - - - - - - - - - - - - -

    15.2.12.5.18.

    -
    - -
  • - - -
  • - - - #length ⇒ Object - - - - - - - - - - - - - -

    15.2.12.5.19.

    -
    - -
  • - - -
  • - - - #permutation(n = self.size, &block) ⇒ Object - - - - - - - - - - - - - -
    - - - - - - - - - -
    call-seq: ary.permutation {pblock } -> ary ary.permutation -> Enumerator ary.permutation(n) {pblock } -> ary ary.permutation(n) -> Enumerator.
    -
    - -
  • - - -
  • - - - #pop ⇒ Object - - - - - - - - - - - - - -

    15.2.12.5.21.

    -
    - -
  • - - -
  • - - - #push ⇒ Object - - - - (also: #append) - - - - - - - - - - - -

    15.2.12.5.22.

    -
    - -
  • - - -
  • - - - #rassoc(obj) ⇒ Array? - - - - - - - - - - - - - -

    Searches through the array whose elements are also arrays.

    -
    - -
  • - - -
  • - - - #reject!(&block) ⇒ Object - - - - - - - - - - - - - -
    - - - - - - - -
    call-seq: ary.reject! {itemblock } -> ary or nil ary.reject! -> Enumerator.
    -
    - -
  • - - -
  • - - - #replace ⇒ Object - - - - - - - - - - - - - -

    15.2.12.5.23.

    -
    - -
  • - - -
  • - - - #reverse ⇒ Object - - - - - - - - - - - - - -

    15.2.12.5.24.

    -
    - -
  • - - -
  • - - - #reverse! ⇒ Object - - - - - - - - - - - - - -

    15.2.12.5.25.

    -
    - -
  • - - -
  • - - - #reverse_each(&block) ⇒ Object - - - - - - - - - - - - - -

    for efficiency.

    -
    - -
  • - - -
  • - - - #rindex ⇒ Object - - - - - - - - - - - - - -

    15.2.12.5.26.

    -
    - -
  • - - -
  • - - - #rotate(count = 1) ⇒ Object - - - - - - - - - - - - - -

    call-seq: ary.rotate(count=1) -> new_ary.

    -
    - -
  • - - -
  • - - - #rotate!(count = 1) ⇒ Object - - - - - - - - - - - - - -

    call-seq: ary.rotate!(count=1) -> ary.

    -
    - -
  • - - -
  • - - - #select!(&block) ⇒ Object - - - - (also: #filter!) - - - - - - - - - - - -
    - - - - - - - -
    call-seq: ary.select! {itemblock } -> ary or nil ary.select! -> Enumerator.
    -
    - -
  • - - -
  • - - - #shift ⇒ Object - - - - - - - - - - - - - -

    15.2.12.5.27.

    -
    - -
  • - - -
  • - - - #size ⇒ Object - - - - - - - - - - - - - -

    15.2.12.5.28.

    -
    - -
  • - - -
  • - - - #slice ⇒ Object - - - - - - - - - - - - - -

    Element Reference — Returns the element at +index+, or returns a subarray starting at the +start+ index and continuing for +length+ elements, or returns a subarray specified by +range+ of indices.

    -
    - -
  • - - -
  • - - - #slice! ⇒ Object - - - - - - - - - - - - - -

    Deletes the element(s) given by an +index+ (optionally up to +length+ elements) or by a +range+.

    -
    - -
  • - - -
  • - - - #sort(&block) ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #sort!(&block) ⇒ Object - - - - - - - - - - - - - -

    Sort all elements and replace +self+ with these elements.

    -
    - -
  • - - -
  • - - - #to_h(&blk) ⇒ Object - - - - - - - - - - - - - -
    - - - - - - - -
    call-seq: ary.to_h -> Hash ary.to_h{item… } -> Hash.
    -
    - -
  • - - -
  • - - - #transpose ⇒ Object - - - - - - - - - - - - - -

    call-seq: ary.transpose -> new_ary.

    -
    - -
  • - - -
  • - - - #union(*args) ⇒ Object - - - - - - - - - - - - - -

    call-seq: ary.union(other_ary,…) -> new_ary.

    -
    - -
  • - - -
  • - - - #uniq(&block) ⇒ Object - - - - - - - - - - - - - -
    - - - - - - - -
    call-seq: ary.uniq -> new_ary ary.uniq {item… } -> new_ary.
    -
    - -
  • - - -
  • - - - #uniq!(&block) ⇒ Object - - - - - - - - - - - - - -
    - - - - - - - -
    call-seq: ary.uniq! -> ary or nil ary.uniq! {item… } -> ary or nil.
    -
    - -
  • - - -
  • - - - #unshift ⇒ Object - - - - (also: #prepend) - - - - - - - - - - - -

    15.2.12.5.30.

    -
    - -
  • - - -
  • - - - #values_at ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #|(elem) ⇒ Object - - - - - - - - - - - - - -
    - - - - - - -
    call-seq: aryother_ary -> new_ary.
    -
    - -
  • - - - - - - - - - - - - - - -

    Methods included from Enumerable

    -

    __update_hash, #all?, #any?, #chain, #collect, #count, #cycle, #detect, #drop, #drop_while, #each_cons, #each_slice, #each_with_index, #each_with_object, #entries, #filter_map, #find_all, #find_index, #flat_map, #grep, #group_by, #hash, #include?, #inject, #lazy, #max, #max_by, #min, #min_by, #minmax, #minmax_by, #none?, #one?, #partition, #reject, #sort_by, #take, #take_while, #tally, #zip

    -
    -

    Constructor Details

    - -
    -

    - - #initialize(size = 0, obj = nil, &block) ⇒ Array - - - - - -

    -
    -

    Private method for Array creation.

    - -

    ISO 15.2.12.5.15

    - - -
    -
    -
    - -

    Raises:

    - - -
    - - - - - - -
    -
    -
    -
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -
    -
    # File 'mrblib/array.rb', line 68
    -
    -def initialize(size=0, obj=nil, &block)
    -  size = size.__to_int
    -  raise ArgumentError, "negative array size" if size < 0
    -
    -  self.clear
    -  if size > 0
    -    self[size - 1] = nil # allocate
    -
    -    idx = 0
    -    while idx < size
    -      self[idx] = (block)? block.call(idx): obj
    -      idx += 1
    -    end
    -  end
    -
    -  self
    -end
    -
    -
    - -
    - - -
    -

    Instance Method Details

    - - -
    -

    - - #&(elem) ⇒ Object - - - - - -

    -
    -

    call-seq: - ary & other_ary -> new_ary

    - -

    Set Intersection—Returns a new array -containing elements common to the two arrays, with no duplicates.

    - -

    [ 1, 1, 3, 5 ] & [ 1, 2, 3 ] #=> [ 1, 3 ]

    - - -
    -
    -
    - -

    Raises:

    - - -
    - - - - - - -
    -
    -
    -
    -152
    -153
    -154
    -155
    -156
    -157
    -158
    -159
    -160
    -161
    -162
    -163
    -164
    -165
    -166
    -167
    -168
    -169
    -170
    -171
    -172
    -173
    -174
    -
    -
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 152
    -
    -def &(elem)
    -  raise TypeError, "can't convert #{elem.class} into Array" unless elem.class == Array
    -
    -  hash = {}
    -  array = []
    -  idx = 0
    -  len = elem.size
    -  while idx < len
    -    hash[elem[idx]] = true
    -    idx += 1
    -  end
    -  idx = 0
    -  len = size
    -  while idx < len
    -    v = self[idx]
    -    if hash[v]
    -      array << v
    -      hash.delete v
    -    end
    -    idx += 1
    -  end
    -  array
    -end
    -
    -
    - -
    -

    - - #*Object - - - - - -

    -
    -

    15.2.12.5.2

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -424
    -425
    -426
    -427
    -428
    -429
    -430
    -431
    -432
    -433
    -434
    -435
    -436
    -437
    -438
    -439
    -440
    -441
    -442
    -443
    -444
    -445
    -446
    -447
    -448
    -449
    -450
    -
    -
    # File 'src/array.c', line 424
    -
    -static mrb_value
    -mrb_ary_times(mrb_state *mrb, mrb_value self)
    -{
    -  struct RArray *a1 = mrb_ary_ptr(self);
    -  struct RArray *a2;
    -  mrb_value *ptr;
    -  mrb_int times, len1;
    -
    -  mrb_get_args(mrb, "i", &times);
    -  if (times < 0) {
    -    mrb_raise(mrb, E_ARGUMENT_ERROR, "negative argument");
    -  }
    -  if (times == 0) return mrb_ary_new(mrb);
    -  if (ARY_MAX_SIZE / times < ARY_LEN(a1)) {
    -    mrb_raise(mrb, E_ARGUMENT_ERROR, "array size too big");
    -  }
    -  len1 = ARY_LEN(a1);
    -  a2 = ary_new_capa(mrb, len1 * times);
    -  ARY_SET_LEN(a2, len1 * times);
    -  ptr = ARY_PTR(a2);
    -  while (times--) {
    -    array_copy(ptr, ARY_PTR(a1), len1);
    -    ptr += len1;
    -  }
    -
    -  return mrb_obj_value(a2);
    -}
    -
    -
    - -
    -

    - - #+Object - - - - - -

    -
    -

    15.2.12.5.1

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -338
    -339
    -340
    -341
    -342
    -343
    -344
    -345
    -346
    -347
    -348
    -349
    -350
    -351
    -352
    -353
    -354
    -355
    -356
    -357
    -
    -
    # File 'src/array.c', line 338
    -
    -static mrb_value
    -mrb_ary_plus(mrb_state *mrb, mrb_value self)
    -{
    -  struct RArray *a1 = mrb_ary_ptr(self);
    -  struct RArray *a2;
    -  mrb_value *ptr;
    -  mrb_int blen, len1;
    -
    -  mrb_get_args(mrb, "a", &ptr, &blen);
    -  if (ARY_MAX_SIZE - blen < ARY_LEN(a1)) {
    -    mrb_raise(mrb, E_ARGUMENT_ERROR, "array size too big");
    -  }
    -  len1 = ARY_LEN(a1);
    -  a2 = ary_new_capa(mrb, len1 + blen);
    -  array_copy(ARY_PTR(a2), ARY_PTR(a1), len1);
    -  array_copy(ARY_PTR(a2) + len1, ptr, blen);
    -  ARY_SET_LEN(a2, len1+blen);
    -
    -  return mrb_obj_value(a2);
    -}
    -
    -
    - -
    -

    - - #-(elem) ⇒ Object - - - - - -

    -
    -

    call-seq: - ary - other_ary -> new_ary

    - -

    Array Difference—Returns a new array that is a copy of -the original array, removing any items that also appear in -other_ary. (If you need set-like behavior, see the -library class Set.)

    - -

    [ 1, 1, 2, 2, 3, 3, 4, 5 ] - [ 1, 2, 4 ] #=> [ 3, 3, 5 ]

    - - -
    -
    -
    - -

    Raises:

    - - -
    - - - - - - -
    -
    -
    -
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -
    -
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 70
    -
    -def -(elem)
    -  raise TypeError, "can't convert #{elem.class} into Array" unless elem.class == Array
    -
    -  hash = {}
    -  array = []
    -  idx = 0
    -  len = elem.size
    -  while idx < len
    -    hash[elem[idx]] = true
    -    idx += 1
    -  end
    -  idx = 0
    -  len = size
    -  while idx < len
    -    v = self[idx]
    -    array << v unless hash[v]
    -    idx += 1
    -  end
    -  array
    -end
    -
    -
    - -
    -

    - - #<<Object - - - - - -

    -
    -

    15.2.12.5.3

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -508
    -509
    -510
    -511
    -512
    -513
    -514
    -515
    -516
    -517
    -518
    -519
    -520
    -521
    -522
    -523
    -524
    -525
    -526
    -527
    -528
    -
    -
    # File 'src/array.c', line 508
    -
    -static mrb_value
    -mrb_ary_push_m(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value *argv;
    -  mrb_int len, len2, alen;
    -  struct RArray *a;
    -
    -  mrb_get_args(mrb, "*!", &argv, &alen);
    -  a = mrb_ary_ptr(self);
    -  ary_modify(mrb, a);
    -  len = ARY_LEN(a);
    -  len2 = len + alen;
    -  if (ARY_CAPA(a) < len2) {
    -    ary_expand_capa(mrb, a, len2);
    -  }
    -  array_copy(ARY_PTR(a)+len, argv, alen);
    -  ARY_SET_LEN(a, len2);
    -  mrb_write_barrier(mrb, (struct RBasic*)a);
    -
    -  return self;
    -}
    -
    -
    - -
    -

    - - #<=>(other) ⇒ Object - - - - - -

    -
    -

    Comparison—Returns an integer (-1, 0, or +1) - if this array is less than, equal to, or greater than other_ary. - Each object in each array is compared (using <=>). If any value isn’t - equal, then that inequality is the return value. If all the - values found are equal, then the return is based on a - comparison of the array lengths. Thus, two arrays are - “equal” according to Array#<=> if and only if they have - the same length and the value of each element is equal to the - value of the corresponding element in the other array.

    - -

    ISO 15.2.12.5.36 (x)

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -158
    -159
    -160
    -161
    -162
    -163
    -164
    -165
    -166
    -167
    -168
    -169
    -170
    -171
    -172
    -173
    -174
    -175
    -176
    -177
    -178
    -179
    -180
    -
    -
    # File 'mrblib/array.rb', line 158
    -
    -def <=>(other)
    -  other = self.__ary_cmp(other)
    -  return 0 if 0 == other
    -  return nil if nil == other
    -
    -  len = self.size
    -  n = other.size
    -  len = n if len > n
    -  i = 0
    -  while i < len
    -    n = (self[i] <=> other[i])
    -    return n if n.nil? || n != 0
    -    i += 1
    -  end
    -  len = self.size - other.size
    -  if len == 0
    -    0
    -  elsif len > 0
    -    1
    -  else
    -    -1
    -  end
    -end
    -
    -
    - -
    -

    - - #==(other) ⇒ Object - - - - - -

    -
    -

    Equality—Two arrays are equal if they contain the same number - of elements and if each element is equal to (according to - Object.==) the corresponding element in the other array.

    - -

    ISO 15.2.12.5.33 (x)

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -115
    -116
    -117
    -118
    -119
    -120
    -121
    -122
    -123
    -124
    -125
    -126
    -
    -
    # File 'mrblib/array.rb', line 115
    -
    -def ==(other)
    -  other = self.__ary_eq(other)
    -  return false if other == false
    -  return true  if other == true
    -  len = self.size
    -  i = 0
    -  while i < len
    -    return false if self[i] != other[i]
    -    i += 1
    -  end
    -  return true
    -end
    -
    -
    - -
    -

    - - - #[](index) ⇒ Object? - - #[](start, length) ⇒ Array? - - #[](range) ⇒ Array? - - #slice(index) ⇒ Object? - - #slice(start, length) ⇒ Array? - - #slice(range) ⇒ Array? - - - - - - -

    -
    -

    Element Reference — Returns the element at +index+, or returns a -subarray starting at the +start+ index and continuing for +length+ -elements, or returns a subarray specified by +range+ of indices.

    - -

    Negative indices count backward from the end of the array (-1 is the last -element). For +start+ and +range+ cases the starting index is just before -an element. Additionally, an empty array is returned when the starting -index for an element range is at the end of the array.

    - -

    Returns +nil+ if the index (or starting index) are out of range.

    - -

    a = [ “a”, “b”, “c”, “d”, “e” ] -a[1] => “b” -a[1,2] => [“b”, “c”] -a[1..-2] => [“b”, “c”, “d”]

    - - -
    -
    -
    - -

    Overloads:

    -
      - - -
    • - #[](index) ⇒ Object? -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Object, nil) - - - -
      • - -
      - -
      - - -
    • - - -
    • - #[](start, length) ⇒ Array? -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Array, nil) - - - -
      • - -
      - -
      - - -
    • - - -
    • - #[](range) ⇒ Array? -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Array, nil) - - - -
      • - -
      - -
      - - -
    • - - -
    • - #slice(index) ⇒ Object? -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Object, nil) - - - -
      • - -
      - -
      - - -
    • - - -
    • - #slice(start, length) ⇒ Array? -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Array, nil) - - - -
      • - -
      - -
      - - -
    • - - -
    • - #slice(range) ⇒ Array? -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Array, nil) - - - -
      • - -
      - -
      - - -
    • - -
    - - -
    - - - - - - -
    -
    -
    -
    -852
    -853
    -854
    -855
    -856
    -857
    -858
    -859
    -860
    -861
    -862
    -863
    -864
    -865
    -866
    -867
    -868
    -869
    -870
    -871
    -872
    -873
    -874
    -875
    -876
    -877
    -878
    -879
    -880
    -881
    -882
    -883
    -884
    -885
    -
    -
    # File 'src/array.c', line 852
    -
    -static mrb_value
    -mrb_ary_aget(mrb_state *mrb, mrb_value self)
    -{
    -  struct RArray *a = mrb_ary_ptr(self);
    -  mrb_int i, len, alen;
    -  mrb_value index;
    -
    -  if (mrb_get_args(mrb, "o|i", &index, &len) == 1) {
    -    switch (mrb_type(index)) {
    -      /* a[n..m] */
    -    case MRB_TT_RANGE:
    -      if (mrb_range_beg_len(mrb, index, &i, &len, ARY_LEN(a), TRUE) == MRB_RANGE_OK) {
    -        return ary_subseq(mrb, a, i, len);
    -      }
    -      else {
    -        return mrb_nil_value();
    -      }
    -    case MRB_TT_FIXNUM:
    -      return mrb_ary_ref(mrb, self, mrb_fixnum(index));
    -    default:
    -      return mrb_ary_ref(mrb, self, aget_index(mrb, index));
    -    }
    -  }
    -
    -  i = aget_index(mrb, index);
    -  alen = ARY_LEN(a);
    -  if (i < 0) i += alen;
    -  if (i < 0 || alen < i) return mrb_nil_value();
    -  if (len < 0) return mrb_nil_value();
    -  if (alen == i) return mrb_ary_new(mrb);
    -  if (len > alen - i) len = alen - i;
    -
    -  return ary_subseq(mrb, a, i, len);
    -}
    -
    -
    - -
    -

    - - - #[]=(index) ⇒ Object - - #[]=(start, length) ⇒ Object? - - #[]=(range) ⇒ Object? - - - - - - -

    -
    -

    Element Assignment — Sets the element at +index+, or replaces a subarray -from the +start+ index for +length+ elements, or replaces a subarray -specified by the +range+ of indices.

    - -

    If indices are greater than the current capacity of the array, the array -grows automatically. Elements are inserted into the array at +start+ if -+length+ is zero.

    - -

    Negative indices will count backward from the end of the array. For -+start+ and +range+ cases the starting index is just before an element.

    - -

    An IndexError is raised if a negative index points past the beginning of -the array.

    - -

    See also Array#push, and Array#unshift.

    - -

    a = Array.new - a[4] = “4”; #=> [nil, nil, nil, nil, “4”] - a[0, 3] = [ ‘a’, ‘b’, ‘c’ ] #=> [“a”, “b”, “c”, nil, “4”] - a[1..2] = [ 1, 2 ] #=> [“a”, 1, 2, nil, “4”] - a[0, 2] = “?” #=> [”?”, 2, nil, “4”] - a[0..2] = “A” #=> [“A”, “4”] - a[-1] = “Z” #=> [“A”, “Z”] - a[1..-1] = nil #=> [“A”, nil] - a[1..-1] = [] #=> [“A”] - a[0, 0] = [ 1, 2 ] #=> [1, 2, “A”] - a[3, 0] = “B” #=> [1, 2, “A”, “B”]

    - - -
    -
    -
    - -

    Overloads:

    -
      - - -
    • - #[]=(index) ⇒ Object -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Object) - - - -
      • - -
      - -
      - - -
    • - - -
    • - #[]=(start, length) ⇒ Object? -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Object, nil) - - - -
      • - -
      - -
      - - -
    • - - -
    • - #[]=(range) ⇒ Object? -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Object, nil) - - - -
      • - -
      - -
      - - -
    • - -
    - - -
    - - - - - - -
    -
    -
    -
    -922
    -923
    -924
    -925
    -926
    -927
    -928
    -929
    -930
    -931
    -932
    -933
    -934
    -935
    -936
    -937
    -938
    -939
    -940
    -941
    -942
    -943
    -944
    -945
    -946
    -947
    -948
    -
    -
    # File 'src/array.c', line 922
    -
    -static mrb_value
    -mrb_ary_aset(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value v1, v2, v3;
    -  mrb_int i, len;
    -
    -  mrb_ary_modify(mrb, mrb_ary_ptr(self));
    -  if (mrb_get_args(mrb, "oo|o", &v1, &v2, &v3) == 2) {
    -    /* a[n..m] = v */
    -    switch (mrb_range_beg_len(mrb, v1, &i, &len, RARRAY_LEN(self), FALSE)) {
    -    case MRB_RANGE_TYPE_MISMATCH:
    -      mrb_ary_set(mrb, self, aget_index(mrb, v1), v2);
    -      break;
    -    case MRB_RANGE_OK:
    -      mrb_ary_splice(mrb, self, i, len, v2);
    -      break;
    -    case MRB_RANGE_OUT:
    -      mrb_raisef(mrb, E_RANGE_ERROR, "%v out of range", v1);
    -      break;
    -    }
    -    return v2;
    -  }
    -
    -  /* a[n,m] = v */
    -  mrb_ary_splice(mrb, self, aget_index(mrb, v1), aget_index(mrb, v2), v3);
    -  return v3;
    -}
    -
    -
    - -
    -

    - - #__ary_cmpObject - - - - - -

    - - - - -
    -
    -
    -
    -1232
    -1233
    -1234
    -1235
    -1236
    -1237
    -1238
    -1239
    -1240
    -1241
    -1242
    -1243
    -1244
    -
    -
    # File 'src/array.c', line 1232
    -
    -static mrb_value
    -mrb_ary_cmp(mrb_state *mrb, mrb_value ary1)
    -{
    -  mrb_value ary2;
    -
    -  mrb_get_args(mrb, "o", &ary2);
    -  if (mrb_obj_equal(mrb, ary1, ary2)) return mrb_fixnum_value(0);
    -  if (!mrb_array_p(ary2)) {
    -    return mrb_nil_value();
    -  }
    -
    -  return ary2;
    -}
    -
    -
    - -
    -

    - - #__ary_eqObject - - - - - -

    -
    -

    15.2.12.5.30

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -1217
    -1218
    -1219
    -1220
    -1221
    -1222
    -1223
    -1224
    -1225
    -1226
    -1227
    -1228
    -1229
    -1230
    -
    -
    # File 'src/array.c', line 1217
    -
    -static mrb_value
    -mrb_ary_eq(mrb_state *mrb, mrb_value ary1)
    -{
    -  mrb_value ary2;
    -
    -  mrb_get_args(mrb, "o", &ary2);
    -  if (mrb_obj_equal(mrb, ary1, ary2)) return mrb_true_value();
    -  if (!mrb_array_p(ary2)) {
    -    return mrb_false_value();
    -  }
    -  if (RARRAY_LEN(ary1) != RARRAY_LEN(ary2)) return mrb_false_value();
    -
    -  return ary2;
    -}
    -
    -
    - -
    -

    - - #__ary_indexObject - - - - - -

    -
    -

    kept for mruby-array-ext

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -1025
    -1026
    -1027
    -1028
    -1029
    -1030
    -1031
    -1032
    -1033
    -1034
    -1035
    -1036
    -1037
    -1038
    -
    -
    # File 'src/array.c', line 1025
    -
    -static mrb_value
    -mrb_ary_index_m(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value obj;
    -  mrb_int i;
    -
    -  mrb_get_args(mrb, "o", &obj);
    -  for (i = 0; i < RARRAY_LEN(self); i++) {
    -    if (mrb_equal(mrb, RARRAY_PTR(self)[i], obj)) {
    -      return mrb_fixnum_value(i);
    -    }
    -  }
    -  return mrb_nil_value();
    -}
    -
    -
    - -
    -

    - - #__svalueObject - - - - - -

    -
    -

    internal method to convert multi-value to single value

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -1247
    -1248
    -1249
    -1250
    -1251
    -1252
    -1253
    -1254
    -1255
    -1256
    -1257
    -1258
    -
    -
    # File 'src/array.c', line 1247
    -
    -static mrb_value
    -mrb_ary_svalue(mrb_state *mrb, mrb_value ary)
    -{
    -  switch (RARRAY_LEN(ary)) {
    -  case 0:
    -    return mrb_nil_value();
    -  case 1:
    -    return RARRAY_PTR(ary)[0];
    -  default:
    -    return ary;
    -  }
    -}
    -
    -
    - -
    -

    - - #_inspect(recur_list) ⇒ Object - - - - - -

    - - - - -
    -
    -
    -
    -86
    -87
    -88
    -89
    -90
    -91
    -92
    -93
    -94
    -95
    -96
    -97
    -98
    -
    -
    # File 'mrblib/array.rb', line 86
    -
    -def _inspect(recur_list)
    -  size = self.size
    -  return "[]" if size == 0
    -  return "[...]" if recur_list[self.object_id]
    -  recur_list[self.object_id] = true
    -  ary=[]
    -  i=0
    -  while i<size
    -    ary<<self[i]._inspect(recur_list)
    -    i+=1
    -  end
    -  "["+ary.join(", ")+"]"
    -end
    -
    -
    - -
    -

    - - #assoc(obj) ⇒ Array? - - - - - -

    -
    -

    Searches through an array whose elements are also arrays -comparing obj with the first element of each contained array -using obj.==. -Returns the first contained array that matches (that -is, the first associated array), -or +nil+ if no match is found. -See also Array#rassoc.

    - -

    s1 = [ “colors”, “red”, “blue”, “green” ] - s2 = [ “letters”, “a”, “b”, “c” ] - s3 = “foo” - a = [ s1, s2, s3 ] - a.assoc(“letters”) #=> [ “letters”, “a”, “b”, “c” ] - a.assoc(“foo”) #=> nil

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Array, nil) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -
    -
    # File 'mrbgems/mruby-array-ext/src/array.c', line 27
    -
    -static mrb_value
    -mrb_ary_assoc(mrb_state *mrb, mrb_value ary)
    -{
    -  mrb_int i;
    -  mrb_value v, k;
    -
    -  mrb_get_args(mrb, "o", &k);
    -
    -  for (i = 0; i < RARRAY_LEN(ary); ++i) {
    -    v = mrb_check_array_type(mrb, RARRAY_PTR(ary)[i]);
    -    if (!mrb_nil_p(v) && RARRAY_LEN(v) > 0 &&
    -        mrb_equal(mrb, RARRAY_PTR(v)[0], k))
    -      return v;
    -  }
    -  return mrb_nil_value();
    -}
    -
    -
    - -
    -

    - - #at(index) ⇒ Object? - - - - - -

    -
    -

    Returns the element at index. A -negative index counts from the end of +self+. Returns +nil+ -if the index is out of range. See also Array#[].

    - -

    a = [ “a”, “b”, “c”, “d”, “e” ] - a.at(0) #=> “a” - a.at(-1) #=> “e”

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Object, nil) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -89
    -90
    -91
    -92
    -93
    -94
    -95
    -96
    -
    -
    # File 'mrbgems/mruby-array-ext/src/array.c', line 89
    -
    -static mrb_value
    -mrb_ary_at(mrb_state *mrb, mrb_value ary)
    -{
    -  mrb_int pos;
    -  mrb_get_args(mrb, "i", &pos);
    -
    -  return mrb_ary_entry(ary, pos);
    -}
    -
    -
    - -
    -

    - - #bsearch(&block) ⇒ Object - - - - - -

    -
    -

    call-seq: - ary.bsearch {|x| block } -> elem

    - -

    By using binary search, finds a value from this array which meets - the given condition in O(log n) where n is the size of the array.

    - -

    You can use this method in two use cases: a find-minimum mode and - a find-any mode. In either case, the elements of the array must be - monotone (or sorted) with respect to the block.

    - -

    In find-minimum mode (this is a good choice for typical use case), - the block must return true or false, and there must be an index i - (0 <= i <= ary.size) so that:

    - -
      -
    • the block returns false for any element whose index is less than -i, and
    • -
    • the block returns true for any element whose index is greater -than or equal to i.
    • -
    - -

    This method returns the i-th element. If i is equal to ary.size, - it returns nil.

    - -
    ary = [0, 4, 7, 10, 12]
    -ary.bsearch {|x| x >=   4 } #=> 4
    -ary.bsearch {|x| x >=   6 } #=> 7
    -ary.bsearch {|x| x >=  -1 } #=> 0
    -ary.bsearch {|x| x >= 100 } #=> nil
    -
    - -

    In find-any mode (this behaves like libc’s bsearch(3)), the block - must return a number, and there must be two indices i and j - (0 <= i <= j <= ary.size) so that:

    - -
      -
    • the block returns a positive number for ary[k] if 0 <= k < i,
    • -
    • the block returns zero for ary[k] if i <= k < j, and
    • -
    • the block returns a negative number for ary[k] if -j <= k < ary.size.
    • -
    - -

    Under this condition, this method returns any element whose index - is within i…j. If i is equal to j (i.e., there is no element - that satisfies the block), this method returns nil.

    - -
    ary = [0, 4, 7, 10, 12]
    -# try to find v such that 4 <= v < 8
    -ary.bsearch {|x| 1 - (x / 4).truncate } #=> 4 or 7
    -# try to find v such that 8 <= v < 10
    -ary.bsearch {|x| 4 - (x / 2).truncate } #=> nil
    -
    - -

    You must not mix the two modes at a time; the block must always - return either true/false, or always return a number. It is - undefined which value is actually picked up at each iteration.

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -632
    -633
    -634
    -635
    -636
    -637
    -638
    -639
    -640
    -
    -
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 632
    -
    -def bsearch(&block)
    -  return to_enum :bsearch unless block
    -
    -  if idx = bsearch_index(&block)
    -    self[idx]
    -  else
    -    nil
    -  end
    -end
    -
    -
    - -
    -

    - - #bsearch_index(&block) ⇒ Object - - - - - -

    -
    -

    call-seq: - ary.bsearch_index {|x| block } -> int or nil

    - -

    By using binary search, finds an index of a value from this array which - meets the given condition in O(log n) where n is the size of the array.

    - -

    It supports two modes, depending on the nature of the block and they are - exactly the same as in the case of #bsearch method with the only difference - being that this method returns the index of the element instead of the - element itself. For more details consult the documentation for #bsearch.

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -654
    -655
    -656
    -657
    -658
    -659
    -660
    -661
    -662
    -663
    -664
    -665
    -666
    -667
    -668
    -669
    -670
    -671
    -672
    -673
    -674
    -675
    -676
    -677
    -678
    -679
    -680
    -681
    -682
    -683
    -684
    -685
    -686
    -687
    -
    -
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 654
    -
    -def bsearch_index(&block)
    -  return to_enum :bsearch_index unless block
    -
    -  low = 0
    -  high = size
    -  satisfied = false
    -
    -  while low < high
    -    mid = ((low+high)/2).truncate
    -    res = block.call self[mid]
    -
    -    case res
    -    when 0 # find-any mode: Found!
    -      return mid
    -    when Numeric # find-any mode: Continue...
    -      in_lower_half = res < 0
    -    when true # find-min mode
    -      in_lower_half = true
    -      satisfied = true
    -    when false, nil # find-min mode
    -      in_lower_half = false
    -    else
    -      raise TypeError, 'invalid block result (must be numeric, true, false or nil)'
    -    end
    -
    -    if in_lower_half
    -      high = mid
    -    else
    -      low = mid + 1
    -    end
    -  end
    -
    -  satisfied ? low : nil
    -end
    -
    -
    - -
    -

    - - #clearObject - - - - - -

    -
    -

    15.2.12.5.6

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -1105
    -1106
    -1107
    -1108
    -1109
    -
    -
    # File 'src/array.c', line 1105
    -
    -static mrb_value
    -mrb_ary_clear_m(mrb_state *mrb, mrb_value self)
    -{
    -  return mrb_ary_clear(mrb, self);
    -}
    -
    -
    - -
    -

    - - #collect!(&block) ⇒ Object - - - - Also known as: - map! - - - - -

    -
    -

    Calls the given block for each element of +self+ -and pass the respective element. Each element will -be replaced by the resulting values.

    - -

    ISO 15.2.12.5.7

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -
    -
    # File 'mrblib/array.rb', line 46
    -
    -def collect!(&block)
    -  return to_enum :collect! unless block
    -
    -  idx = 0
    -  len = size
    -  while idx < len
    -    self[idx] = block.call self[idx]
    -    idx += 1
    -  end
    -  self
    -end
    -
    -
    - -
    -

    - - #combination(n, &block) ⇒ Object - - - - - -

    -
    -

    call-seq: - ary.combination(n) { |c| block } -> ary - ary.combination(n) -> Enumerator

    - -

    When invoked with a block, yields all combinations of length +n+ of elements -from the array and then returns the array itself.

    - -

    The implementation makes no guarantees about the order in which the -combinations are yielded.

    - -

    If no block is given, an Enumerator is returned instead.

    - -

    Examples:

    - -

    a = [1, 2, 3, 4] - a.combination(1).to_a #=> [[1],[2],[3],[4]] - a.combination(2).to_a #=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]] - a.combination(3).to_a #=> [[1,2,3],[1,2,4],[1,3,4],[2,3,4]] - a.combination(4).to_a #=> [[1,2,3,4]] - a.combination(0).to_a #=> [[]] # one combination of length 0 - a.combination(5).to_a #=> [] # no combinations of length 5

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -897
    -898
    -899
    -900
    -901
    -902
    -903
    -904
    -905
    -906
    -907
    -908
    -909
    -910
    -911
    -912
    -913
    -914
    -915
    -916
    -917
    -918
    -919
    -
    -
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 897
    -
    -def combination(n, &block)
    -  return to_enum(:combination, n) unless block
    -  size = self.size
    -  if n == 0
    -     yield []
    -  elsif n == 1
    -    i = 0
    -    while i<size
    -      yield [self[i]]
    -      i += 1
    -    end
    -  elsif n <= size
    -    i = 0
    -    while i<size
    -      result = [self[i]]
    -      self[i+1..-1].combination(n-1) do |c|
    -        yield result + c
    -      end
    -      i += 1
    -    end
    -  end
    -  self
    -end
    -
    -
    - -
    -

    - - #compactObject - - - - - -

    -
    -

    call-seq: - ary.compact -> new_ary

    - -

    Returns a copy of +self+ with all +nil+ elements removed.

    - -

    [ “a”, nil, “b”, nil, “c”, nil ].compact - #=> [ “a”, “b”, “c” ]

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -265
    -266
    -267
    -268
    -269
    -
    -
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 265
    -
    -def compact
    -  result = self.dup
    -  result.compact!
    -  result
    -end
    -
    -
    - -
    -

    - - #compact!Object - - - - - -

    -
    -

    call-seq: - ary.compact! -> ary or nil

    - -

    Removes +nil+ elements from the array. -Returns +nil+ if no changes were made, otherwise returns -ary.

    - -

    [ “a”, nil, “b”, nil, “c” ].compact! #=> [ “a”, “b”, “c” ] - [ “a”, “b”, “c” ].compact! #=> nil

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -282
    -283
    -284
    -285
    -286
    -287
    -288
    -289
    -
    -
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 282
    -
    -def compact!
    -  result = self.select { |e| !e.nil? }
    -  if result.size == self.size
    -    nil
    -  else
    -    self.replace(result)
    -  end
    -end
    -
    -
    - -
    -

    - - #concatObject - - - - - -

    -
    -

    15.2.12.5.8

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -328
    -329
    -330
    -331
    -332
    -333
    -334
    -335
    -336
    -
    -
    # File 'src/array.c', line 328
    -
    -static mrb_value
    -mrb_ary_concat_m(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value ary;
    -
    -  mrb_get_args(mrb, "A", &ary);
    -  mrb_ary_concat(mrb, self, ary);
    -  return self;
    -}
    -
    -
    - -
    -

    - - #delete(key, &block) ⇒ Object - - - - - -

    -
    -

    Delete element with index +key+

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -184
    -185
    -186
    -187
    -188
    -189
    -190
    -191
    -
    -
    # File 'mrblib/array.rb', line 184
    -
    -def delete(key, &block)
    -  while i = self.index(key)
    -    self.delete_at(i)
    -    ret = key
    -  end
    -  return block.call if ret.nil? && block
    -  ret
    -end
    -
    -
    - -
    -

    - - #delete_atObject - - - - - -

    -
    -

    15.2.12.5.9

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -950
    -951
    -952
    -953
    -954
    -955
    -956
    -957
    -958
    -959
    -960
    -961
    -962
    -963
    -964
    -965
    -966
    -967
    -968
    -969
    -970
    -971
    -972
    -973
    -974
    -975
    -976
    -977
    -978
    -979
    -
    -
    # File 'src/array.c', line 950
    -
    -static mrb_value
    -mrb_ary_delete_at(mrb_state *mrb, mrb_value self)
    -{
    -  struct RArray *a = mrb_ary_ptr(self);
    -  mrb_int   index;
    -  mrb_value val;
    -  mrb_value *ptr;
    -  mrb_int len, alen;
    -
    -  mrb_get_args(mrb, "i", &index);
    -  alen = ARY_LEN(a);
    -  if (index < 0) index += alen;
    -  if (index < 0 || alen <= index) return mrb_nil_value();
    -
    -  ary_modify(mrb, a);
    -  ptr = ARY_PTR(a);
    -  val = ptr[index];
    -
    -  ptr += index;
    -  len = alen - index;
    -  while (--len) {
    -    *ptr = *(ptr+1);
    -    ++ptr;
    -  }
    -  ARY_SET_LEN(a, alen-1);
    -
    -  ary_shrink_capa(mrb, a);
    -
    -  return val;
    -}
    -
    -
    - -
    -

    - - #delete_if(&block) ⇒ Object - - - - - -

    -
    -

    call-seq: - ary.delete_if { |item| block } -> ary - ary.delete_if -> Enumerator

    - -

    Deletes every element of +self+ for which block evaluates to +true+.

    - -

    The array is changed instantly every time the block is called, not after - the iteration is over.

    - -

    See also Array#reject!

    - -

    If no block is given, an Enumerator is returned instead.

    - -
    scores = [ 97, 42, 75 ]
    -scores.delete_if {|score| score < 80 }   #=> [97]
    -
    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -513
    -514
    -515
    -516
    -517
    -518
    -519
    -520
    -521
    -522
    -523
    -524
    -525
    -
    -
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 513
    -
    -def delete_if(&block)
    -  return to_enum :delete_if unless block
    -
    -  idx = 0
    -  while idx < self.size do
    -    if block.call(self[idx])
    -      self.delete_at(idx)
    -    else
    -      idx += 1
    -    end
    -  end
    -  self
    -end
    -
    -
    - -
    -

    - - #difference(*args) ⇒ Object - - - - - -

    -
    -

    call-seq: - ary.difference(other_ary1, other_ary2, …) -> new_ary

    - -

    Returns a new array that is a copy of the original array, removing all -occurrences of any item that also appear in +other_ary+. The order is -preserved from the original array.

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -99
    -100
    -101
    -102
    -103
    -104
    -105
    -
    -
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 99
    -
    -def difference(*args)
    -  ary = self
    -  args.each do |x|
    -    ary = ary - x
    -  end
    -  ary
    -end
    -
    -
    - -
    -

    - - #dig(idx, *args) ⇒ Object - - - - - -

    -
    -

    call-seq: - ary.dig(idx, …) -> object

    - -

    Extracts the nested value specified by the sequence of idx -objects by calling +dig+ at each step, returning +nil+ if any -intermediate step is +nil+.

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -816
    -817
    -818
    -819
    -820
    -821
    -822
    -823
    -
    -
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 816
    -
    -def dig(idx,*args)
    -  n = self[idx]
    -  if args.size > 0
    -    n&.dig(*args)
    -  else
    -    n
    -  end
    -end
    -
    -
    - -
    -

    - - #each_index(&block) ⇒ Object - - - - - -

    -
    -

    Calls the given block for each element of +self+ -and pass the index of the respective element.

    - -

    ISO 15.2.12.5.11

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -
    -
    # File 'mrblib/array.rb', line 29
    -
    -def each_index(&block)
    -  return to_enum :each_index unless block
    -
    -  idx = 0
    -  while idx < length
    -    block.call(idx)
    -    idx += 1
    -  end
    -  self
    -end
    -
    -
    - -
    -

    - - #empty?Boolean - - - - - -

    -
    -

    15.2.12.5.12

    - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Boolean) - - - -
    • - -
    - -
    - - - - - - -
    -
    -
    -
    -1111
    -1112
    -1113
    -1114
    -1115
    -1116
    -1117
    -
    -
    # File 'src/array.c', line 1111
    -
    -static mrb_value
    -mrb_ary_empty_p(mrb_state *mrb, mrb_value self)
    -{
    -  struct RArray *a = mrb_ary_ptr(self);
    -
    -  return mrb_bool_value(ARY_LEN(a) == 0);
    -}
    -
    -
    - -
    -

    - - #eql?(other) ⇒ Boolean - - - - - -

    -
    -

    Returns true if +self+ and other are the same object, - or are both arrays with the same content.

    - -

    ISO 15.2.12.5.34 (x)

    - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Boolean) - - - -
    • - -
    - -
    - - - - - - -
    -
    -
    -
    -133
    -134
    -135
    -136
    -137
    -138
    -139
    -140
    -141
    -142
    -143
    -144
    -
    -
    # File 'mrblib/array.rb', line 133
    -
    -def eql?(other)
    -  other = self.__ary_eq(other)
    -  return false if other == false
    -  return true  if other == true
    -  len = self.size
    -  i = 0
    -  while i < len
    -    return false unless self[i].eql?(other[i])
    -    i += 1
    -  end
    -  return true
    -end
    -
    -
    - -
    -

    - - #fetch(n, ifnone = NONE, &block) ⇒ Object - - - - - -

    -
    -

    call-seq: - ary.fetch(index) -> obj - ary.fetch(index, default) -> obj - ary.fetch(index) { |index| block } -> obj

    - -

    Tries to return the element at position +index+, but throws an IndexError - exception if the referenced +index+ lies outside of the array bounds. This - error can be prevented by supplying a second argument, which will act as a - +default+ value.

    - -

    Alternatively, if a block is given it will only be executed when an - invalid +index+ is referenced.

    - -

    Negative values of +index+ count from the end of the array.

    - -
    a = [ 11, 22, 33, 44 ]
    -a.fetch(1)               #=> 22
    -a.fetch(-1)              #=> 44
    -a.fetch(4, 'cat')        #=> "cat"
    -a.fetch(100) { |i| puts "#{i} is out of bounds" }
    -                         #=> "100 is out of bounds"
    -
    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -327
    -328
    -329
    -330
    -331
    -332
    -333
    -334
    -335
    -336
    -337
    -338
    -339
    -340
    -341
    -342
    -
    -
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 327
    -
    -def fetch(n, ifnone=NONE, &block)
    -  warn "block supersedes default value argument" if !n.nil? && ifnone != NONE && block
    -
    -  idx = n
    -  if idx < 0
    -    idx += size
    -  end
    -  if idx < 0 || size <= idx
    -    return block.call(n) if block
    -    if ifnone == NONE
    -      raise IndexError, "index #{n} outside of array bounds: #{-size}...#{size}"
    -    end
    -    return ifnone
    -  end
    -  self[idx]
    -end
    -
    -
    - -
    -

    - - #fill(arg0 = nil, arg1 = nil, arg2 = nil, &block) ⇒ Object - - - - - -

    -
    -

    call-seq: - ary.fill(obj) -> ary - ary.fill(obj, start [, length]) -> ary - ary.fill(obj, range ) -> ary - ary.fill { |index| block } -> ary - ary.fill(start [, length] ) { |index| block } -> ary - ary.fill(range) { |index| block } -> ary

    - -

    The first three forms set the selected elements of +self+ (which - may be the entire array) to +obj+.

    - -

    A +start+ of +nil+ is equivalent to zero.

    - -

    A +length+ of +nil+ is equivalent to the length of the array.

    - -

    The last three forms fill the array with the value of the given block, - which is passed the absolute index of each element to be filled.

    - -

    Negative values of +start+ count from the end of the array, where +-1+ is - the last element.

    - -
    a = [ "a", "b", "c", "d" ]
    -a.fill("x")              #=> ["x", "x", "x", "x"]
    -a.fill("w", -1)          #=> ["x", "x", "x", "w"]
    -a.fill("z", 2, 2)        #=> ["x", "x", "z", "z"]
    -a.fill("y", 0..1)        #=> ["y", "y", "z", "z"]
    -a.fill { |i| i*i }       #=> [0, 1, 4, 9]
    -a.fill(-2) { |i| i*i*i } #=> [0, 1, 8, 27]
    -a.fill(1, 2) { |i| i+1 } #=> [0, 2, 3, 27]
    -a.fill(0..1) { |i| i+1 } #=> [1, 2, 3, 27]
    -
    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -377
    -378
    -379
    -380
    -381
    -382
    -383
    -384
    -385
    -386
    -387
    -388
    -389
    -390
    -391
    -392
    -393
    -394
    -395
    -396
    -397
    -398
    -399
    -400
    -401
    -402
    -403
    -404
    -405
    -406
    -407
    -408
    -409
    -410
    -411
    -412
    -413
    -414
    -415
    -416
    -417
    -418
    -419
    -420
    -421
    -422
    -423
    -424
    -425
    -426
    -427
    -428
    -429
    -430
    -431
    -432
    -433
    -434
    -435
    -436
    -437
    -438
    -439
    -440
    -441
    -442
    -443
    -
    -
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 377
    -
    -def fill(arg0=nil, arg1=nil, arg2=nil, &block)
    -  if arg0.nil? && arg1.nil? && arg2.nil? && !block
    -    raise ArgumentError, "wrong number of arguments (0 for 1..3)"
    -  end
    -
    -  beg = len = 0
    -  ary = []
    -  if block
    -    if arg0.nil? && arg1.nil? && arg2.nil?
    -      # ary.fill { |index| block }                    -> ary
    -      beg = 0
    -      len = self.size
    -    elsif !arg0.nil? && arg0.kind_of?(Range)
    -      # ary.fill(range) { |index| block }             -> ary
    -      beg = arg0.begin
    -      beg += self.size if beg < 0
    -      len = arg0.end
    -      len += self.size if len < 0
    -      len += 1 unless arg0.exclude_end?
    -    elsif !arg0.nil?
    -      # ary.fill(start [, length] ) { |index| block } -> ary
    -      beg = arg0
    -      beg += self.size if beg < 0
    -      if arg1.nil?
    -        len = self.size
    -      else
    -        len = arg0 + arg1
    -      end
    -    end
    -  else
    -    if !arg0.nil? && arg1.nil? && arg2.nil?
    -      # ary.fill(obj)                                 -> ary
    -      beg = 0
    -      len = self.size
    -    elsif !arg0.nil? && !arg1.nil? && arg1.kind_of?(Range)
    -      # ary.fill(obj, range )                         -> ary
    -      beg = arg1.begin
    -      beg += self.size if beg < 0
    -      len = arg1.end
    -      len += self.size if len < 0
    -      len += 1 unless arg1.exclude_end?
    -    elsif !arg0.nil? && !arg1.nil?
    -      # ary.fill(obj, start [, length])               -> ary
    -      beg = arg1
    -      beg += self.size if beg < 0
    -      if arg2.nil?
    -        len = self.size
    -      else
    -        len = beg + arg2
    -      end
    -    end
    -  end
    -
    -  i = beg
    -  if block
    -    while i < len
    -      self[i] = block.call(i)
    -      i += 1
    -    end
    -  else
    -    while i < len
    -      self[i] = arg0
    -      i += 1
    -    end
    -  end
    -  self
    -end
    -
    -
    - -
    -

    - - #firstObject - - - - - -

    -
    -

    15.2.12.5.13

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -981
    -982
    -983
    -984
    -985
    -986
    -987
    -988
    -989
    -990
    -991
    -992
    -993
    -994
    -995
    -996
    -997
    -998
    -999
    -1000
    -1001
    -
    -
    # File 'src/array.c', line 981
    -
    -static mrb_value
    -mrb_ary_first(mrb_state *mrb, mrb_value self)
    -{
    -  struct RArray *a = mrb_ary_ptr(self);
    -  mrb_int size, alen;
    -
    -  if (mrb_get_argc(mrb) == 0) {
    -    return (ARY_LEN(a) > 0)? ARY_PTR(a)[0]: mrb_nil_value();
    -  }
    -  mrb_get_args(mrb, "|i", &size);
    -  if (size < 0) {
    -    mrb_raise(mrb, E_ARGUMENT_ERROR, "negative array size");
    -  }
    -
    -  alen = ARY_LEN(a);
    -  if (size > alen) size = alen;
    -  if (ARY_SHARED_P(a)) {
    -    return ary_subseq(mrb, a, 0, size);
    -  }
    -  return mrb_ary_new_from_values(mrb, size, ARY_PTR(a));
    -}
    -
    -
    - -
    -

    - - #flatten(depth = nil) ⇒ Object - - - - - -

    -
    -

    call-seq: - ary.flatten -> new_ary - ary.flatten(level) -> new_ary

    - -

    Returns a new array that is a one-dimensional flattening of this -array (recursively). That is, for every element that is an array, -extract its elements into the new array. If the optional -level argument determines the level of recursion to flatten.

    - -

    s = [ 1, 2, 3 ] #=> [1, 2, 3] - t = [ 4, 5, 6, [7, 8] ] #=> [4, 5, 6, [7, 8]] - a = [ s, t, 9, 10 ] #=> [[1, 2, 3], [4, 5, 6, [7, 8]], 9, 10] - a.flatten #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] - a = [ 1, 2, [3, [4, 5] ] ] - a.flatten(1) #=> [1, 2, 3, [4, 5]]

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -211
    -212
    -213
    -214
    -215
    -
    -
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 211
    -
    -def flatten(depth=nil)
    -  res = dup
    -  res.flatten! depth
    -  res
    -end
    -
    -
    - -
    -

    - - #flatten!(depth = nil) ⇒ Object + #-(elem) ⇒ Object @@ -5286,81 +1189,83 @@

    -

    call-seq: - ary.flatten! -> ary or nil - ary.flatten!(level) -> array or nil

    + +

    call-seq: ary - other_ary -> new_ary

    -

    Flattens +self+ in place. -Returns nil if no modifications were made (i.e., -ary contains no subarrays.) If the optional level -argument determines the level of recursion to flatten.

    +

    Array Difference—Returns a new array that is a copy of the original array, removing any items that also appear in other_ary. (If you need set-like behavior, see the library class Set.)

    -

    a = [ 1, 2, [3, [4, 5] ] ] - a.flatten! #=> [1, 2, 3, 4, 5] - a.flatten! #=> nil - a #=> [1, 2, 3, 4, 5] - a = [ 1, 2, [3, [4, 5] ] ] - a.flatten!(1) #=> [1, 2, 3, [4, 5]]

    +

    [ 1, 1, 2, 2, 3, 3, 4, 5 ] - [ 1, 2, 4 ] #=> [ 3, 3, 5 ]

    +

    Raises:

    + + +
    -
    - @@ -5368,140 +1273,131 @@

    -

    - - #index(val = NONE, &block) ⇒ Object +

    - + #__repeated_combination(n, permutation, &block) ⇒ Object -

    -
    -

    call-seq: - ary.index(val) -> int or nil - ary.index {|item| block } -> int or nil

    - -

    Returns the index of the first object in +ary+ such that the object is - == to +obj+.

    -

    If a block is given instead of an argument, returns the index of the - first object for which the block returns +true+. Returns +nil+ if no - match is found.

    - -

    ISO 15.2.12.5.14

    - - -
    -
    -
    - -
    - -

     
     
    -234
    -235
    -236
    -237
    -238
    -239
    -240
    -241
    -242
    -243
    -244
    -245
    -246
    -247
    -248
    -249
    -250
    -251
    -252
    -253
    -254
    +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89
    -
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 234
    +      
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 70
     
    -def flatten!(depth=nil)
    -  modified = false
    -  ar = []
    +def -(elem)
    +  raise TypeError, "can't convert #{elem.class} into Array" unless elem.class == Array
    +
    +  hash = {}
    +  array = []
       idx = 0
    -  len = size
    +  len = elem.size
       while idx < len
    -    e = self[idx]
    -    if e.is_a?(Array) && (depth.nil? || depth > 0)
    -      ar += e.flatten(depth.nil? ? nil : depth - 1)
    -      modified = true
    -    else
    -      ar << e
    -    end
    +    hash[elem[idx]] = true
         idx += 1
       end
    -  if modified
    -    self.replace(ar)
    -  else
    -    nil
    +  idx = 0
    +  len = size
    +  while idx < len
    +    v = self[idx]
    +    array << v unless hash[v]
    +    idx += 1
       end
    +  array
     end
    +
    - - -
     
     
    -1025
    -1026
    -1027
    -1028
    -1029
    -1030
    -1031
    -1032
    -1033
    -1034
    -1035
    -1036
    -1037
    -1038
    -
    -
    # File 'src/array.c', line 1025
    -
    -static mrb_value
    -mrb_ary_index_m(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value obj;
    -  mrb_int i;
    -
    -  mrb_get_args(mrb, "o", &obj);
    -  for (i = 0; i < RARRAY_LEN(self); i++) {
    -    if (mrb_equal(mrb, RARRAY_PTR(self)[i], obj)) {
    -      return mrb_fixnum_value(i);
    -    }
    -  }
    -  return mrb_nil_value();
    -}
    +970 +971 +972 +973 +974 +975 +976 +977 +978 +979 +980 +981 +982 +983 +984 +985 +986 +987 +988 +989 +990 +991 +992 +993 +994 +995 +996 +997 +998 +999 +1000 +1001 +1002 +1003 +1004 +1005 +1006 +1007 +1008 +1009 +1010 +1011 +1012 +1013 +1014 +1015 +1016 +1017 +1018
    -
    - -
    -

    - - #initialize_copyObject - - - - - -

    -
    -

    15.2.12.5.16

    - - -
    -
    -
    - - -
    - - - -
    -
    -
    +      
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 970
     
    -413
    -414
    -415
    -416
    -417
    -418
    -419
    -420
    -421
    -422
    -
    -
    # File 'src/array.c', line 413
    +def __repeated_combination(n, permutation, &block)
    +  n = n.__to_int
    +  case n
    +  when 0
    +    yield []
    +  when 1
    +    i = 0
    +    while i < self.size
    +      yield [self[i]]
    +      i += 1
    +    end
    +  else
    +    if n > 0
    +      v = [0] * n
    +      while true
    +        tmp = [nil] * n
    +        i = 0
    +        while i < n
    +          tmp[i] = self[v[i]]
    +          i += 1
    +        end
     
    -static mrb_value
    -mrb_ary_replace_m(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value other;
    +        yield tmp
     
    -  mrb_get_args(mrb, "A", &other);
    -  mrb_ary_replace(mrb, self, other);
    +        tmp = self.size
    +        i = n - 1
    +        while i >= 0
    +          v[i] += 1
    +          break if v[i] < tmp
    +          i -= 1
    +        end
    +        break unless v[0] < tmp
    +        i = 1
    +        while i < n
    +          unless v[i] < tmp
    +            if permutation
    +              v[i] = 0
    +            else
    +              v[i] = v[i - 1]
    +            end
    +          end
    +          i += 1
    +        end
    +      end
    +    end
    +  end
     
    -  return self;
    -}
    + self +end
    -

    +

    - #insert(idx, *args) ⇒ Object + #bsearch(&block) ⇒ Object @@ -5509,70 +1405,48 @@

    -

    call-seq: - ary.insert(index, obj…) -> ary

    - -

    Inserts the given values before the element with the given +index+.

    - -

    Negative indices count backwards from the end of the array, where +-1+ is - the last element.

    - -
    a = %w{ a b c d }
    -a.insert(2, 99)         #=> ["a", "b", 99, "c", "d"]
    -a.insert(-2, 1, 2, 3)   #=> ["a", "b", 99, "c", 1, 2, 3, "d"]
    -
    + +

    call-seq: ary.bsearch {|x| block } -> elem

    +

    By using binary search, finds a value from this array which meets the given condition in O(log n) where n is the size of the array.

    -
    -
    -
    - +

    You can use this method in two use cases: a find-minimum mode and a find-any mode. In either case, the elements of the array must be monotone (or sorted) with respect to the block.

    -
    - - - - - - -
    -
    +

    In find-minimum mode (this is a good choice for typical use case), the block must return true or false, and there must be an index i (0 <= i <= ary.size) so that:

    +
    • +

      the block returns false for any element whose index is less than i, and

      +
    • +

      the block returns true for any element whose index is greater than or equal to i.

      +
    +

    This method returns the i-th element. If i is equal to ary.size, it returns nil.

    -574 -575 -576 -577 -578
    -
    -
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 574
    +
    ary = [0, 4, 7, 10, 12]
    +ary.bsearch {|x| x >=   4 } #=> 4
    +ary.bsearch {|x| x >=   6 } #=> 7
    +ary.bsearch {|x| x >=  -1 } #=> 0
    +ary.bsearch {|x| x >= 100 } #=> nil
    +
    -def insert(idx, *args) - idx += self.size + 1 if idx < 0 - self[idx, 0] = args - self -end
    -
    -
    - -
    -

    - - #inspectObject - +

    In find-any mode (this behaves like libc’s bsearch(3)), the block must return a number, and there must be two indices i and j (0 <= i <= j <= ary.size) so that:

    +
    • +

      the block returns a positive number for ary if 0 <= k < i,

      +
    • +

      the block returns zero for ary if i <= k < j, and

      +
    • +

      the block returns a negative number for ary if j <= k < ary.size.

      +
    - - Also known as: - to_s - - +

    Under this condition, this method returns any element whose index is within i…j. If i is equal to j (i.e., there is no element that satisfies the block), this method returns nil.

    - -

    -
    -

    Return the contents of this array as a string.

    +
    ary = [0, 4, 7, 10, 12]
    +# try to find v such that 4 <= v < 8
    +ary.bsearch {|x| 1 - (x / 4).truncate } #=> 4 or 7
    +# try to find v such that 8 <= v < 10
    +ary.bsearch {|x| 4 - (x / 2).truncate } #=> nil
    +
    -

    ISO 15.2.12.5.31 (x)

    +

    You must not mix the two modes at a time; the block must always return either true/false, or always return a number. It is undefined which value is actually picked up at each iteration.

    @@ -5580,23 +1454,35 @@

    -
    - +

    + @@ -5604,9 +1490,9 @@

    -

    +

    - #intersection(*args) ⇒ Object + #bsearch_index(&block) ⇒ Object @@ -5614,14 +1500,12 @@

    -

    call-seq: - ary.intersection(other_ary,…) -> new_ary

    + +

    call-seq: ary.bsearch_index {|x| block } -> int or nil

    -

    Set Intersection—Returns a new array containing elements common to -this array and other_arys, removing duplicates. The order is -preserved from the original array.

    +

    By using binary search, finds an index of a value from this array which meets the given condition in O(log n) where n is the size of the array.

    -

    [1, 2, 3].intersection([3, 4, 1], [1, 3, 5]) #=> [1, 3]

    +

    It supports two modes, depending on the nature of the block and they are exactly the same as in the case of #bsearch method with the only difference being that this method returns the index of the element instead of the element itself. For more details consult the documentation for #bsearch.

    @@ -5629,31 +1513,85 @@

    -
    - +

    +

     
     
    -103
    -104
    -105
    +586 +587 +588 +589 +590 +591 +592 +593 +594
    -
    # File 'mrblib/array.rb', line 103
    +      
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 586
    +
    +def bsearch(&block)
    +  return to_enum :bsearch unless block
     
    -def inspect
    -  self._inspect({})
    +  if idx = bsearch_index(&block)
    +    self[idx]
    +  else
    +    nil
    +  end
     end
    @@ -5661,92 +1599,76 @@

    -

    +

    - #join(sep = "") ⇒ String + #collect!(&block) ⇒ Object + Also known as: + map! + +

    -

    Returns a string created by converting each element of the array to -a string, separated by sep.

    - -

    [ “a”, “b”, “c” ].join #=> “abc” - [ “a”, “b”, “c” ].join(“-“) #=> “a-b-c”

    + +

    call-seq: array.collect! {|element| … } -> self array.collect! -> new_enumerator

    +

    Calls the given block for each element of self and pass the respective element. Each element will be replaced by the resulting values.

    -
    -
    -
    - -
    -
    - +

    ISO 15.2.12.5.7

    -

    Returns:

    -
      - -
    • - - - (String) - - - -
    • - -
    - -
    - - +
    -
    -

     
     
    -186
    -187
    -188
    -189
    -190
    -191
    -192
    +608 +609 +610 +611 +612 +613 +614 +615 +616 +617 +618 +619 +620 +621 +622 +623 +624 +625 +626 +627 +628 +629 +630 +631 +632 +633 +634 +635 +636 +637 +638 +639 +640 +641
    -
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 186
    +      
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 608
     
    -def intersection(*args)
    -  ary = self
    -  args.each do |x|
    -    ary = ary & x
    +def bsearch_index(&block)
    +  return to_enum :bsearch_index unless block
    +
    +  low = 0
    +  high = size
    +  satisfied = false
    +
    +  while low < high
    +    mid = ((low+high)/2).truncate
    +    res = block.call self[mid]
    +
    +    case res
    +    when 0 # find-any mode: Found!
    +      return mid
    +    when Numeric # find-any mode: Continue...
    +      in_lower_half = res < 0
    +    when true # find-min mode
    +      in_lower_half = true
    +      satisfied = true
    +    when false, nil # find-min mode
    +      in_lower_half = false
    +    else
    +      raise TypeError, 'invalid block result (must be numeric, true, false or nil)'
    +    end
    +
    +    if in_lower_half
    +      high = mid
    +    else
    +      low = mid + 1
    +    end
       end
    -  ary
    +
    +  satisfied ? low : nil
     end
     
     
    -1208
    -1209
    -1210
    -1211
    -1212
    -1213
    -1214
    -1215
    +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66
    -
    # File 'src/array.c', line 1208
    +      
    # File 'mrblib/array.rb', line 56
     
    -static mrb_value
    -mrb_ary_join_m(mrb_state *mrb, mrb_value ary)
    -{
    -  mrb_value sep = mrb_nil_value();
    +def collect!(&block)
    +  return to_enum :collect! unless block
     
    -  mrb_get_args(mrb, "|S!", &sep);
    -  return mrb_ary_join(mrb, ary, sep);
    -}
    + idx = 0 + len = size + while idx < len + self[idx] = block.call(self[idx]) + idx += 1 + end + self +end
    -

    +

    - #keep_if(&block) ⇒ Object + #combination(n, &block) ⇒ Object @@ -5754,20 +1676,18 @@

    -

    call-seq: - ary.keep_if { |item| block } -> ary - ary.keep_if -> Enumerator

    + +

    call-seq: ary.combination(n) { |c| block } -> ary ary.combination(n) -> Enumerator

    -

    Deletes every element of +self+ for which the given block evaluates to - +false+.

    +

    When invoked with a block, yields all combinations of length n of elements from the array and then returns the array itself.

    -

    See also Array#select!

    +

    The implementation makes no guarantees about the order in which the combinations are yielded.

    If no block is given, an Enumerator is returned instead.

    -
    a = [1, 2, 3, 4, 5]
    -a.keep_if { |val| val > 3 } #=> [4, 5]
    -
    +

    Examples:

    + +

    a = [1, 2, 3, 4] a.combination(1).to_a #=> [[1],,[3],] a.combination(2).to_a #=> [[1,2],,[1,4],,[2,4],] a.combination(3).to_a #=> [[1,2,3],,[1,3,4],] a.combination(4).to_a #=> [[1,2,3,4]] a.combination(0).to_a #=> [[]] # one combination of length 0 a.combination(5).to_a #=> [] # no combinations of length 5

    @@ -5775,42 +1695,62 @@

    -
    - +

    +
     
     
    -735
    -736
    -737
    -738
    -739
    -740
    -741
    -742
    -743
    -744
    -745
    -746
    -747
    -748
    +795 +796 +797 +798 +799 +800 +801 +802 +803 +804 +805 +806 +807 +808 +809 +810 +811 +812 +813 +814 +815 +816 +817 +818
    -
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 735
    -
    -def keep_if(&block)
    -  return to_enum :keep_if unless block
    +      
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 795
     
    -  idx = 0
    -  len = self.size
    -  while idx < self.size do
    -    if block.call(self[idx])
    -      idx += 1
    -    else
    -      self.delete_at(idx)
    +def combination(n, &block)
    +  n = n.__to_int
    +  return to_enum(:combination, n) unless block
    +  size = self.size
    +  if n == 0
    +    yield []
    +  elsif n == 1
    +    i = 0
    +    while i<size
    +      yield [self[i]]
    +      i += 1
    +    end
    +  elsif n <= size
    +    i = 0
    +    while i<size
    +      result = [self[i]]
    +      self[i+1..-1].combination(n-1) do |c|
    +        yield result + c
    +      end
    +      i += 1
         end
       end
       self
    @@ -5821,9 +1761,9 @@ 

    -

    +

    - #lastObject + #delete_if(&block) ⇒ Object @@ -5831,7 +1771,20 @@

    -

    15.2.12.5.18

    + +

    call-seq: ary.delete_if { |item| block } -> ary ary.delete_if -> Enumerator

    + +

    Deletes every element of self for which block evaluates to true.

    + +

    The array is changed instantly every time the block is called, not after the iteration is over.

    + +

    See also Array#reject!

    + +

    If no block is given, an Enumerator is returned instead.

    + +
    scores = [ 97, 42, 75 ]
    +scores.delete_if {|score| score < 80 }   #=> [97]
    +
    @@ -5839,69 +1792,55 @@

    -
    - +

    +
     
     
    -1003
    -1004
    -1005
    -1006
    -1007
    -1008
    -1009
    -1010
    -1011
    -1012
    -1013
    -1014
    -1015
    -1016
    -1017
    -1018
    -1019
    -1020
    -1021
    -1022
    -1023
    +467 +468 +469 +470 +471 +472 +473 +474 +475 +476 +477 +478 +479 +480
    -
    # File 'src/array.c', line 1003
    -
    -static mrb_value
    -mrb_ary_last(mrb_state *mrb, mrb_value self)
    -{
    -  struct RArray *a = mrb_ary_ptr(self);
    -  mrb_int n, size, alen;
    -
    -  n = mrb_get_args(mrb, "|i", &size);
    -  alen = ARY_LEN(a);
    -  if (n == 0) {
    -    return (alen > 0) ? ARY_PTR(a)[alen - 1]: mrb_nil_value();
    -  }
    +      
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 467
     
    -  if (size < 0) {
    -    mrb_raise(mrb, E_ARGUMENT_ERROR, "negative array size");
    -  }
    -  if (size > alen) size = alen;
    -  if (ARY_SHARED_P(a) || size > ARY_DEFAULT_LEN) {
    -    return ary_subseq(mrb, a, alen - size, size);
    -  }
    -  return mrb_ary_new_from_values(mrb, size, ARY_PTR(a) + alen - size);
    -}
    +def delete_if(&block) + return to_enum :delete_if unless block + + result = [] + idx = 0 + len = size + while idx < len + elem = self[idx] + result << elem unless block.call(elem) + idx += 1 + end + + self.replace(result) +end
    -

    +

    - #lengthObject + #difference(*args) ⇒ Object @@ -5909,7 +1848,10 @@

    -

    15.2.12.5.19

    + +

    call-seq: ary.difference(other_ary1, other_ary2, …) -> new_ary

    + +

    Returns a new array that is a copy of the original array, removing all occurrences of any item that also appear in other_ary. The order is preserved from the original array.

    @@ -5917,41 +1859,41 @@

    -
    - +

    +
     
     
    -1079
    -1080
    -1081
    -1082
    -1083
    -1084
    -1085
    +99 +100 +101 +102 +103 +104 +105
    -
    # File 'src/array.c', line 1079
    -
    -static mrb_value
    -mrb_ary_size(mrb_state *mrb, mrb_value self)
    -{
    -  struct RArray *a = mrb_ary_ptr(self);
    +      
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 99
     
    -  return mrb_fixnum_value(ARY_LEN(a));
    -}
    +def difference(*args) + ary = self + args.each do |x| + ary = ary - x + end + ary +end
    -

    +

    - #permutation(n = self.size, &block) ⇒ Object + #dig(idx, *args) ⇒ Object @@ -5959,31 +1901,10 @@

    -

    call-seq: - ary.permutation { |p| block } -> ary - ary.permutation -> Enumerator - ary.permutation(n) { |p| block } -> ary - ary.permutation(n) -> Enumerator

    - -

    When invoked with a block, yield all permutations of length +n+ of the -elements of the array, then return the array itself.

    - -

    If +n+ is not specified, yield all permutations of all elements.

    - -

    The implementation makes no guarantees about the order in which the -permutations are yielded.

    - -

    If no block is given, an Enumerator is returned instead.

    - -

    Examples:

    + +

    call-seq: ary.dig(idx, …) -> object

    -

    a = [1, 2, 3] - a.permutation.to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]] - a.permutation(1).to_a #=> [[1],[2],[3]] - a.permutation(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]] - a.permutation(3).to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]] - a.permutation(0).to_a #=> [[]] # one permutation of length 0 - a.permutation(4).to_a #=> [] # no permutations of length 4

    +

    Extracts the nested value specified by the sequence of idx objects by calling dig at each step, returning nil if any intermediate step is nil.

    @@ -5991,61 +1912,35 @@

    -
    - +

    + @@ -6053,9 +1948,9 @@

    -

    +

    - #popObject + #each(&block) ⇒ Object @@ -6063,7 +1958,12 @@

    -

    15.2.12.5.21

    + +

    call-seq: array.each {|element| … } -> self array.each -> Enumerator

    + +

    Calls the given block for each element of self and pass the respective element.

    + +

    ISO 15.2.12.5.10

    @@ -6071,61 +1971,60 @@

    -
    - +

    +

     
     
    -851
    -852
    -853
    -854
    -855
    -856
    -857
    -858
    -859
    -860
    -861
    -862
    -863
    -864
    -865
    -866
    -867
    -868
    -869
    -870
    -871
    -872
    +712 +713 +714 +715 +716 +717 +718 +719 +720
    -
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 851
    +      
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 712
     
    -def permutation(n=self.size, &block)
    -  return to_enum(:permutation, n) unless block
    -  size = self.size
    -  if n == 0
    -    yield []
    -  elsif 0 < n && n <= size
    -    i = 0
    -    while i<size
    -      result = [self[i]]
    -      if n-1 > 0
    -        ary = self[0...i] + self[i+1..-1]
    -        ary.permutation(n-1) do |c|
    -          yield result + c
    -        end
    -      else
    -        yield result
    -      end
    -      i += 1
    -    end
    +def dig(idx,*args)
    +  idx = idx.__to_int
    +  n = self[idx]
    +  if args.size > 0
    +    n&.dig(*args)
    +  else
    +    n
       end
    -  self
     end
     
     
    -530
    -531
    -532
    -533
    -534
    -535
    -536
    -537
    -538
    -539
    -540
    +15 +16 +17 +18 +19 +20 +21 +22 +23 +24
    -
    # File 'src/array.c', line 530
    -
    -MRB_API mrb_value
    -mrb_ary_pop(mrb_state *mrb, mrb_value ary)
    -{
    -  struct RArray *a = mrb_ary_ptr(ary);
    -  mrb_int len = ARY_LEN(a);
    -
    -  ary_modify_check(mrb, a);
    -  if (len == 0) return mrb_nil_value();
    -  ARY_SET_LEN(a, len-1);
    -  return ARY_PTR(a)[len-1];
    -}
    +
    # File 'mrblib/array.rb', line 15
    +
    +def each(&block)
    +  return to_enum :each unless block
    +
    +  idx = 0
    +  while idx < length
    +    block.call(self[idx])
    +    idx += 1
    +  end
    +  self
    +end
    -

    +

    - #pushObject + #each_index(&block) ⇒ Object - Also known as: - append - -

    -

    15.2.12.5.22

    + +

    call-seq: array.each_index {|index| … } -> self array.each_index -> Enumerator

    + +

    Calls the given block for each element of self and pass the index of the respective element.

    + +

    ISO 15.2.12.5.11

    @@ -6133,69 +2032,47 @@

    -
    - +

    +
     
     
    -508
    -509
    -510
    -511
    -512
    -513
    -514
    -515
    -516
    -517
    -518
    -519
    -520
    -521
    -522
    -523
    -524
    -525
    -526
    -527
    -528
    +35 +36 +37 +38 +39 +40 +41 +42 +43 +44
    -
    # File 'src/array.c', line 508
    -
    -static mrb_value
    -mrb_ary_push_m(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value *argv;
    -  mrb_int len, len2, alen;
    -  struct RArray *a;
    -
    -  mrb_get_args(mrb, "*!", &argv, &alen);
    -  a = mrb_ary_ptr(self);
    -  ary_modify(mrb, a);
    -  len = ARY_LEN(a);
    -  len2 = len + alen;
    -  if (ARY_CAPA(a) < len2) {
    -    ary_expand_capa(mrb, a, len2);
    -  }
    -  array_copy(ARY_PTR(a)+len, argv, alen);
    -  ARY_SET_LEN(a, len2);
    -  mrb_write_barrier(mrb, (struct RBasic*)a);
    +      
    # File 'mrblib/array.rb', line 35
    +
    +def each_index(&block)
    +  return to_enum :each_index unless block
     
    -  return self;
    -}
    + idx = 0 + while idx < length + block.call(idx) + idx += 1 + end + self +end
    -

    +

    - #rassoc(obj) ⇒ Array? + #fetch(n, ifnone = NONE, &block) ⇒ Object @@ -6203,103 +2080,82 @@

    -

    Searches through the array whose elements are also arrays. Compares -obj with the second element of each contained array using -==. Returns the first contained array that matches. See -also Array#assoc.

    + +

    call-seq: ary.fetch(index) -> obj ary.fetch(index, default) -> obj ary.fetch(index) { |index| block } -> obj

    -

    a = [ [ 1, “one”], [2, “two”], [3, “three”], [“ii”, “two”] ] - a.rassoc(“two”) #=> [2, “two”] - a.rassoc(“four”) #=> nil

    +

    Tries to return the element at position index, but throws an IndexError exception if the referenced index lies outside of the array bounds. This error can be prevented by supplying a second argument, which will act as a default value.

    +

    Alternatively, if a block is given it will only be executed when an invalid index is referenced.

    -
    -
    -
    - -
    -
    - +

    Negative values of index count from the end of the array.

    + +
    a = [ 11, 22, 33, 44 ]
    +a.fetch(1)               #=> 22
    +a.fetch(-1)              #=> 44
    +a.fetch(4, 'cat')        #=> "cat"
    +a.fetch(100) { |i| puts "#{i} is out of bounds" }
    +                         #=> "100 is out of bounds"
    +
    -

    Returns:

    -
      - -
    • - - - (Array, nil) - - - -
    • - -
    - -
    - - +
    -
    -
     
     
    -58
    -59
    -60
    -61
    -62
    -63
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343 +344 +345 +346 +347 +348
    -
    # File 'mrbgems/mruby-array-ext/src/array.c', line 58
    -
    -static mrb_value
    -mrb_ary_rassoc(mrb_state *mrb, mrb_value ary)
    -{
    -  mrb_int i;
    -  mrb_value v, value;
    -
    -  mrb_get_args(mrb, "o", &value);
    -
    -  for (i = 0; i < RARRAY_LEN(ary); ++i) {
    -    v = RARRAY_PTR(ary)[i];
    -    if (mrb_array_p(v) &&
    -        RARRAY_LEN(v) > 1 &&
    -        mrb_equal(mrb, RARRAY_PTR(v)[1], value))
    -      return v;
    -  }
    -  return mrb_nil_value();
    -}
    +
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 333
    +
    +def fetch(n, ifnone=NONE, &block)
    +  #warn "block supersedes default value argument" if !n.nil? && ifnone != NONE && block
    +
    +  idx = n.__to_int
    +  if idx < 0
    +    idx += size
    +  end
    +  if idx < 0 || size <= idx
    +    return block.call(n) if block
    +    if NONE.equal?(ifnone)
    +      raise IndexError, "index #{n} outside of array bounds: #{-size}...#{size}"
    +    end
    +    return ifnone
    +  end
    +  self[idx]
    +end
    -

    +

    - #reject!(&block) ⇒ Object + #fetch_values(*idx, &block) ⇒ Object @@ -6307,19 +2163,14 @@

    -

    call-seq: - ary.reject! { |item| block } -> ary or nil - ary.reject! -> Enumerator

    - -

    Equivalent to Array#delete_if, deleting elements from +self+ for which the - block evaluates to +true+, but returns +nil+ if no changes were made.

    + +

    call-seq: ary.fetch_values(idx, …) -> array ary.fetch_values(idx, …) { |i| block } -> array

    -

    The array is changed instantly every time the block is called, not after - the iteration is over.

    +

    Returns an array containing the values associated with the given indexes. but also raises IndexError when one of indexes can’t be found. Also see Array#values_at and Array#fetch.

    -

    See also Enumerable#reject and Array#delete_if.

    +

    a = [“cat”, “dog”, “cow”]

    -

    If no block is given, an Enumerator is returned instead.

    +

    a.fetch_values(2, 0) #=> [“cow”, “cat”] a.fetch_values(2, 5) # raises KeyError a.fetch_values(2, 5) {|i| “BIRD” } #=> [“cow”, “BIRD”]

    @@ -6327,52 +2178,26 @@

    -
    - +

    + @@ -6381,9 +2206,9 @@

    -

    +

    - #replaceObject + #fill(arg0 = nil, arg1 = nil, arg2 = nil, &block) ⇒ Object @@ -6391,7 +2216,29 @@

    -

    15.2.12.5.23

    + +

    call-seq: ary.fill(obj) -> ary ary.fill(obj, start [, length]) -> ary ary.fill(obj, range ) -> ary ary.fill { |index| block } -> ary ary.fill(start [, length] ) { |index| block } -> ary ary.fill(range) { |index| block } -> ary

    + +

    The first three forms set the selected elements of self (which may be the entire array) to obj.

    + +

    A start of nil is equivalent to zero.

    + +

    A length of nil is equivalent to the length of the array.

    + +

    The last three forms fill the array with the value of the given block, which is passed the absolute index of each element to be filled.

    + +

    Negative values of start count from the end of the array, where -1 is the last element.

    + +
    a = [ "a", "b", "c", "d" ]
    +a.fill("x")              #=> ["x", "x", "x", "x"]
    +a.fill("w", -1)          #=> ["x", "x", "x", "w"]
    +a.fill("z", 2, 2)        #=> ["x", "x", "z", "z"]
    +a.fill("y", 0..1)        #=> ["y", "y", "z", "z"]
    +a.fill { |i| i*i }       #=> [0, 1, 4, 9]
    +a.fill(-2) { |i| i*i*i } #=> [0, 1, 8, 27]
    +a.fill(1, 2) { |i| i+1 } #=> [0, 2, 3, 27]
    +a.fill(0..1) { |i| i+1 } #=> [1, 2, 3, 27]
    +
    @@ -6399,14 +2246,44 @@

    -
    - +

    +

     
     
    -542
    -543
    -544
    -545
    -546
    -547
    -548
    -549
    -550
    -551
    -552
    -553
    -554
    -555
    -556
    -557
    -558
    -559
    +892 +893 +894 +895 +896
    -
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 542
    -
    -def reject!(&block)
    -  return to_enum :reject! unless block
    +      
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 892
     
    -  len = self.size
    -  idx = 0
    -  while idx < self.size do
    -    if block.call(self[idx])
    -      self.delete_at(idx)
    -    else
    -      idx += 1
    -    end
    -  end
    -  if self.size == len
    -    nil
    -  else
    -    self
    +def fetch_values(*idx, &block)
    +  idx.map do |i|
    +    self.fetch(i, &block)
       end
     end
     
     
    +383
    +384
    +385
    +386
    +387
    +388
    +389
    +390
    +391
    +392
    +393
    +394
    +395
    +396
    +397
    +398
    +399
    +400
    +401
    +402
    +403
    +404
    +405
    +406
    +407
    +408
    +409
    +410
    +411
    +412
     413
     414
     415
    @@ -6416,30 +2293,112 @@ 

    419 420 421 -422

    +422 +423 +424 +425 +426 +427 +428 +429 +430 +431 +432 +433 +434 +435 +436 +437 +438 +439 +440 +441 +442 +443 +444 +445 +446 +447 +448
    -
    # File 'src/array.c', line 413
    +      
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 383
     
    -static mrb_value
    -mrb_ary_replace_m(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value other;
    +def fill(arg0=nil, arg1=nil, arg2=nil, &block)
    +  if arg0.nil? && arg1.nil? && arg2.nil? && !block
    +    raise ArgumentError, "wrong number of arguments (given 0, expected 1..3)"
    +  end
     
    -  mrb_get_args(mrb, "A", &other);
    -  mrb_ary_replace(mrb, self, other);
    +  beg = len = 0
    +  if block
    +    if arg0.nil? && arg1.nil? && arg2.nil?
    +      # ary.fill { |index| block }                    -> ary
    +      beg = 0
    +      len = self.size
    +    elsif !arg0.nil? && arg0.kind_of?(Range)
    +      # ary.fill(range) { |index| block }             -> ary
    +      beg = arg0.begin
    +      beg += self.size if beg < 0
    +      len = arg0.end
    +      len += self.size if len < 0
    +      len += 1 unless arg0.exclude_end?
    +    elsif !arg0.nil?
    +      # ary.fill(start [, length] ) { |index| block } -> ary
    +      beg = arg0.__to_int
    +      beg += self.size if beg < 0
    +      if arg1.nil?
    +        len = self.size
    +      else
    +        len = beg + arg1.__to_int
    +      end
    +    end
    +  else
    +    if !arg0.nil? && arg1.nil? && arg2.nil?
    +      # ary.fill(obj)                                 -> ary
    +      beg = 0
    +      len = self.size
    +    elsif !arg0.nil? && !arg1.nil? && arg1.kind_of?(Range)
    +      # ary.fill(obj, range )                         -> ary
    +      beg = arg1.begin
    +      beg += self.size if beg < 0
    +      len = arg1.end
    +      len += self.size if len < 0
    +      len += 1 unless arg1.exclude_end?
    +    elsif !arg0.nil? && !arg1.nil?
    +      # ary.fill(obj, start [, length])               -> ary
    +      beg = arg1.__to_int
    +      beg += self.size if beg < 0
    +      if arg2.nil?
    +        len = self.size
    +      else
    +        len = beg + arg2.__to_int
    +      end
    +    end
    +  end
     
    -  return self;
    -}
    + i = beg + if block + while i < len + self[i] = block.call(i) + i += 1 + end + else + while i < len + self[i] = arg0 + i += 1 + end + end + self +end
    -

    +

    - #reverseObject + #flatten(depth = nil) ⇒ Object @@ -6447,7 +2406,12 @@

    -

    15.2.12.5.24

    + +

    call-seq: ary.flatten -> new_ary ary.flatten(level) -> new_ary

    + +

    Returns a new array that is a one-dimensional flattening of this array (recursively). That is, for every element that is an array, extract its elements into the new array. If the optional level argument determines the level of recursion to flatten.

    + +

    s = [ 1, 2, 3 ] #=> [1, 2, 3] t = [ 4, 5, 6, [7, 8] ] #=> [4, 5, 6, [7, 8]] a = [ s, t, 9, 10 ] #=> [[1, 2, 3], [4, 5, 6, [7, 8]], 9, 10] a.flatten #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] a = [ 1, 2, [3, [4, 5] ] ] a.flatten(1) #=> [1, 2, 3, [4, 5]]

    @@ -6455,65 +2419,37 @@

    -
    - +

    +
     
     
    -474
    -475
    -476
    -477
    -478
    -479
    -480
    -481
    -482
    -483
    -484
    -485
    -486
    -487
    -488
    -489
    -490
    -491
    -492
    +252 +253 +254 +255 +256
    -
    # File 'src/array.c', line 474
    -
    -static mrb_value
    -mrb_ary_reverse(mrb_state *mrb, mrb_value self)
    -{
    -  struct RArray *a = mrb_ary_ptr(self), *b = ary_new_capa(mrb, ARY_LEN(a));
    -  mrb_int len = ARY_LEN(a);
    -
    -  if (len > 0) {
    -    mrb_value *p1, *p2, *e;
    -
    -    p1 = ARY_PTR(a);
    -    e  = p1 + len;
    -    p2 = ARY_PTR(b) + len - 1;
    -    while (p1 < e) {
    -      *p2-- = *p1++;
    -    }
    -    ARY_SET_LEN(b, len);
    -  }
    -  return mrb_obj_value(b);
    -}
    +
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 252
    +
    +def flatten(depth=nil)
    +  res = Array.new(self)
    +  res.flatten! depth
    +  res
    +end
    -

    +

    - #reverse!Object + #flatten!(depth = nil) ⇒ Object @@ -6521,7 +2457,12 @@

    -

    15.2.12.5.25

    + +

    call-seq: ary.flatten! -> ary or nil ary.flatten!(level) -> array or nil

    + +

    Flattens self in place. Returns nil if no modifications were made (i.e., ary contains no subarrays.) If the optional level argument determines the level of recursion to flatten.

    + +

    a = [ 1, 2, [3, [4, 5] ] ] a.flatten! #=> [1, 2, 3, 4, 5] a.flatten! #=> nil a #=> [1, 2, 3, 4, 5] a = [ 1, 2, [3, [4, 5] ] ] a.flatten!(1) #=> [1, 2, 3, [4, 5]]

    @@ -6529,69 +2470,69 @@

    -
    - +

    +
     
     
    -452
    -453
    -454
    -455
    -456
    -457
    -458
    -459
    -460
    -461
    -462
    -463
    -464
    -465
    -466
    -467
    -468
    -469
    -470
    -471
    -472
    +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295
    -
    # File 'src/array.c', line 452
    -
    -static mrb_value
    -mrb_ary_reverse_bang(mrb_state *mrb, mrb_value self)
    -{
    -  struct RArray *a = mrb_ary_ptr(self);
    -  mrb_int len = ARY_LEN(a);
    -
    -  if (len > 1) {
    -    mrb_value *p1, *p2;
    -
    -    ary_modify(mrb, a);
    -    p1 = ARY_PTR(a);
    -    p2 = p1 + len - 1;
    -
    -    while (p1 < p2) {
    -      mrb_value tmp = *p1;
    -      *p1++ = *p2;
    -      *p2-- = tmp;
    -    }
    -  }
    -  return self;
    -}
    +
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 275
    +
    +def flatten!(depth=nil)
    +  modified = false
    +  ar = []
    +  idx = 0
    +  len = size
    +  while idx < len
    +    e = self[idx]
    +    if e.is_a?(Array) && (depth.nil? || depth > 0)
    +      ar += e.flatten(depth.nil? ? nil : depth - 1)
    +      modified = true
    +    else
    +      ar << e
    +    end
    +    idx += 1
    +  end
    +  if modified
    +    self.replace(ar)
    +  else
    +    nil
    +  end
    +end
    -

    +

    - #reverse_each(&block) ⇒ Object + #insert(idx, *args) ⇒ Object @@ -6599,7 +2540,17 @@

    -

    for efficiency

    + +

    call-seq: ary.insert(index, obj…) -> ary

    + +

    Inserts the given values before the element with the given index.

    + +

    Negative indices count backwards from the end of the array, where -1 is the last element.

    + +
    a = %w{ a b c d }
    +a.insert(2, 99)         #=> ["a", "b", 99, "c", "d"]
    +a.insert(-2, 1, 2, 3)   #=> ["a", "b", 99, "c", 1, 2, 3, "d"]
    +
    @@ -6607,36 +2558,28 @@

    -
    - +

    + @@ -6645,9 +2588,9 @@

    -

    +

    - #rindexObject + #intersect?(ary) ⇒ Boolean @@ -6655,69 +2598,122 @@

    -

    15.2.12.5.26

    + +

    call-seq: ary.intersect?(other_ary) -> true or false

    + +

    Returns true if the array and other_ary have at least one element in common, otherwise returns false.

    + +

    a = [ 1, 2, 3 ] b = [ 3, 4, 5 ] c = [ 5, 6, 7 ] a.intersect?(b) #=> true a.intersect?© #=> false

    +

    Returns:

    +
      + +
    • + + + (Boolean) + + + +
    • + +
    +

    Raises:

    + + +
    -
    -

     
     
    -292
    -293
    -294
    -295
    -296
    -297
    -298
    -299
    -300
    -301
    +527 +528 +529 +530 +531 +532
    -
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 292
    -
    -def reverse_each(&block)
    -  return to_enum :reverse_each unless block
    +      
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 527
     
    -  i = self.size - 1
    -  while i>=0
    -    block.call(self[i])
    -    i -= 1
    -  end
    +def insert(idx, *args)
    +  idx = idx.__to_int
    +  idx += self.size + 1 if idx < 0
    +  self[idx, 0] = args
       self
     end
     
     
    -1040
    -1041
    -1042
    -1043
    -1044
    -1045
    -1046
    -1047
    -1048
    -1049
    -1050
    -1051
    -1052
    -1053
    -1054
    -1055
    -1056
    +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233
    -
    # File 'src/array.c', line 1040
    -
    -static mrb_value
    -mrb_ary_rindex_m(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value obj;
    -  mrb_int i, len;
    -
    -  mrb_get_args(mrb, "o", &obj);
    -  for (i = RARRAY_LEN(self) - 1; i >= 0; i--) {
    -    if (mrb_equal(mrb, RARRAY_PTR(self)[i], obj)) {
    -      return mrb_fixnum_value(i);
    -    }
    -    if (i > (len = RARRAY_LEN(self))) {
    -      i = len;
    -    }
    -  }
    -  return mrb_nil_value();
    -}
    +
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 206
    +
    +def intersect?(ary)
    +  raise TypeError, "cannot convert #{ary.class} into Array" unless ary.class == Array
    +
    +  hash = {}
    +  if self.length > ary.length
    +    shorter = ary
    +    longer = self
    +  else
    +    shorter = self
    +    longer = ary
    +  end
    +  idx = 0
    +  len = shorter.size
    +  while idx < len
    +    hash[shorter[idx]] = true
    +    idx += 1
    +  end
    +  idx = 0
    +  len = size
    +  while idx < len
    +    v = longer[idx]
    +    if hash[v]
    +      return true
    +    end
    +    idx += 1
    +  end
    +  false
    +end
    -

    +

    - #rotate(count = 1) ⇒ Object + #intersection(*args) ⇒ Object @@ -6725,21 +2721,12 @@

    -

    call-seq: - ary.rotate(count=1) -> new_ary

    - -

    Returns a new array by rotating +self+ so that the element at +count+ is - the first element of the new array.

    + +

    call-seq: ary.intersection(other_ary,…) -> new_ary

    -

    If +count+ is negative then it rotates in the opposite direction, starting - from the end of +self+ where +-1+ is the last element.

    +

    Set Intersection—Returns a new array containing elements common to this array and other_arys, removing duplicates. The order is preserved from the original array.

    -
    a = [ "a", "b", "c", "d" ]
    -a.rotate         #=> ["b", "c", "d", "a"]
    -a                #=> ["a", "b", "c", "d"]
    -a.rotate(2)      #=> ["c", "d", "a", "b"]
    -a.rotate(-3)     #=> ["b", "c", "d", "a"]
    -
    +

    [1, 2, 3].intersection([3, 4, 1], [1, 3, 5]) #=> [1, 3]

    @@ -6747,43 +2734,29 @@

    -
    - +

    + @@ -7695,18 +3521,24 @@

    -

    +

    - #sort!(&block) ⇒ Object + #to_aObject + Also known as: + entries + +

    -

    Sort all elements and replace +self+ with these -elements.

    + +

    call-seq: array.to_a -> self

    + +

    Returns self, no need to convert.

    @@ -7714,144 +3546,22 @@

    -
    - +

    +

     
     
    -461
    -462
    -463
    -464
    -465
    -466
    -467
    -468
    -469
    -470
    -471
    -472
    -473
    -474
    +186 +187 +188 +189 +190 +191 +192
    -
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 461
    +      
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 186
     
    -def rotate(count=1)
    -  ary = []
    -  len = self.length
    -
    -  if len > 0
    -    idx = (count < 0) ? (len - (~count % len) - 1) : (count % len) # rotate count
    -    len.times do
    -      ary << self[idx]
    -      idx += 1
    -      idx = 0 if idx > len-1
    -    end
    +def intersection(*args)
    +  ary = self
    +  args.each do |x|
    +    ary = ary & x
       end
       ary
     end
    @@ -6793,9 +2766,9 @@

    -

    +

    - #rotate!(count = 1) ⇒ Object + #keep_if(&block) ⇒ Object @@ -6803,20 +2776,17 @@

    -

    call-seq: - ary.rotate!(count=1) -> ary

    + +

    call-seq: ary.keep_if { |item| block } -> ary ary.keep_if -> Enumerator

    -

    Rotates +self+ in place so that the element at +count+ comes first, and - returns +self+.

    +

    Deletes every element of self for which the given block evaluates to false.

    -

    If +count+ is negative then it rotates in the opposite direction, starting - from the end of the array where +-1+ is the last element.

    +

    See also Array#select!

    -
    a = [ "a", "b", "c", "d" ]
    -a.rotate!        #=> ["b", "c", "d", "a"]
    -a                #=> ["b", "c", "d", "a"]
    -a.rotate!(2)     #=> ["d", "a", "b", "c"]
    -a.rotate!(-3)    #=> ["a", "b", "c", "d"]
    +

    If no block is given, an Enumerator is returned instead.

    + +
    a = [1, 2, 3, 4, 5]
    +a.keep_if { |val| val > 3 } #=> [4, 5]
     
    @@ -6825,23 +2795,45 @@

    -
    - +

    + @@ -6849,78 +2841,94 @@

    -

    +

    - #select!(&block) ⇒ Object + #permutation(n = self.size, &block) ⇒ Object - Also known as: - filter! - -

    -

    call-seq: - ary.select! {|item| block } -> ary or nil - ary.select! -> Enumerator

    + +

    call-seq: ary.permutation { |p| block } -> ary ary.permutation -> Enumerator ary.permutation(n) { |p| block } -> ary ary.permutation(n) -> Enumerator

    -

    Invokes the given block passing in successive elements from +self+, - deleting elements for which the block returns a +false+ value.

    +

    When invoked with a block, yield all permutations of length n of the elements of the array, then return the array itself.

    -

    If changes were made, it will return +self+, otherwise it returns +nil+.

    +

    If n is not specified, yield all permutations of all elements.

    -

    See also Array#keep_if

    +

    The implementation makes no guarantees about the order in which the permutations are yielded.

    If no block is given, an Enumerator is returned instead.

    +

    Examples:

    + +

    a = [1, 2, 3] a.permutation.to_a #=> [[1,2,3],,[2,1,3],,[3,1,2],] a.permutation(1).to_a #=> [[1],,[3]] a.permutation(2).to_a #=> [[1,2],,[2,1],,[3,1],] a.permutation(3).to_a #=> [[1,2,3],,[2,1,3],,[3,1,2],] a.permutation(0).to_a #=> [[]] # one permutation of length 0 a.permutation(4).to_a #=> [] # no permutations of length 4

    +
    -
    - +
    +

     
     
    -492
    -493
    -494
    +658 +659 +660 +661 +662 +663 +664 +665 +666 +667 +668 +669 +670 +671
    -
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 492
    +      
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 658
    +
    +def keep_if(&block)
    +  return to_enum :keep_if unless block
    +
    +  result = []
    +  idx = 0
    +  len = size
    +  while idx < len
    +    elem = self[idx]
    +    result << elem if block.call(elem)
    +    idx += 1
    +  end
     
    -def rotate!(count=1)
    -  self.replace(self.rotate(count))
    +  self.replace(result)
     end
    @@ -6928,9 +2936,9 @@

    -

    +

    - #shiftObject + #product(*arys, &block) ⇒ Object @@ -6938,7 +2946,8 @@

    -

    15.2.12.5.27

    + +

    call-seq: ary.product(arys) -> array ary.product(arys) { |item| … } -> self

    @@ -6946,93 +2955,111 @@

    -
    - +

    +

     
     
    +748
    +749
    +750
    +751
    +752
    +753
    +754
    +755
    +756
    +757
    +758
    +759
    +760
    +761
    +762
    +763
     764
     765
     766
     767
     768
     769
    -770
    -771
    -772
    -773
    -774
    -775
    -776
    -777
    +770
    -
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 764
    -
    -def select!(&block)
    -  return to_enum :select! unless block
    +      
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 748
     
    -  result = []
    -  idx = 0
    -  len = size
    -  while idx < len
    -    elem = self[idx]
    -    result << elem if block.call(elem)
    -    idx += 1
    +def permutation(n=self.size, &block)
    +  n = n.__to_int
    +  return to_enum(:permutation, n) unless block
    +  size = self.size
    +  if n == 0
    +    yield []
    +  elsif 0 < n && n <= size
    +    i = 0
    +    while i<size
    +      result = [self[i]]
    +      if n-1 > 0
    +        ary = self[0...i] + self[i+1..-1]
    +        ary.permutation(n-1) do |c|
    +          yield result + c
    +        end
    +      else
    +        yield result
    +      end
    +      i += 1
    +    end
       end
    -  return nil if len == result.size
    -  self.replace(result)
    +  self
     end
     
     
    -544
    -545
    -546
    -547
    -548
    -549
    -550
    -551
    -552
    -553
    -554
    -555
    -556
    -557
    -558
    -559
    -560
    -561
    -562
    -563
    -564
    -565
    -566
    -567
    -568
    -569
    -570
    -571
    -572
    -573
    -574
    -575
    -576
    +902 +903 +904 +905 +906 +907 +908 +909 +910 +911 +912 +913 +914 +915 +916 +917 +918 +919 +920 +921 +922 +923 +924 +925 +926 +927 +928 +929 +930 +931 +932 +933 +934 +935 +936 +937 +938 +939 +940 +941 +942 +943
    -
    # File 'src/array.c', line 544
    -
    -MRB_API mrb_value
    -mrb_ary_shift(mrb_state *mrb, mrb_value self)
    -{
    -  struct RArray *a = mrb_ary_ptr(self);
    -  mrb_int len = ARY_LEN(a);
    -  mrb_value val;
    -
    -  ary_modify_check(mrb, a);
    -  if (len == 0) return mrb_nil_value();
    -  if (ARY_SHARED_P(a)) {
    -  L_SHIFT:
    -    val = a->as.heap.ptr[0];
    -    a->as.heap.ptr++;
    -    a->as.heap.len--;
    -    return val;
    -  }
    -  if (len > ARY_SHIFT_SHARED_MIN) {
    -    ary_make_shared(mrb, a);
    -    goto L_SHIFT;
    -  }
    -  else {
    -    mrb_value *ptr = ARY_PTR(a);
    -    mrb_int size = len;
    -
    -    val = *ptr;
    -    while (--size) {
    -      *ptr = *(ptr+1);
    -      ++ptr;
    -    }
    -    ARY_SET_LEN(a, len-1);
    -  }
    -  return val;
    -}
    +
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 902
    +
    +def product(*arys, &block)
    +  size = arys.size
    +  i = size
    +  while i > 0
    +    i -= 1
    +    unless arys[i].kind_of?(Array)
    +      raise TypeError, "no implicit conversion into Array"
    +    end
    +  end
    +
    +  i = size
    +  total = self.size
    +  total *= arys[i -= 1].size while i > 0
    +
    +  if block
    +    result = self
    +    list = ->(*, e) { block.call e }
    +    class << list; alias []= call; end
    +  else
    +    result = [nil] * total
    +    list = result
    +  end
    +
    +  i = 0
    +  while i < total
    +    group = [nil] * (size + 1)
    +    j = size
    +    n = i
    +    while j > 0
    +      j -= 1
    +      a = arys[j]
    +      b = a.size
    +      group[j + 1] = a[n % b]
    +      n /= b
    +    end
    +    group[0] = self[n]
    +    list[i] = group
    +    i += 1
    +  end
    +
    +  result
    +end
    -

    +

    - #sizeObject + #reject!(&block) ⇒ Object @@ -7040,7 +3067,16 @@

    -

    15.2.12.5.28

    + +

    call-seq: ary.reject! { |item| block } -> ary or nil ary.reject! -> Enumerator

    + +

    Equivalent to Array#delete_if, deleting elements from self for which the block evaluates to true, but returns nil if no changes were made.

    + +

    The array is changed instantly every time the block is called, not after the iteration is over.

    + +

    See also Enumerable#reject and Array#delete_if.

    + +

    If no block is given, an Enumerator is returned instead.

    @@ -7048,134 +3084,83 @@

    -
    - +

    +
     
     
    -1079
    -1080
    -1081
    -1082
    -1083
    -1084
    -1085
    +497 +498 +499 +500 +501 +502 +503 +504 +505 +506 +507 +508 +509 +510 +511 +512
    -
    # File 'src/array.c', line 1079
    +      
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 497
    +
    +def reject!(&block)
    +  return to_enum :reject! unless block
    +
    +  result = []
    +  idx = 0
    +  len = size
    +  while idx < len
    +    elem = self[idx]
    +    result << elem unless block.call(elem)
    +    idx += 1
    +  end
     
    -static mrb_value
    -mrb_ary_size(mrb_state *mrb, mrb_value self)
    -{
    -  struct RArray *a = mrb_ary_ptr(self);
    +  return nil if len == result.size
     
    -  return mrb_fixnum_value(ARY_LEN(a));
    -}
    + self.replace(result) +end
    -

    - - - #[](index) ⇒ Object? - - #[](start, length) ⇒ Array? - - #[](range) ⇒ Array? - - #slice(index) ⇒ Object? - - #slice(start, length) ⇒ Array? - - #slice(range) ⇒ Array? - - - - - - -

    -
    -

    Element Reference — Returns the element at +index+, or returns a -subarray starting at the +start+ index and continuing for +length+ -elements, or returns a subarray specified by +range+ of indices.

    - -

    Negative indices count backward from the end of the array (-1 is the last -element). For +start+ and +range+ cases the starting index is just before -an element. Additionally, an empty array is returned when the starting -index for an element range is at the end of the array.

    - -

    Returns +nil+ if the index (or starting index) are out of range.

    - -

    a = [ “a”, “b”, “c”, “d”, “e” ] -a[1] => “b” -a[1,2] => [“b”, “c”] -a[1..-2] => [“b”, “c”, “d”]

    - - -
    -
    -
    - -

    Overloads:

    -
      - - -
    • - #[](index) ⇒ Object? -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Object, nil) - - - -
      • +

        + + #repeated_combination(n, &block) ⇒ Object -

      -
      - + -
    • - - -
    • - #[](start, length) ⇒ Array? -
      + +

    +

    call-seq: ary.repeated_combination(n) { |combination| … } -> self ary.repeated_combination(n) -> enumerator

    + +

    A combination method that contains the same elements.

    -

    Returns:

    -
    - + - - - -
  • - #[](range) ⇒ Array? -
    -
    - + + + + + +
    +
     
     
    -  
    +951
    +952
    +953
    +954
    +955
    +
    +
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 951
    +
    +def repeated_combination(n, &block)
    +  raise TypeError, "no implicit conversion into Integer" unless 0 <=> n
    +  return to_enum(:repeated_combination, n) unless block
    +  __repeated_combination(n, false, &block)
    +end
    +
    -
    - -

    Returns:

    -
      + +
      +

      -
    • - - - (Array, nil) - - - -
    • + #repeated_permutation(n, &block) ⇒ Object -

    -
    - + -
  • - - -
  • - #slice(index) ⇒ Object? -
    + +
    +

    call-seq: ary.repeated_permutation(n) { |permutation| … } -> self ary.repeated_permutation(n) -> enumerator

    + +

    A permutation method that contains the same elements.

    -

    Returns:

    -
      +

      Raises:

      +
      • - (Object, nil) + (TypeError) @@ -7245,429 +3230,270 @@

      -
    - +
    -
  • - - -
  • - #slice(start, length) ⇒ Array? -
    -
    - + + + + + +
    +
     
     
    -  
    +963
    +964
    +965
    +966
    +967
    +968
    +
    +
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 963
    +
    +def repeated_permutation(n, &block)
    +  n = n.__to_int
    +  raise TypeError, "no implicit conversion into Integer" unless 0 <=> n
    +  return to_enum(:repeated_permutation, n) unless block
    +  __repeated_combination(n, true, &block)
    +end
    +
    -
    - -

    Returns:

    -
      + +
      +

      -
    • - - - (Array, nil) - - - -
    • + #reverse_each(&block) ⇒ Object -

    -
    - + -
  • - - -
  • - #slice(range) ⇒ Array? -
    + +
    +

    for efficiency

    -

    Returns:

    -
      - -
    • - - - (Array, nil) - - - -
    • - -
    - -
    - - -
  • - - + - -
     
     
    -852
    -853
    -854
    -855
    -856
    -857
    -858
    -859
    -860
    -861
    -862
    -863
    -864
    -865
    -866
    -867
    -868
    -869
    -870
    -871
    -872
    -873
    -874
    -875
    -876
    -877
    -878
    -879
    -880
    -881
    -882
    -883
    -884
    -885
    +298 +299 +300 +301 +302 +303 +304 +305 +306 +307
    -
    # File 'src/array.c', line 852
    -
    -static mrb_value
    -mrb_ary_aget(mrb_state *mrb, mrb_value self)
    -{
    -  struct RArray *a = mrb_ary_ptr(self);
    -  mrb_int i, len, alen;
    -  mrb_value index;
    -
    -  if (mrb_get_args(mrb, "o|i", &index, &len) == 1) {
    -    switch (mrb_type(index)) {
    -      /* a[n..m] */
    -    case MRB_TT_RANGE:
    -      if (mrb_range_beg_len(mrb, index, &i, &len, ARY_LEN(a), TRUE) == MRB_RANGE_OK) {
    -        return ary_subseq(mrb, a, i, len);
    -      }
    -      else {
    -        return mrb_nil_value();
    -      }
    -    case MRB_TT_FIXNUM:
    -      return mrb_ary_ref(mrb, self, mrb_fixnum(index));
    -    default:
    -      return mrb_ary_ref(mrb, self, aget_index(mrb, index));
    -    }
    -  }
    +      
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 298
     
    -  i = aget_index(mrb, index);
    -  alen = ARY_LEN(a);
    -  if (i < 0) i += alen;
    -  if (i < 0 || alen < i) return mrb_nil_value();
    -  if (len < 0) return mrb_nil_value();
    -  if (alen == i) return mrb_ary_new(mrb);
    -  if (len > alen - i) len = alen - i;
    +def reverse_each(&block)
    +  return to_enum :reverse_each unless block
     
    -  return ary_subseq(mrb, a, i, len);
    -}
    + i = self.size - 1 + while i>=0 + block.call(self[i]) + i -= 1 + end + self +end
    -

    +

    - - #slice!(index) ⇒ Object? - - #slice!(start, length) ⇒ Array? - - #slice!(range) ⇒ Array? - + #select!(&block) ⇒ Object + Also known as: + filter! + +

    -

    Deletes the element(s) given by an +index+ (optionally up to +length+ -elements) or by a +range+.

    + +

    call-seq: ary.select! {|item| block } -> ary or nil ary.select! -> Enumerator

    -

    Returns the deleted object (or objects), or +nil+ if the +index+ is out of -range.

    +

    Invokes the given block passing in successive elements from self, deleting elements for which the block returns a false value.

    -

    a = [ “a”, “b”, “c” ] - a.slice!(1) #=> “b” - a #=> [“a”, “c”] - a.slice!(-1) #=> “c” - a #=> [“a”] - a.slice!(100) #=> nil - a #=> [“a”]

    +

    If changes were made, it will return self, otherwise it returns nil.

    +

    See also Array#keep_if

    -
    -
    -
    - -

    Overloads:

    -
      - - -
    • - #slice!(index) ⇒ Object? -
      -
      - +

      If no block is given, an Enumerator is returned instead.

      -

      Returns:

      -
        - -
      • - - - (Object, nil) - - - -
      • - -
      -
      - +
    - - - -
  • - #slice!(start, length) ⇒ Array? -
    -
    - + + + + + +
    +
     
     
    -  
    +687
    +688
    +689
    +690
    +691
    +692
    +693
    +694
    +695
    +696
    +697
    +698
    +699
    +700
    +701
    +702
    +
    +
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 687
    +
    +def select!(&block)
    +  return to_enum :select! unless block
    +
    +  result = []
    +  idx = 0
    +  len = size
    +  while idx < len
    +    elem = self[idx]
    +    result << elem if block.call(elem)
    +    idx += 1
    +  end
    +
    +  return nil if len == result.size
    +
    +  self.replace(result)
    +end
    +
    -
    - -

    Returns:

    -
      + +
      +

      -
    • - - - (Array, nil) - - - -
    • + #sort(&block) ⇒ Object -

    -
    - + -
  • - - -
  • - #slice!(range) ⇒ Array? -
    + +
    +

    call-seq: array.sort -> new_array array.sort {|a, b| … } -> new_array

    + +

    Returns a new Array whose elements are those from self, sorted.

    -

    Returns:

    -
      - -
    • - - - (Array, nil) - - - -
    • - -
    -
    - +
    + + + + + + +
    +
    +
    +
    +84
    +85
    +86
    +
    +
    # File 'mrblib/array.rb', line 84
     
    -      
    +def sort(&block)
    +  self.dup.sort!(&block)
    +end
    +
    +
  • - +
    +

    + + #sort_by(&block) ⇒ Object + + -

    - - + +
     
     
    -131
    -132
    -133
    -134
    -135
    -136
    -137
    -138
    -139
    -140
    -141
    -142
    -143
    -144
    -145
    -146
    -147
    -148
    -149
    -150
    -151
    -152
    -153
    -154
    -155
    -156
    -157
    -158
    -159
    -160
    -161
    -162
    -163
    -164
    -165
    -166
    -167
    -168
    -169
    -170
    -171
    -172
    -173
    -174
    -175
    -176
    -177
    -178
    -179
    -180
    -181
    -182
    -183
    -184
    -185
    -186
    +921 +922 +923 +924 +925 +926 +927 +928 +929 +930 +931 +932
    -
    # File 'mrbgems/mruby-array-ext/src/array.c', line 131
    -
    -static mrb_value
    -mrb_ary_slice_bang(mrb_state *mrb, mrb_value self)
    -{
    -  struct RArray *a = mrb_ary_ptr(self);
    -  mrb_int i, j, k, len, alen;
    -  mrb_value val;
    -  mrb_value *ptr;
    -  mrb_value ary;
    -
    -  mrb_ary_modify(mrb, a);
    -
    -  if (mrb_get_argc(mrb) == 1) {
    -    mrb_value index;
    -
    -    mrb_get_args(mrb, "o|i", &index, &len);
    -    switch (mrb_type(index)) {
    -    case MRB_TT_RANGE:
    -      if (mrb_range_beg_len(mrb, index, &i, &len, ARY_LEN(a), TRUE) == MRB_RANGE_OK) {
    -        goto delete_pos_len;
    -      }
    -      else {
    -        return mrb_nil_value();
    -      }
    -    case MRB_TT_FIXNUM:
    -      val = mrb_funcall(mrb, self, "delete_at", 1, index);
    -      return val;
    -    default:
    -      val = mrb_funcall(mrb, self, "delete_at", 1, index);
    -      return val;
    -    }
    -  }
    +      
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 921
     
    -  mrb_get_args(mrb, "ii", &i, &len);
    - delete_pos_len:
    -  alen = ARY_LEN(a);
    -  if (i < 0) i += alen;
    -  if (i < 0 || alen < i) return mrb_nil_value();
    -  if (len < 0) return mrb_nil_value();
    -  if (alen == i) return mrb_ary_new(mrb);
    -  if (len > alen - i) len = alen - i;
    -
    -  ary = mrb_ary_new_capa(mrb, len);
    -  ptr = ARY_PTR(a);
    -  for (j = i, k = 0; k < len; ++j, ++k) {
    -    mrb_ary_push(mrb, ary, ptr[j]);
    -  }
    +def sort_by(&block)
    +  return to_enum :sort_by unless block
     
    -  ptr += i;
    -  for (j = i; j < alen - len; ++j) {
    -    *ptr = *(ptr+len);
    -    ++ptr;
    +  ary = []
    +  self.each_with_index{|e, i|
    +    ary.push([block.call(e), i])
       }
    -
    -  mrb_ary_resize(mrb, self, alen - len);
    -  return ary;
    -}
    + if ary.size > 1 + ary.sort! + end + ary.collect!{|e,i| self[i]} +end
    -

    +

    - #sort(&block) ⇒ Object + #sort_by!(&block) ⇒ Object @@ -7679,15 +3505,15 @@

     
     
    -268
    -269
    -270
    +934 +935 +936

    -
    # File 'mrblib/array.rb', line 268
    +      
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 934
     
    -def sort(&block)
    -  self.dup.sort!(&block)
    +def sort_by!(&block)
    +  self.replace(self.sort_by(&block))
     end
    @@ -7870,13 +3580,10 @@

    -

    call-seq: - ary.to_h -> Hash - ary.to_h{|item| … } -> Hash

    + +

    call-seq: ary.to_h -> Hash ary.to_h{|item| … } -> Hash

    -

    Returns the result of interpreting aray as an array of -[key, value] pairs. If a block is given, it should -return [key, value] pairs to construct a hash.

    +

    Returns the result of interpreting array as an array of [key, value] pairs. If a block is given, it should return [key, value] pairs to construct a hash.

    [[:foo, :bar], [1, 2]].to_h
       # => {:foo => :bar, 1 => 2}
    @@ -7890,27 +3597,27 @@ 

    -
    - +

    +
     
     
    -203
    -204
    -205
    -206
    -207
    -208
    -209
    -210
    -211
    -212
    -213
    -214
    -215
    -216
    -217
    -218
    -219
    -220
    -221
    -222
    -223
    -224
    -225
    -226
    -227
    -228
    -229
    -230
    -231
    -232
    -233
    -234
    -235
    -236
    -237
    -238
    -239
    -240
    -241
    -242
    -243
    -244
    -245
    -246
    -247
    -248
    -249
    -250
    -251
    -252
    -253
    -254
    -255
    -256
    -257
    -258
    -259
    -260
    -261
    -262
    -263
    -264
    -265
    -266
    +93 +94 +95
    -
    # File 'mrblib/array.rb', line 203
    -
    -def sort!(&block)
    -  stack = [ [ 0, self.size - 1 ] ]
    -  until stack.empty?
    -    left, mid, right = stack.pop
    -    if right == nil
    -      right = mid
    -      # sort self[left..right]
    -      if left < right
    -        if left + 1 == right
    -          lval = self[left]
    -          rval = self[right]
    -          cmp = if block then block.call(lval,rval) else lval <=> rval end
    -          if cmp.nil?
    -            raise ArgumentError, "comparison of #{lval.inspect} and #{rval.inspect} failed"
    -          end
    -          if cmp > 0
    -            self[left]  = rval
    -            self[right] = lval
    -          end
    -        else
    -          mid = ((left + right + 1) / 2).floor
    -          stack.push [ left, mid, right ]
    -          stack.push [ mid, right ]
    -          stack.push [ left, (mid - 1) ] if left < mid - 1
    -        end
    -      end
    -    else
    -      lary = self[left, mid - left]
    -      lsize = lary.size
    -
    -      # The entity sharing between lary and self may cause a large memory
    -      # copy operation in the merge loop below.  This harmless operation
    -      # cancels the sharing and provides a huge performance gain.
    -      lary[0] = lary[0]
    -
    -      # merge
    -      lidx = 0
    -      ridx = mid
    -      (left..right).each { |i|
    -        if lidx >= lsize
    -          break
    -        elsif ridx > right
    -          self[i, lsize - lidx] = lary[lidx, lsize - lidx]
    -          break
    -        else
    -          lval = lary[lidx]
    -          rval = self[ridx]
    -          cmp = if block then block.call(lval,rval) else lval <=> rval end
    -          if cmp.nil?
    -            raise ArgumentError, "comparison of #{lval.inspect} and #{rval.inspect} failed"
    -          end
    -          if cmp <= 0
    -            self[i] = lval
    -            lidx += 1
    -          else
    -            self[i] = rval
    -            ridx += 1
    -          end
    -        end
    -      }
    -    end
    -  end
    +      
    # File 'mrblib/array.rb', line 93
    +
    +def to_a
       self
     end
     
     
    -963
    -964
    -965
    -966
    -967
    -968
    -969
    -970
    -971
    -972
    +862 +863 +864 +865 +866 +867 +868 +869 +870 +871
    -
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 963
    +      
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 862
     
     def to_h(&blk)
       h = {}
    @@ -7938,8 +3645,8 @@ 

    -

    call-seq: - ary.transpose -> new_ary

    + +

    call-seq: ary.transpose -> new_ary

    Assumes that self is an array of arrays and transposes the rows and columns.

    @@ -7947,8 +3654,7 @@

    Examples:

    -

    a = [[1,2], [3,4], [5,6]] - a.transpose #=> [[1, 3, 5], [2, 4, 6]]

    +

    a = [[1,2], [3,4], [5,6]] a.transpose #=> [[1, 3, 5], [2, 4, 6]]

    @@ -7956,31 +3662,31 @@

    -
    - +

    +
     
     
    -934
    -935
    -936
    -937
    -938
    -939
    -940
    -941
    -942
    -943
    -944
    -945
    -946
    -947
    +833 +834 +835 +836 +837 +838 +839 +840 +841 +842 +843 +844 +845 +846
    -
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 934
    +      
    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 833
     
     def transpose
       return [] if empty?
    @@ -8012,14 +3718,12 @@ 

    -

    call-seq: - ary.union(other_ary,…) -> new_ary

    + +

    call-seq: ary.union(other_ary,…) -> new_ary

    -

    Set Union—Returns a new array by joining this array with -other_ary, removing duplicates.

    +

    Set Union—Returns a new array by joining this array with other_ary, removing duplicates.

    -

    [“a”, “b”, “c”].union([“c”, “d”, “a”], [“a”, “c”, “e”]) - #=> [“a”, “b”, “c”, “d”, “e”]

    +

    [“a”, “b”, “c”].union([“c”, “d”, “a”], [“a”, “c”, “e”]) #=> [“a”, “b”, “c”, “d”, “e”]

    @@ -8027,8 +3731,8 @@

    -
    - +

    +
    @@ -8071,17 +3775,14 @@

    -

    call-seq: - ary.uniq -> new_ary - ary.uniq { |item| … } -> new_ary

    + +

    call-seq: ary.uniq -> new_ary ary.uniq { |item| … } -> new_ary

    -

    Returns a new array by removing duplicate values in +self+.

    +

    Returns a new array by removing duplicate values in self.

    -

    a = [ “a”, “a”, “b”, “b”, “c” ] - a.uniq #=> [“a”, “b”, “c”]

    +

    a = [ “a”, “a”, “b”, “b”, “c” ] a.uniq #=> [“a”, “b”, “c”]

    -

    b = [[“student”,”sam”], [“student”,”george”], [“teacher”,”matz”]] - b.uniq { |s| s.first } # => [[“student”, “sam”], [“teacher”, “matz”]]

    +

    b = [[“student”,“sam”], [“student”,“george”], [“teacher”,“matz”]] b.uniq { |s| s.first } # => [[“student”, “sam”], [“teacher”, “matz”]]

    @@ -8089,8 +3790,8 @@

    -
    - +

    +
    @@ -8107,7 +3808,7 @@

    # File 'mrbgems/mruby-array-ext/mrblib/array.rb', line 53
     
     def uniq(&block)
    -  ary = self.dup
    +  ary = self[0..-1]
       ary.uniq!(&block)
       ary
     end
    @@ -8127,20 +3828,12 @@

    -

    call-seq: - ary.uniq! -> ary or nil - ary.uniq! { |item| … } -> ary or nil

    + +

    call-seq: ary.uniq! -> ary or nil ary.uniq! { |item| … } -> ary or nil

    -

    Removes duplicate elements from +self+. -Returns nil if no changes are made (that is, no -duplicates are found).

    +

    Removes duplicate elements from self. Returns nil if no changes are made (that is, no duplicates are found).

    -

    a = [ “a”, “a”, “b”, “b”, “c” ] - a.uniq! #=> [“a”, “b”, “c”] - b = [ “a”, “b”, “c” ] - b.uniq! #=> nil - c = [[“student”,”sam”], [“student”,”george”], [“teacher”,”matz”]] - c.uniq! { |s| s.first } # => [[“student”, “sam”], [“teacher”, “matz”]]

    +

    a = [ “a”, “a”, “b”, “b”, “c” ] a.uniq! #=> [“a”, “b”, “c”] b = [ “a”, “b”, “c” ] b.uniq! #=> nil c = [[“student”,“sam”], [“student”,“george”], [“teacher”,“matz”]] c.uniq! { |s| s.first } # => [[“student”, “sam”], [“teacher”, “matz”]]

    @@ -8148,8 +3841,8 @@

    -
    - +

    +
    @@ -8205,166 +3898,6 @@

    - - -
    -

    - - #unshiftObject - - - - Also known as: - prepend - - - - -

    -
    -

    15.2.12.5.30

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -610
    -611
    -612
    -613
    -614
    -615
    -616
    -617
    -618
    -619
    -620
    -621
    -622
    -623
    -624
    -625
    -626
    -627
    -628
    -629
    -630
    -631
    -632
    -633
    -634
    -635
    -636
    -637
    -638
    -639
    -640
    -641
    -642
    -643
    -644
    -645
    -646
    -647
    -
    -
    # File 'src/array.c', line 610
    -
    -static mrb_value
    -mrb_ary_unshift_m(mrb_state *mrb, mrb_value self)
    -{
    -  struct RArray *a = mrb_ary_ptr(self);
    -  mrb_value *vals, *ptr;
    -  mrb_int alen, len;
    -
    -  mrb_get_args(mrb, "*!", &vals, &alen);
    -  if (alen == 0) {
    -    ary_modify_check(mrb, a);
    -    return self;
    -  }
    -  len = ARY_LEN(a);
    -  if (alen > ARY_MAX_SIZE - len) {
    -    mrb_raise(mrb, E_ARGUMENT_ERROR, "array size too big");
    -  }
    -  if (ARY_SHARED_P(a)
    -      && a->as.heap.aux.shared->refcnt == 1 /* shared only referenced from this array */
    -      && a->as.heap.ptr - a->as.heap.aux.shared->ptr >= alen) /* there's room for unshifted item */ {
    -    ary_modify_check(mrb, a);
    -    a->as.heap.ptr -= alen;
    -    ptr = a->as.heap.ptr;
    -  }
    -  else {
    -    ary_modify(mrb, a);
    -    if (ARY_CAPA(a) < len + alen)
    -      ary_expand_capa(mrb, a, len + alen);
    -    ptr = ARY_PTR(a);
    -    value_move(ptr + alen, ptr, len);
    -  }
    -  array_copy(ptr, vals, alen);
    -  ARY_SET_LEN(a, len+alen);
    -  while (alen--) {
    -    mrb_field_write_barrier_value(mrb, (struct RBasic*)a, vals[alen]);
    -  }
    -
    -  return self;
    -}
    -
    -
    - -
    -

    - - #values_atObject - - - - - -

    - - - - -
    -
    -
    -
    -98
    -99
    -100
    -101
    -102
    -103
    -104
    -105
    -106
    -107
    -
    -
    # File 'mrbgems/mruby-array-ext/src/array.c', line 98
    -
    -static mrb_value
    -mrb_ary_values_at(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_int argc;
    -  mrb_value *argv;
    -
    -  mrb_get_args(mrb, "*", &argv, &argc);
    -
    -  return mrb_get_values_at(mrb, self, RARRAY_LEN(self), argc, argv, mrb_ary_ref);
    -}
    -
    @@ -8378,14 +3911,12 @@

    -

    call-seq: - ary | other_ary -> new_ary

    + +

    call-seq: ary | other_ary -> new_ary

    -

    Set Union—Returns a new array by joining this array with -other_ary, removing duplicates.

    +

    Set Union—Returns a new array by joining this array with other_ary, removing duplicates.

    -

    [ “a”, “b”, “c” ] | [ “c”, “d”, “a” ] - #=> [ “a”, “b”, “c”, “d” ]

    +

    [ “a”, “b”, “c” ] | [ “c”, “d”, “a” ] #=> [ “a”, “b”, “c”, “d” ]

    @@ -8406,8 +3937,8 @@

    -

    - +
    +
    @@ -8439,11 +3970,11 @@

    - + diff --git a/docs/api/BasicObject.html b/docs/api/BasicObject.html new file mode 100644 index 0000000..e96ed96 --- /dev/null +++ b/docs/api/BasicObject.html @@ -0,0 +1,186 @@ + + + + + + + Class: BasicObject + + — Documentation by YARD 0.9.37 + + + + + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: BasicObject + + + +

    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    mrblib/00class.rb
    +
    + +
    + + + + + + + + + +

    + Instance Method Summary + collapse +

    + + + + + + +
    +

    Instance Method Details

    + + +
    +

    + + #!=(other) ⇒ Object + + + + + +

    + + + + +
    +
    +
    +
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +
    +
    # File 'mrblib/00class.rb', line 2
    +
    +def !=(other)
    +  if self == other
    +    false
    +  else
    +    true
    +  end
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/api/BasicSocket.html b/docs/api/BasicSocket.html index 619c16f..deed512 100644 --- a/docs/api/BasicSocket.html +++ b/docs/api/BasicSocket.html @@ -6,17 +6,17 @@ Class: BasicSocket - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -100,9 +100,7 @@
    Defined in:
    -
    mrbgems/mruby-socket/src/socket.c,
    - mrbgems/mruby-socket/mrblib/socket.rb
    -
    +
    mrbgems/mruby-socket/mrblib/socket.rb
    @@ -130,12 +128,6 @@

    - - -

    Constants inherited - from IO

    -

    IO::BUF_SIZE, IO::SEEK_CUR, IO::SEEK_END, IO::SEEK_SET

    -

    Instance Attribute Summary collapse

    + + - -
    -
    - - - -
  • - - - #getpeername ⇒ Object - - - - +

    Methods inherited from IO

    +

    #<<, #each, #each_byte, #each_char, #hash, open, pipe, popen, #pos=, #print, #printf, #puts, read, #rewind, #ungetbyte

    +
    +

    Constructor Details

    +
    +

    + #initialize(*args) ⇒ BasicSocket -
    -
    - -

  • - -
  • - - - #getsockname ⇒ Object + +
    +
    +

    Returns a new instance of BasicSocket.

    - - - - + +
    +
    +
    + +
    + + + + + + +
    +
    +
    +
    +176
    +177
    +178
    +179
    +180
    +
    +
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 176
    +
    +def initialize(*args)
    +  super(*args)
    +  self._is_socket = true
    +  @do_not_reverse_lookup = @@do_not_reverse_lookup
    +end
    +
    + + + +
    +

    Instance Attribute Details

    + + + +
    +

    + #do_not_reverse_lookupObject + -
    -
    +

    +
    + +

    Returns the value of attribute do_not_reverse_lookup.

    + + +
    +
    +
    -
  • - -
  • - - - #getsockopt ⇒ Object + + + + + + + +
    +
    +
    +
    +205
    +206
    +207
    +
    +
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 205
    +
    +def do_not_reverse_lookup
    +  @do_not_reverse_lookup
    +end
    +
    + + + + +
    +

    Class Method Details

    - - - - - - +
    +

    + .do_not_reverse_lookupObject -
    -
    + -

  • + + + + + +
    +
     
    -      
    -        
  • - - - #initialize(*args) ⇒ BasicSocket - +168 +169 +170
  • +
    +
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 168
    +
    +def self.do_not_reverse_lookup
    +  @@do_not_reverse_lookup
    +end
    +
    + - - - - constructor - - - - +
    +

    + .do_not_reverse_lookup=(val) ⇒ Object -

    A new instance of BasicSocket.

    -
    + - +

    + + + + +
    +
     
    -      
    -        
  • - - - #local_address ⇒ Object - +172 +173 +174
  • +
    +
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 172
    +
    +def self.do_not_reverse_lookup=(val)
    +  @@do_not_reverse_lookup = val ? true : false
    +end
    +
    +
    - - - - - - +
    +

    + .for_fd(fd) ⇒ Object -

    def connect_address.

    -
    + - +

    + + + + +
    +
     
    -      
    -        
  • - - - #recv ⇒ Object + +182 +183 +184
  • +
    +
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 182
    +
    +def self.for_fd(fd)
    +  super(fd, "r+")
    +end
    +
    +
    + + +
    +

    Instance Method Details

    - - - +
    +

    + #local_addressObject + - - - - -
    -
    - - - - -
  • - - - #recv_nonblock(maxlen, flags = 0) ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #remote_address ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #send ⇒ Object - - - - - - - - - - - - - -

    recvmsg(maxlen, flags=0).

    -
    - -
  • - - -
  • - - - #setsockopt ⇒ Object - - - - - - - - - - - - - -

    sendmsg_nonblock.

    -
    - -
  • - - -
  • - - - #shutdown ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #sysread ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #sysseek ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #syswrite ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - - - - - - - - - - - - - -

    Methods inherited from IO

    -

    #<<, #_check_readable, #_read_buf, #close_on_exec=, #close_on_exec?, #close_write, #closed?, #each, #each_byte, #eof?, #fileno, #flush, #getc, #gets, #hash, #initialize_copy, #isatty, open, #pid, pipe, popen, #pos, #pos=, #print, #printf, #puts, read, #read, #readchar, #readline, #readlines, #rewind, #seek, #sync, #sync=, #ungetc, #write

    -
    -

    Constructor Details

    - -
    -

    - - #initialize(*args) ⇒ BasicSocket - - - - - -

    -
    -

    Returns a new instance of BasicSocket

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -179
    -180
    -181
    -182
    -183
    -
    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 179
    -
    -def initialize(*args)
    -  super(*args)
    -  self._is_socket = true
    -  @do_not_reverse_lookup = @@do_not_reverse_lookup
    -end
    -
    -
    - -
    - -
    -

    Instance Attribute Details

    - - - -
    -

    - - #do_not_reverse_lookupObject - - - - - -

    -
    -

    Returns the value of attribute do_not_reverse_lookup

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -208
    -209
    -210
    -
    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 208
    -
    -def do_not_reverse_lookup
    -  @do_not_reverse_lookup
    -end
    -
    -
    - -
    - - -
    -

    Class Method Details

    - - -
    -

    - - .do_not_reverse_lookupObject - - - - - -

    - - - - -
    -
    -
    -
    -171
    -172
    -173
    -
    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 171
    -
    -def self.do_not_reverse_lookup
    -  @@do_not_reverse_lookup
    -end
    -
    -
    - -
    -

    - - .do_not_reverse_lookup=(val) ⇒ Object - - - - - -

    - - - - -
    -
    -
    -
    -175
    -176
    -177
    -
    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 175
    -
    -def self.do_not_reverse_lookup=(val)
    -  @@do_not_reverse_lookup = val ? true : false
    -end
    -
    -
    - -
    -

    - - .for_fd(fd) ⇒ Object - - - - - -

    - - - - -
    -
    -
    -
    -185
    -186
    -187
    -
    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 185
    -
    -def self.for_fd(fd)
    -  super(fd, "r+")
    -end
    -
    -
    - -
    - -
    -

    Instance Method Details

    - - -
    -

    - - #_is_socket=Object - - - - - -

    - - - - -
    -
    -
    -
    -499
    -500
    -501
    -502
    -503
    -504
    -505
    -506
    -507
    -508
    -509
    -510
    -511
    -512
    -
    -
    # File 'mrbgems/mruby-socket/src/socket.c', line 499
    -
    -static mrb_value
    -mrb_basicsocket_set_is_socket(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_bool b;
    -  struct mrb_io *io_p;
    -  mrb_get_args(mrb, "b", &b);
    -
    -  io_p = (struct mrb_io*)DATA_PTR(self);
    -  if (io_p) {
    -    io_p->is_socket = b;
    -  }
    -
    -  return mrb_bool_value(b);
    -}
    -
    -
    - -
    -

    - - #_recvfromObject - - - - - -

    - - - - -
    -
    -
    -
    -372
    -373
    -374
    -375
    -376
    -377
    -378
    -379
    -380
    -381
    -382
    -383
    -384
    -385
    -386
    -387
    -388
    -389
    -390
    -391
    -392
    -393
    -
    -
    # File 'mrbgems/mruby-socket/src/socket.c', line 372
    -
    -static mrb_value
    -mrb_basicsocket_recvfrom(mrb_state *mrb, mrb_value self)
    -{
    -  ssize_t n;
    -  mrb_int maxlen, flags = 0;
    -  mrb_value ary, buf, sa;
    -  socklen_t socklen;
    -
    -  mrb_get_args(mrb, "i|i", &maxlen, &flags);
    -  buf = mrb_str_buf_new(mrb, maxlen);
    -  socklen = sizeof(struct sockaddr_storage);
    -  sa = mrb_str_buf_new(mrb, socklen);
    -  n = recvfrom(socket_fd(mrb, self), RSTRING_PTR(buf), (fsize_t)maxlen, (int)flags, (struct sockaddr *)RSTRING_PTR(sa), &socklen);
    -  if (n == -1)
    -    mrb_sys_fail(mrb, "recvfrom");
    -  mrb_str_resize(mrb, buf, (mrb_int)n);
    -  mrb_str_resize(mrb, sa, (mrb_int)socklen);
    -  ary = mrb_ary_new_capa(mrb, 2);
    -  mrb_ary_push(mrb, ary, buf);
    -  mrb_ary_push(mrb, ary, sa);
    -  return ary;
    -}
    -
    -
    - -
    -

    - - #_setnonblockObject - - - - - -

    - - - - -
    -
    -
    -
    -414
    -415
    -416
    -417
    -418
    -419
    -420
    -421
    -422
    -423
    -424
    -425
    -426
    -427
    -428
    -429
    -430
    -431
    -432
    -433
    -434
    -435
    -436
    -437
    -438
    -439
    -440
    -441
    -
    -
    # File 'mrbgems/mruby-socket/src/socket.c', line 414
    -
    -static mrb_value
    -mrb_basicsocket_setnonblock(mrb_state *mrb, mrb_value self)
    -{
    -  int fd, flags;
    -  mrb_bool nonblocking;
    -#ifdef _WIN32
    -  u_long mode = 1;
    -#endif
    -
    -  mrb_get_args(mrb, "b", &nonblocking);
    -  fd = socket_fd(mrb, self);
    -#ifdef _WIN32
    -  flags = ioctlsocket(fd, FIONBIO, &mode);
    -  if (flags != NO_ERROR)
    -    mrb_sys_fail(mrb, "ioctlsocket");
    -#else
    -  flags = fcntl(fd, F_GETFL, 0);
    -  if (flags == 1)
    -    mrb_sys_fail(mrb, "fcntl");
    -  if (nonblocking)
    -    flags |= O_NONBLOCK;
    -  else
    -    flags &= ~O_NONBLOCK;
    -  if (fcntl(fd, F_SETFL, flags) == -1)
    -    mrb_sys_fail(mrb, "fcntl");
    -#endif
    -  return mrb_nil_value();
    -}
    -
    -
    - -
    -

    - - #closeObject - - - - - -

    - - - - -
    -
    -
    -
    -773
    -774
    -775
    -776
    -777
    -778
    -779
    -
    -
    # File 'mrbgems/mruby-socket/src/socket.c', line 773
    -
    -static mrb_value
    -mrb_win32_basicsocket_close(mrb_state *mrb, mrb_value self)
    -{
    -  if (closesocket(socket_fd(mrb, self)) != NO_ERROR)
    -    mrb_raise(mrb, E_SOCKET_ERROR, "closesocket unsuccessful");
    -  return mrb_nil_value();
    -}
    -
    -
    - -
    -

    - - #getpeereidObject - - - - - -

    - - - - -
    -
    -
    -
    -287
    -288
    -289
    -290
    -291
    -292
    -293
    -294
    -295
    -296
    -297
    -298
    -299
    -300
    -301
    -302
    -303
    -304
    -305
    -306
    -307
    -308
    -
    -
    # File 'mrbgems/mruby-socket/src/socket.c', line 287
    -
    -static mrb_value
    -mrb_basicsocket_getpeereid(mrb_state *mrb, mrb_value self)
    -{
    -#ifdef HAVE_GETPEEREID
    -  mrb_value ary;
    -  gid_t egid;
    -  uid_t euid;
    -  int s;
    -
    -  s = socket_fd(mrb, self);
    -  if (getpeereid(s, &euid, &egid) != 0)
    -    mrb_sys_fail(mrb, "getpeereid");
    -
    -  ary = mrb_ary_new_capa(mrb, 2);
    -  mrb_ary_push(mrb, ary, mrb_fixnum_value((mrb_int)euid));
    -  mrb_ary_push(mrb, ary, mrb_fixnum_value((mrb_int)egid));
    -  return ary;
    -#else
    -  mrb_raise(mrb, E_RUNTIME_ERROR, "getpeereid is not available on this system");
    -  return mrb_nil_value();
    -#endif
    -}
    -
    -
    - -
    -

    - - #getpeernameObject - - - - - -

    - - - - -
    -
    -
    -
    -310
    -311
    -312
    -313
    -314
    -315
    -316
    -317
    -318
    -319
    -320
    -321
    -
    -
    # File 'mrbgems/mruby-socket/src/socket.c', line 310
    -
    -static mrb_value
    -mrb_basicsocket_getpeername(mrb_state *mrb, mrb_value self)
    -{
    -  struct sockaddr_storage ss;
    -  socklen_t salen;
    -
    -  salen = sizeof(ss);
    -  if (getpeername(socket_fd(mrb, self), (struct sockaddr *)&ss, &salen) != 0)
    -    mrb_sys_fail(mrb, "getpeername");
    -
    -  return mrb_str_new(mrb, (char*)&ss, salen);
    -}
    -
    -
    - -
    -

    - - #getsocknameObject - - - - - -

    - - - - -
    -
    -
    -
    -323
    -324
    -325
    -326
    -327
    -328
    -329
    -330
    -331
    -332
    -333
    -334
    -
    -
    # File 'mrbgems/mruby-socket/src/socket.c', line 323
    -
    -static mrb_value
    -mrb_basicsocket_getsockname(mrb_state *mrb, mrb_value self)
    -{
    -  struct sockaddr_storage ss;
    -  socklen_t salen;
    -
    -  salen = sizeof(ss);
    -  if (getsockname(socket_fd(mrb, self), (struct sockaddr *)&ss, &salen) != 0)
    -    mrb_sys_fail(mrb, "getsockname");
    -
    -  return mrb_str_new(mrb, (char*)&ss, salen);
    -}
    -
    -
    - -
    -

    - - #getsockoptObject - - - - - -

    - - - - -
    -
    -
    -
    -336
    -337
    -338
    -339
    -340
    -341
    -342
    -343
    -344
    -345
    -346
    -347
    -348
    -349
    -350
    -351
    -352
    -353
    -354
    -
    -
    # File 'mrbgems/mruby-socket/src/socket.c', line 336
    -
    -static mrb_value
    -mrb_basicsocket_getsockopt(mrb_state *mrb, mrb_value self)
    -{
    -  char opt[8];
    -  int s;
    -  mrb_int family, level, optname;
    -  mrb_value c, data;
    -  socklen_t optlen;
    -
    -  mrb_get_args(mrb, "ii", &level, &optname);
    -  s = socket_fd(mrb, self);
    -  optlen = sizeof(opt);
    -  if (getsockopt(s, (int)level, (int)optname, opt, &optlen) == -1)
    -    mrb_sys_fail(mrb, "getsockopt");
    -  c = mrb_const_get(mrb, mrb_obj_value(mrb_class_get(mrb, "Socket")), mrb_intern_lit(mrb, "Option"));
    -  family = socket_family(s);
    -  data = mrb_str_new(mrb, opt, optlen);
    -  return mrb_funcall(mrb, c, "new", 4, mrb_fixnum_value(family), mrb_fixnum_value(level), mrb_fixnum_value(optname), data);
    -}
    -
    -
    - -
    -

    - - #local_addressObject - - - - +

    -

    def connect_address

    + +

    def connect_address

    @@ -1394,20 +578,20 @@

    -
    - +

    +
     
     
    -191
    -192
    -193
    +188 +189 +190
    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 191
    +      
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 188
     
     def local_address
       Addrinfo.new self.getsockname
    @@ -1415,60 +599,6 @@ 

    -
    - -
    -

    - - #recvObject - - - - - -

    - - - - -
    -
    -
    -
    -356
    -357
    -358
    -359
    -360
    -361
    -362
    -363
    -364
    -365
    -366
    -367
    -368
    -369
    -370
    -
    -
    # File 'mrbgems/mruby-socket/src/socket.c', line 356
    -
    -static mrb_value
    -mrb_basicsocket_recv(mrb_state *mrb, mrb_value self)
    -{
    -  ssize_t n;
    -  mrb_int maxlen, flags = 0;
    -  mrb_value buf;
    -
    -  mrb_get_args(mrb, "i|i", &maxlen, &flags);
    -  buf = mrb_str_buf_new(mrb, maxlen);
    -  n = recv(socket_fd(mrb, self), RSTRING_PTR(buf), (fsize_t)maxlen, (int)flags);
    -  if (n == -1)
    -    mrb_sys_fail(mrb, "recv");
    -  mrb_str_resize(mrb, buf, (mrb_int)n);
    -  return buf;
    -}
    -
    @@ -1486,17 +616,17 @@

     
     
    +192
    +193
    +194
     195
     196
     197
     198
    -199
    -200
    -201
    -202
    +199

    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 195
    +      
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 192
     
     def recv_nonblock(maxlen, flags=0)
       begin
    @@ -1526,12 +656,12 @@ 

     
     
    -204
    -205
    -206
    +201 +202 +203

    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 204
    +      
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 201
     
     def remote_address
       Addrinfo.new self.getpeername
    @@ -1541,452 +671,16 @@ 

    -
    -

    - - #sendObject - - - - - -

    -
    -

    recvmsg(maxlen, flags=0)

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -395
    -396
    -397
    -398
    -399
    -400
    -401
    -402
    -403
    -404
    -405
    -406
    -407
    -408
    -409
    -410
    -411
    -412
    -
    -
    # File 'mrbgems/mruby-socket/src/socket.c', line 395
    -
    -static mrb_value
    -mrb_basicsocket_send(mrb_state *mrb, mrb_value self)
    -{
    -  ssize_t n;
    -  mrb_int flags;
    -  mrb_value dest, mesg;
    -
    -  dest = mrb_nil_value();
    -  mrb_get_args(mrb, "Si|S", &mesg, &flags, &dest);
    -  if (mrb_nil_p(dest)) {
    -    n = send(socket_fd(mrb, self), RSTRING_PTR(mesg), (fsize_t)RSTRING_LEN(mesg), (int)flags);
    -  } else {
    -    n = sendto(socket_fd(mrb, self), RSTRING_PTR(mesg), (fsize_t)RSTRING_LEN(mesg), (int)flags, (const struct sockaddr*)RSTRING_PTR(dest), (fsize_t)RSTRING_LEN(dest));
    -  }
    -  if (n == -1)
    -    mrb_sys_fail(mrb, "send");
    -  return mrb_fixnum_value((mrb_int)n);
    -}
    -
    -
    - -
    -

    - - #setsockoptObject - - - - - -

    -
    -

    sendmsg_nonblock

    - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -443
    -444
    -445
    -446
    -447
    -448
    -449
    -450
    -451
    -452
    -453
    -454
    -455
    -456
    -457
    -458
    -459
    -460
    -461
    -462
    -463
    -464
    -465
    -466
    -467
    -468
    -469
    -470
    -471
    -472
    -473
    -474
    -475
    -476
    -477
    -478
    -479
    -480
    -481
    -482
    -483
    -484
    -485
    -486
    -
    -
    # File 'mrbgems/mruby-socket/src/socket.c', line 443
    -
    -static mrb_value
    -mrb_basicsocket_setsockopt(mrb_state *mrb, mrb_value self)
    -{
    -  int s;
    -  mrb_int argc, level = 0, optname;
    -  mrb_value optval, so;
    -
    -  argc = mrb_get_args(mrb, "o|io", &so, &optname, &optval);
    -  if (argc == 3) {
    -    if (!mrb_fixnum_p(so)) {
    -      mrb_raise(mrb, E_ARGUMENT_ERROR, "level is not an integer");
    -    }
    -    level = mrb_fixnum(so);
    -    if (mrb_string_p(optval)) {
    -      /* that's good */
    -    } else if (mrb_true_p(optval) || mrb_false_p(optval)) {
    -      mrb_int i = mrb_test(optval) ? 1 : 0;
    -      optval = mrb_str_new(mrb, (char*)&i, sizeof(i));
    -    } else if (mrb_fixnum_p(optval)) {
    -      if (optname == IP_MULTICAST_TTL || optname == IP_MULTICAST_LOOP) {
    -        char uc = (char)mrb_fixnum(optval);
    -        optval = mrb_str_new(mrb, &uc, sizeof(uc));
    -      } else {
    -        mrb_int i = mrb_fixnum(optval);
    -        optval = mrb_str_new(mrb, (char*)&i, sizeof(i));
    -      }
    -    } else {
    -      mrb_raise(mrb, E_ARGUMENT_ERROR, "optval should be true, false, an integer, or a string");
    -    }
    -  } else if (argc == 1) {
    -    if (strcmp(mrb_obj_classname(mrb, so), "Socket::Option") != 0)
    -      mrb_raise(mrb, E_ARGUMENT_ERROR, "not an instance of Socket::Option");
    -    level = mrb_fixnum(mrb_funcall(mrb, so, "level", 0));
    -    optname = mrb_fixnum(mrb_funcall(mrb, so, "optname", 0));
    -    optval = mrb_funcall(mrb, so, "data", 0);
    -  } else {
    -    mrb_raisef(mrb, E_ARGUMENT_ERROR, "wrong number of arguments (%i for 3)", argc);
    -  }
    -
    -  s = socket_fd(mrb, self);
    -  if (setsockopt(s, (int)level, (int)optname, RSTRING_PTR(optval), (socklen_t)RSTRING_LEN(optval)) == -1)
    -    mrb_sys_fail(mrb, "setsockopt");
    -  return mrb_fixnum_value(0);
    -}
    -
    -
    - -
    -

    - - #shutdownObject - - - - - -

    - - - - -
    -
    -
    -
    -488
    -489
    -490
    -491
    -492
    -493
    -494
    -495
    -496
    -497
    -
    -
    # File 'mrbgems/mruby-socket/src/socket.c', line 488
    -
    -static mrb_value
    -mrb_basicsocket_shutdown(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_int how = SHUT_RDWR;
    -
    -  mrb_get_args(mrb, "|i", &how);
    -  if (shutdown(socket_fd(mrb, self), (int)how) != 0)
    -    mrb_sys_fail(mrb, "shutdown");
    -  return mrb_fixnum_value(0);
    -}
    -
    -
    - -
    -

    - - #sysreadObject - - - - - -

    - - - - -
    -
    -
    -
    -782
    -783
    -784
    -785
    -786
    -787
    -788
    -789
    -790
    -791
    -792
    -793
    -794
    -795
    -796
    -797
    -798
    -799
    -800
    -801
    -802
    -803
    -804
    -805
    -806
    -807
    -808
    -809
    -810
    -811
    -812
    -813
    -814
    -815
    -816
    -817
    -818
    -819
    -820
    -821
    -822
    -823
    -
    -
    # File 'mrbgems/mruby-socket/src/socket.c', line 782
    -
    -static mrb_value
    -mrb_win32_basicsocket_sysread(mrb_state *mrb, mrb_value self)
    -{
    -  int sd, ret;
    -  mrb_value buf = mrb_nil_value();
    -  mrb_int maxlen;
    -
    -  mrb_get_args(mrb, "i|S", &maxlen, &buf);
    -  if (maxlen < 0) {
    -    return mrb_nil_value();
    -  }
    -
    -  if (mrb_nil_p(buf)) {
    -    buf = mrb_str_new(mrb, NULL, maxlen);
    -  }
    -  if (RSTRING_LEN(buf) != maxlen) {
    -    buf = mrb_str_resize(mrb, buf, maxlen);
    -  }
    -
    -  sd = socket_fd(mrb, self);
    -  ret = recv(sd, RSTRING_PTR(buf), (int)maxlen, 0);
    -
    -  switch (ret) {
    -    case 0: /* EOF */
    -      if (maxlen == 0) {
    -        buf = mrb_str_new_cstr(mrb, "");
    -      } else {
    -        mrb_raise(mrb, E_EOF_ERROR, "sysread failed: End of File");
    -      }
    -      break;
    -    case SOCKET_ERROR: /* Error */
    -      mrb_sys_fail(mrb, "recv");
    -      break;
    -    default:
    -      if (RSTRING_LEN(buf) != ret) {
    -        buf = mrb_str_resize(mrb, buf, ret);
    -      }
    -      break;
    -  }
    -
    -  return buf;
    -}
    -
    -
    - -
    -

    - - #sysseekObject - - - - - -

    - - - - -
    -
    -
    -
    -825
    -826
    -827
    -828
    -829
    -830
    -
    -
    # File 'mrbgems/mruby-socket/src/socket.c', line 825
    -
    -static mrb_value
    -mrb_win32_basicsocket_sysseek(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_raise(mrb, E_NOTIMP_ERROR, "sysseek not implemented for windows sockets");
    -  return mrb_nil_value();
    -}
    -
    -
    - -
    -

    - - #syswriteObject - - - - - -

    - - - - -
    -
    -
     
    -832
    -833
    -834
    -835
    -836
    -837
    -838
    -839
    -840
    -841
    -842
    -843
    -844
    -845
    -
    -
    # File 'mrbgems/mruby-socket/src/socket.c', line 832
    -
    -static mrb_value
    -mrb_win32_basicsocket_syswrite(mrb_state *mrb, mrb_value self)
    -{
    -  int n;
    -  SOCKET sd;
    -  mrb_value str;
    -
    -  sd = socket_fd(mrb, self);
    -  mrb_get_args(mrb, "S", &str);
    -  n = send(sd, RSTRING_PTR(str), (int)RSTRING_LEN(str), 0);
    -  if (n == SOCKET_ERROR)
    -    mrb_sys_fail(mrb, "send");
    -  return mrb_fixnum_value(n);
    -}
    -
    - - + - - \ No newline at end of file diff --git a/docs/api/CMath.html b/docs/api/CMath.html new file mode 100644 index 0000000..82495db --- /dev/null +++ b/docs/api/CMath.html @@ -0,0 +1,928 @@ + + + + + + + Module: CMath + + — Documentation by YARD 0.9.37 + + + + + + + + + + + + + + + + + + + + + + + +
    + + +

    Module: CMath + + + +

    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    mrbgems/mruby-cmath/src/cmath.c
    +
    + +
    + + + + + + + + + +

    + Class Method Summary + collapse +

    + + + + + + +
    +

    Class Method Details

    + + +
    +

    + + .acosObject + + + + + +

    +
    + +
    +

    + + .acoshObject + + + + + +

    +
    + +
    +

    + + .asinObject + + + + + +

    +
    + +
    +

    + + .asinhObject + + + + + +

    +
    + +
    +

    + + .atanObject + + + + + +

    +
    + +
    +

    + + .atanhObject + + + + + +

    +
    + +
    +

    + + .cosObject + + + + + +

    +
    + +
    +

    + + .coshObject + + + + + +

    +
    + +
    +

    + + .expObject + + + + + +

    +
    + +
    +

    + + .logObject + + + + + +

    +
    + +

    log(z): return the natural logarithm of z, with branch cut along the negative real axis

    + + +
    +
    +
    + + +
    + + + + + + +
    +
    +
    +
    +145
    +146
    +147
    +148
    +149
    +150
    +151
    +152
    +153
    +154
    +155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +
    +
    # File 'mrbgems/mruby-cmath/src/cmath.c', line 145
    +
    +DEF_CMATH_METHOD(exp)
    +
    +/* log(z): return the natural logarithm of z, with branch cut along the negative real axis */
    +static mrb_value
    +cmath_log(mrb_state *mrb, mrb_value self) {
    +  mrb_value z;
    +  mrb_float base;
    +  mrb_float real, imag;
    +
    +  mrb_int n = mrb_get_args(mrb, "o|f", &z, &base);
    +
    +#ifndef M_E
    +#define M_E F(exp)(1.0)
    +#endif
    +
    +  if (n == 1) base = M_E;
    +  if (cmath_get_complex(mrb, z, &real, &imag) || real < 0.0) {
    +    mrb_complex c = CX(real,imag);
    +    c = FC(log)(c);
    +    if (n == 2) c = CXDIVc(c, FC(log)(CX(base,0)));
    +    return mrb_complex_new(mrb, creal(c), cimag(c));
    +  }
    +  if (n == 1) return mrb_float_value(mrb, F(log)(real));
    +  return mrb_float_value(mrb, F(log)(real)/F(log)(base));
    +}
    +
    +
    + +
    +

    + + .log10Object + + + + + +

    +
    + +

    log10(z): return the base-10 logarithm of z, with branch cut along the negative real axis

    + + +
    +
    +
    + + +
    + + + + + + +
    +
    +
    +
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    +181
    +182
    +
    +
    # File 'mrbgems/mruby-cmath/src/cmath.c', line 172
    +
    +static mrb_value
    +cmath_log10(mrb_state *mrb, mrb_value self) {
    +  mrb_value z = mrb_get_arg1(mrb);
    +  mrb_float real, imag;
    +  if (cmath_get_complex(mrb, z, &real, &imag) || real < 0.0) {
    +    mrb_complex c = CX(real,imag);
    +    c = CXDIVf(FC(log)(c),log(10));
    +    return mrb_complex_new(mrb, creal(c), cimag(c));
    +  }
    +  return mrb_float_value(mrb, F(log10)(real));
    +}
    +
    +
    + +
    +

    + + .log2Object + + + + + +

    +
    + +

    log2(z): return the base-2 logarithm of z, with branch cut along the negative real axis

    + + +
    +
    +
    + + +
    + + + + + + +
    +
    +
    +
    +185
    +186
    +187
    +188
    +189
    +190
    +191
    +192
    +193
    +194
    +195
    +
    +
    # File 'mrbgems/mruby-cmath/src/cmath.c', line 185
    +
    +static mrb_value
    +cmath_log2(mrb_state *mrb, mrb_value self) {
    +  mrb_value z = mrb_get_arg1(mrb);
    +  mrb_float real, imag;
    +  if (cmath_get_complex(mrb, z, &real, &imag) || real < 0.0) {
    +    mrb_complex c = CX(real,imag);
    +    c = CXDIVf(FC(log)(c),log(2.0));
    +    return mrb_complex_new(mrb, creal(c), cimag(c));
    +  }
    +  return mrb_float_value(mrb, F(log2)(real));
    +}
    +
    +
    + +
    +

    + + .sinObject + + + + + +

    +
    + +
    +

    + + .sinhObject + + + + + +

    +
    + +
    +

    + + .sqrtObject + + + + + +

    +
    + +

    sqrt(z): return square root of z

    + + +
    +
    +
    + + +
    + + + + + + +
    +
    +
    +
    +198
    +199
    +200
    +201
    +202
    +203
    +204
    +205
    +206
    +207
    +208
    +
    +
    # File 'mrbgems/mruby-cmath/src/cmath.c', line 198
    +
    +static mrb_value
    +cmath_sqrt(mrb_state *mrb, mrb_value self) {
    +  mrb_value z = mrb_get_arg1(mrb);
    +  mrb_float real, imag;
    +  if (cmath_get_complex(mrb, z, &real, &imag) || real < 0.0) {
    +    mrb_complex c = CX(real,imag);
    +    c = FC(sqrt)(c);
    +    return mrb_complex_new(mrb, creal(c), cimag(c));
    +  }
    +  return mrb_float_value(mrb, F(sqrt)(real));
    +}
    +
    +
    + +
    +

    + + .tanObject + + + + + +

    +
    + +
    +

    + + .tanhObject + + + + + +

    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/api/Comparable.html b/docs/api/Comparable.html index 6663d5a..d0a8af0 100644 --- a/docs/api/Comparable.html +++ b/docs/api/Comparable.html @@ -6,17 +6,17 @@ Module: Comparable - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -96,7 +96,8 @@

    Overview

    -

    Comparable

    + +

    Comparable

    ISO 15.3.3

    @@ -106,8 +107,8 @@

    Overview

    -
    - +
    + @@ -140,7 +141,8 @@

    -

    Return true if +self+ is less than +other+.

    +
    +

    call-seq: obj < other -> true or false.

    @@ -163,7 +165,8 @@

    -

    Return true if +self+ is less than or equal to +other+.

    +
    +

    call-seq: obj <= other -> true or false.

    @@ -186,7 +189,8 @@

    -

    Return true if +self+ is equal to +other+.

    +
    +

    call-seq: obj == other -> true or false.

    @@ -209,7 +213,8 @@

    -

    Return true if +self+ is greater than +other+.

    +
    +

    call-seq: obj > other -> true or false.

    @@ -232,7 +237,8 @@

    -

    Return true if +self+ is greater than or equal to +other+.

    +
    +

    call-seq: obj >= other -> true or false.

    @@ -255,7 +261,8 @@

    -

    Return true if +self+ is greater than or equal to +min+ and less than or equal to +max+.

    +
    +

    call-seq: obj.between?(min,max) -> true or false.

    @@ -264,7 +271,7 @@

  • - #clamp(min, max) ⇒ Object + #clamp(min, max = nil) ⇒ Object @@ -278,7 +285,8 @@

    -

    Returns min if obj <=> min is less than zero, max if obj <=> max is greater than zero and obj otherwise.

    +
    +

    call-seq: obj.clamp(min, max) -> obj obj.clamp(range) -> obj.

  • @@ -304,9 +312,10 @@

    -

    Return true if +self+ is less -than +other+. Otherwise return -false.

    + +

    call-seq: obj < other -> true or false

    + +

    Return true if self is less than other. Otherwise return false.

    ISO 15.3.3.2.1

    @@ -316,24 +325,24 @@

    -
    - +

    +
     
     
    -13
    -14
    -15
     16
     17
     18
    -19
    +19 +20 +21 +22
    -
    # File 'mrblib/compar.rb', line 13
    +      
    # File 'mrblib/compar.rb', line 16
     
     def < other
       cmp = self <=> other
    @@ -358,9 +367,10 @@ 

    -

    Return true if +self+ is less -than or equal to +other+. -Otherwise return false.

    + +

    call-seq: obj <= other -> true or false

    + +

    Return true if self is less than or equal to other. Otherwise return false.

    ISO 15.3.3.2.2

    @@ -370,24 +380,24 @@

    -
    - +

    +
     
     
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    +33 +34 +35 +36 +37 +38 +39
    -
    # File 'mrblib/compar.rb', line 27
    +      
    # File 'mrblib/compar.rb', line 33
     
     def <= other
       cmp = self <=> other
    @@ -412,9 +422,10 @@ 

    -

    Return true if +self+ is equal -to +other+. Otherwise return -false.

    + +

    call-seq: obj == other -> true or false

    + +

    Return true if self is equal to other. Otherwise return false.

    ISO 15.3.3.2.3

    @@ -424,25 +435,25 @@

    -
    - +

    + @@ -460,9 +471,10 @@

    -

    Return true if +self+ is greater -than +other+. Otherwise return -false.

    + +

    call-seq: obj > other -> true or false

    + +

    Return true if self is greater than other. Otherwise return false.

    ISO 15.3.3.2.4

    @@ -472,24 +484,24 @@

    -
    - +

    +
     
     
    -41
    -42
    -43
    -44
    +50 +51 +52 +53
    -
    # File 'mrblib/compar.rb', line 41
    +      
    # File 'mrblib/compar.rb', line 50
     
     def == other
       cmp = self <=> other
    -  cmp == 0
    +  cmp.equal?(0)
     end
     
     
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    +64 +65 +66 +67 +68 +69 +70
    -
    # File 'mrblib/compar.rb', line 52
    +      
    # File 'mrblib/compar.rb', line 64
     
     def > other
       cmp = self <=> other
    @@ -514,9 +526,10 @@ 

    -

    Return true if +self+ is greater -than or equal to +other+. -Otherwise return false.

    + +

    call-seq: obj >= other -> true or false

    + +

    Return true if self is greater than or equal to other. Otherwise return false.

    ISO 15.3.3.2.5

    @@ -526,24 +539,24 @@

    -
    - +

    +
     
     
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    +81 +82 +83 +84 +85 +86 +87
    -
    # File 'mrblib/compar.rb', line 66
    +      
    # File 'mrblib/compar.rb', line 81
     
     def >= other
       cmp = self <=> other
    @@ -568,10 +581,10 @@ 

    -

    Return true if +self+ is greater -than or equal to +min+ and -less than or equal to +max+. -Otherwise return false.

    + +

    call-seq: obj.between?(min,max) -> true or false

    + +

    Return true if self is greater than or equal to min and less than or equal to max. Otherwise return false.

    ISO 15.3.3.2.6

    @@ -594,20 +607,20 @@

    -

    - +
    + - -
     
     
    -81
    -82
    -83
    +99 +100 +101
    -
    # File 'mrblib/compar.rb', line 81
    +      
    # File 'mrblib/compar.rb', line 99
     
     def between?(min, max)
       self >= min and self <= max
    @@ -620,7 +633,7 @@ 

    - #clamp(min, max) ⇒ Object + #clamp(min, max = nil) ⇒ Object @@ -628,16 +641,28 @@

    -

    Returns min if obj <=> min is less -than zero, max if obj <=> max is -greater than zero and obj otherwise.

    + +

    call-seq: obj.clamp(min, max) -> obj obj.clamp(range) -> obj

    -
    12.clamp(0, 100)         #=> 12
    -523.clamp(0, 100)        #=> 100
    --3.123.clamp(0, 100)     #=> 0
    +

    In (min, max) form, returns min if obj <=> min is less than zero, max if obj <=> max is greater than zero, and obj otherwise.

    -'d'.clamp('a', 'f') #=> 'd' -'z'.clamp('a', 'f') #=> 'f' +

    12.clamp(0, 100) #=> 12 523.clamp(0, 100) #=> 100 -3.123.clamp(0, 100) #=> 0

    + +

    ‘d’.clamp(‘a’, ‘f’) #=> ‘d’ ‘z’.clamp(‘a’, ‘f’) #=> ‘f’

    + +

    In (range) form, returns range.begin if obj <=> range.begin is less than zero, range.end if obj <=> range.end is greater than zero, and obj otherwise.

    + +

    12.clamp(0..100) #=> 12 523.clamp(0..100) #=> 100 -3.123.clamp(0..100) #=> 0

    + +

    ‘d’.clamp(‘a’..‘f’) #=> ‘d’ ‘z’.clamp(‘a’..‘f’) #=> ‘f’

    + +

    If range.begin is nil, it is considered smaller than obj, and if range.end is nil, it is considered greater than obj.

    + +

    -20.clamp(0..) #=> 0 523.clamp(..100) #=> 100

    + +

    When range.end is excluded and not nil, an exception is raised.

    + +
    100.clamp(0...100)       # ArgumentError
     
    @@ -646,51 +671,81 @@

    -
    - +

    + @@ -701,11 +756,11 @@

    - + diff --git a/docs/api/Complex.html b/docs/api/Complex.html index d48e821..e341a0b 100644 --- a/docs/api/Complex.html +++ b/docs/api/Complex.html @@ -6,17 +6,17 @@ Class: Complex - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -137,8 +137,7 @@

    -
    -
    +
    @@ -155,52 +154,6 @@

  • - #*(rhs) ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #+(rhs) ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - #+@ ⇒ Object @@ -215,8 +168,7 @@

    -
    -
    +

  • @@ -224,7 +176,7 @@

  • - #-(rhs) ⇒ Object + #-@ ⇒ Object @@ -238,8 +190,7 @@

    -
    -
    +

  • @@ -247,7 +198,7 @@

  • - #-@ ⇒ Object + #<=>(other) ⇒ Object @@ -261,8 +212,7 @@

    -
    -
    +

  • @@ -270,11 +220,11 @@

  • - #/(rhs) ⇒ Object + #abs ⇒ Object - (also: #quo) + (also: #magnitude) @@ -286,8 +236,7 @@

    -
    -
    +

  • @@ -295,7 +244,7 @@

  • - #==(rhs) ⇒ Object + #abs2 ⇒ Object @@ -309,8 +258,7 @@

    -
    -
    +

  • @@ -318,34 +266,11 @@

  • - #abs ⇒ Object + #arg ⇒ Object - (also: #magnitude) - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #abs2 ⇒ Object - - + (also: #angle, #phase) @@ -357,8 +282,7 @@

    -
    -
    +

  • @@ -366,11 +290,11 @@

  • - #arg ⇒ Object + #conjugate ⇒ Object - (also: #angle, #phase) + (also: #conj) @@ -382,8 +306,7 @@

    -
    -
    +

  • @@ -391,12 +314,10 @@

  • - #conjugate ⇒ Object + #fdiv(numeric) ⇒ Object - (also: #conj) - @@ -407,8 +328,7 @@

    -
    -
    +

  • @@ -416,7 +336,7 @@

  • - #fdiv(numeric) ⇒ Object + #inspect ⇒ Object @@ -430,8 +350,7 @@

    -
    -
    +

  • @@ -439,7 +358,7 @@

  • - #inspect ⇒ Object + #polar ⇒ Object @@ -453,8 +372,7 @@

    -
    -
    +

  • @@ -462,7 +380,7 @@

  • - #polar ⇒ Object + #real? ⇒ Boolean @@ -476,8 +394,7 @@

    -
    -
    +

  • @@ -485,10 +402,12 @@

  • - #real? ⇒ Boolean + #rectangular ⇒ Object + (also: #rect) + @@ -499,8 +418,7 @@

    -
    -
    +

  • @@ -508,12 +426,10 @@

  • - #rectangular ⇒ Object + #to_c ⇒ Object - (also: #rect) - @@ -524,8 +440,7 @@

    -
    -
    +

  • @@ -547,8 +462,7 @@

    -
    -
    +
    @@ -570,8 +484,7 @@

    -
    -
    +
    @@ -589,7 +502,7 @@

    Methods inherited from Numeric

    -

    #finite?, #infinite?, #negative?, #nonzero?, #positive?, #zero?

    +

    #integer?, #negative?, #nonzero?, #positive?, #zero?

    @@ -600,7 +513,7 @@

    Methods inherited from Methods included from Comparable

    -

    #<, #<=, #>, #>=, #between?, #clamp

    +

    #<, #<=, #==, #>, #>=, #between?, #clamp

    @@ -644,83 +557,7 @@

    Instance Method Details

    -

    - - #*(rhs) ⇒ Object - - - - - -

     
     
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74
    -
    # File 'mrbgems/mruby-compar-ext/mrblib/compar.rb', line 14
    +      
    # File 'mrbgems/mruby-compar-ext/mrblib/compar.rb', line 43
    +
    +def clamp(min, max=nil)
    +
    +  if max.nil?
    +    if min.kind_of?(Range)
    +      max = min.end
    +      if !max.nil? && min.exclude_end?
    +        raise ArgumentError, "cannot clamp with an exclusive range"
    +      end
    +      min = min.begin
    +    end
    +  end
     
    -def clamp(min, max)
    -  if (min <=> max) > 0
    -    raise ArgumentError, "min argument must be smaller than max argument"
    +  if !min.nil? && !max.nil?
    +    cmp = min <=> max
    +    if cmp.nil?
    +      raise ArgumentError, "comparison of #{min.class} with #{max.class} failed"
    +    elsif cmp > 0
    +      raise ArgumentError, "min argument must be smaller than max argument"
    +    end
       end
    -  c = self <=> min
    -  if c == 0
    -    return self
    -  elsif c < 0
    -    return min
    +
    +  unless min.nil?
    +    cmp = self <=> min
    +    return self if cmp == 0
    +    return min if cmp < 0
       end
    -  c = self <=> max
    -  if c > 0
    -    return max
    -  else
    -    return self
    +  unless max.nil?
    +    cmp = self <=> max
    +    return max if cmp > 0
       end
    +  return self
     end
    - - - - -
    -
    -
    -
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -
    -
    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 38
    -
    -def *(rhs)
    -  if rhs.is_a? Complex
    -    Complex(real * rhs.real - imaginary * rhs.imaginary, real * rhs.imaginary + rhs.real * imaginary)
    -  elsif rhs.is_a? Numeric
    -    Complex(real * rhs, imaginary * rhs)
    -  end
    -end
    -
    -
    - -
    -

    - - #+(rhs) ⇒ Object - - - - - -

    - - - - -
    -
    -
    -
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -
    -
    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 22
    -
    -def +(rhs)
    -  if rhs.is_a? Complex
    -    Complex(real + rhs.real, imaginary + rhs.imaginary)
    -  elsif rhs.is_a? Numeric
    -    Complex(real + rhs, imaginary)
    -  end
    -end
    -
    -
    - -
    -

    +

    #+@Object @@ -742,45 +579,7 @@

    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 14
     
     def +@
    -  Complex(real, imaginary)
    -end
    -

    - - -
    -

    - - #-(rhs) ⇒ Object - - - - - -

    - - - @@ -818,16 +617,12 @@

    -

    +

    - #/(rhs) ⇒ Object + #<=>(other) ⇒ Object - Also known as: - quo - -

    -
    -
    -
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -
    -
    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 30
    -
    -def -(rhs)
    -  if rhs.is_a? Complex
    -    Complex(real - rhs.real, imaginary - rhs.imaginary)
    -  elsif rhs.is_a? Numeric
    -    Complex(real - rhs, imaginary)
    -  end
    +  self
     end
    @@ -836,61 +631,21 @@

     
     
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    - -

    - -
    -
    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 46
    -
    -def /(rhs)
    -  if rhs.is_a? Complex
    -    __div__(rhs)
    -  elsif rhs.is_a? Numeric
    -    Complex(real / rhs, imaginary / rhs)
    -  end
    -end
    +22 +23 +24 +25 +26 +27
    -
    - -
    -

    - - #==(rhs) ⇒ Object - - - - - -

    - - @@ -916,12 +671,12 @@

     
     
    -63
    -64
    -65
    +29 +30 +31

    @@ -1104,12 +859,12 @@

     
     
    -87
    -88
    -89
    +53 +54 +55

    @@ -1274,11 +1058,11 @@

    - + diff --git a/docs/api/Dir.html b/docs/api/Dir.html new file mode 100644 index 0000000..e91fe41 --- /dev/null +++ b/docs/api/Dir.html @@ -0,0 +1,633 @@ + + + + + + + Class: Dir + + — Documentation by YARD 0.9.37 + + + + + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Dir + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + +
    +
    Includes:
    +
    Enumerable
    +
    + + + + + + +
    +
    Defined in:
    +
    mrbgems/mruby-dir/mrblib/dir.rb
    +
    + +
    + + + + +

    Constant Summary

    + +

    Constants included + from Enumerable

    +

    Enumerable::NONE

    + + + + + + +

    + Class Method Summary + collapse +

    + + + +

    + Instance Method Summary + collapse +

    + + + + + + + + + + + + + +

    Methods included from Enumerable

    +

    #all?, #any?, #chain, #chunk, #chunk_while, #collect, #count, #cycle, #detect, #drop, #drop_while, #each_cons, #each_entry, #each_slice, #each_with_index, #each_with_object, #entries, #filter_map, #find_all, #find_index, #first, #flat_map, #grep, #grep_v, #group_by, #hash, #include?, #inject, #lazy, #max, #max_by, #min, #min_by, #minmax, #minmax_by, #none?, #one?, #partition, #reject, #reverse_each, #sort, #sort_by, #sum, #take, #take_while, #tally, #to_h, #uniq, #zip

    + + +
    +

    Class Method Details

    + + +
    +

    + + .chdir(path, &block) ⇒ Object + + + + + +

    -
    -
    +      
    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 22
     
    -55
    -56
    -57
    -58
    -59
    -60
    -61
    -
    -
    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 55
    -
    -def ==(rhs)
    -  if rhs.is_a? Complex
    -    real == rhs.real && imaginary == rhs.imaginary
    -  elsif rhs.is_a? Numeric
    -    imaginary.zero? && real == rhs
    -  end
    +def <=>(other)
    +  return nil unless other.kind_of?(Numeric)
    +  self.to_f <=> other.to_f
    +rescue
    +  nil
     end
    -
    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 63
    +      
    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 29
     
     def abs
       Math.hypot imaginary, real
    @@ -946,12 +701,12 @@ 

     
     
    -68
    -69
    -70
    +34 +35 +36

    -
    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 68
    +      
    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 34
     
     def abs2
       real * real + imaginary * imaginary
    @@ -980,12 +735,12 @@ 

     
     
    -72
    -73
    -74
    +38 +39 +40

    -
    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 72
    +      
    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 38
     
     def arg
       Math.atan2 imaginary, real
    @@ -1014,12 +769,12 @@ 

     
     
    -78
    -79
    -80
    +44 +45 +46

    -
    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 78
    +      
    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 44
     
     def conjugate
       Complex(real, -imaginary)
    @@ -1044,15 +799,15 @@ 

     
     
    -83
    -84
    -85
    +49 +50 +51

    -
    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 83
    +      
    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 49
     
     def fdiv(numeric)
    -  Complex(real.to_f / numeric, imaginary.to_f / numeric)
    +  Complex(real / numeric, imaginary / numeric)
     end
    -
    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 87
    +      
    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 53
     
     def polar
       [abs, arg]
    @@ -1132,7 +887,6 @@ 

    -
    @@ -1151,20 +905,20 @@

    -

    - + +
     
     
    -91
    -92
    -93
    +57 +58 +59
    -
    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 91
    +      
    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 57
     
     def real?
       false
    @@ -1193,12 +947,12 @@ 

     
     
    -95
    -96
    -97
    +61 +62 +63

    -
    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 95
    +      
    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 61
     
     def rectangular
       [real, imaginary]
    @@ -1206,6 +960,36 @@ 

    + + +
    +

    + + #to_cObject + + + + + +

    + + + + +
    +
    +
    +
    +66
    +67
    +68
    +
    +
    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 66
    +
    +def to_c
    +  self
    +end
    +
    @@ -1223,13 +1007,13 @@

     
     
    -100
    -101
    -102
    -103
    +70 +71 +72 +73

    -
    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 100
    +      
    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 70
     
     def to_r
       raise RangeError.new "can't convert #{to_s} into Rational" unless imaginary.zero?
    @@ -1263,7 +1047,7 @@ 

    # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 10
     
     def to_s
    -  "#{real}#{'+' unless imaginary.negative?}#{imaginary}i"
    +  "#{real}#{'+' unless imaginary < 0}#{imaginary}#{'*' unless imaginary.finite?}i"
     end

    + + + + +
    +
    +
    +
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +
    +
    # File 'mrbgems/mruby-dir/mrblib/dir.rb', line 67
    +
    +def chdir(path, &block)
    +  if block
    +    wd = self.getwd
    +    begin
    +      self._chdir(path)
    +      block.call(path)
    +    ensure
    +      self._chdir(wd)
    +    end
    +  else
    +    self._chdir(path)
    +  end
    +end
    +
    +
    + +
    +

    + + .children(path) ⇒ Object + + + + + +

    + + + + +
    +
    +
    +
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +
    +
    # File 'mrbgems/mruby-dir/mrblib/dir.rb', line 34
    +
    +def children(path)
    +  a = []
    +  self.open(path) do |d|
    +    while s = d.read
    +      a << s unless s == "." || s == ".."
    +    end
    +  end
    +  a
    +end
    +
    +
    + +
    +

    + + .entries(path) ⇒ Object + + + + + +

    + + + + +
    +
    +
    +
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +
    +
    # File 'mrbgems/mruby-dir/mrblib/dir.rb', line 24
    +
    +def entries(path)
    +  a = []
    +  self.open(path) do |d|
    +    while s = d.read
    +      a << s
    +    end
    +  end
    +  a
    +end
    +
    +
    + +
    +

    + + .foreach(path, &block) ⇒ Object + + + + + +

    + + + + +
    +
    +
    +
    +44
    +45
    +46
    +47
    +48
    +49
    +
    +
    # File 'mrbgems/mruby-dir/mrblib/dir.rb', line 44
    +
    +def foreach(path, &block)
    +  return to_enum(:foreach, path) unless block
    +  self.open(path) do |d|
    +    d.each(&block)
    +  end
    +end
    +
    +
    + +
    +

    + + .open(path, &block) ⇒ Object + + + + + +

    + + + + +
    +
    +
    +
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +
    +
    # File 'mrbgems/mruby-dir/mrblib/dir.rb', line 51
    +
    +def open(path, &block)
    +  if block
    +    d = self.new(path)
    +    begin
    +      block.call(d)
    +    ensure
    +      begin
    +        d.close
    +      rescue IOError
    +      end
    +    end
    +  else
    +    self.new(path)
    +  end
    +end
    +
    +
    + + + +
    +

    Instance Method Details

    + + +
    +

    + + #each(&block) ⇒ Object + + + + + +

    + + + + +
    +
    +
    +
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +
    +
    # File 'mrbgems/mruby-dir/mrblib/dir.rb', line 4
    +
    +def each(&block)
    +  return to_enum(:each) unless block
    +  while s = self.read
    +    block.call(s)
    +  end
    +  self
    +end
    +
    +
    + +
    +

    + + #each_child(&block) ⇒ Object + + + + + +

    + + + + +
    +
    +
    +
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +
    +
    # File 'mrbgems/mruby-dir/mrblib/dir.rb', line 12
    +
    +def each_child(&block)
    +  return to_enum(:each_child) unless block
    +  while s = self.read
    +    block.call(s) unless s == "." || s == ".."
    +  end
    +  self
    +end
    +
    +
    + +
    + + + + + + + + \ No newline at end of file diff --git a/docs/api/EOFError.html b/docs/api/EOFError.html index 1f2ce9d..ccf4221 100644 --- a/docs/api/EOFError.html +++ b/docs/api/EOFError.html @@ -6,17 +6,17 @@ Exception: EOFError - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -78,9 +78,7 @@
    • Object
    • - - - + @@ -124,36 +122,14 @@ - - - - - - - - - - - -

      Method Summary

      - -

      Methods inherited from Exception

      -

      #backtrace, #exception, #initialize, #inspect, #message, #set_backtrace, #to_s

      -
      -

      Constructor Details

      - -

      This class inherits a constructor from Exception

      - -
      - - + diff --git a/docs/api/Enumerable.html b/docs/api/Enumerable.html index a92c503..7359abc 100644 --- a/docs/api/Enumerable.html +++ b/docs/api/Enumerable.html @@ -6,17 +6,17 @@ Module: Enumerable - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -80,7 +80,7 @@
      Included in:
      -
      Array, Enumerator, Enumerator::Chain, Enumerator::Generator, Hash, Range
      +
      Array, Dir, Enumerator, Enumerator::Chain, Enumerator::Generator, Hash, Range, Set, Struct
      @@ -88,7 +88,7 @@
      Defined in:
      mrblib/enum.rb,
      - src/enum.c,
      mrbgems/mruby-enum-ext/mrblib/enum.rb,
      mrbgems/mruby-enum-lazy/mrblib/lazy.rb,
      mrbgems/mruby-enum-chain/mrblib/chain.rb,
      mrbgems/mruby-enumerator/mrblib/enumerator.rb
      + mrbgems/mruby-enum-ext/mrblib/enum.rb,
      mrbgems/mruby-enum-lazy/mrblib/lazy.rb,
      mrbgems/mruby-enum-chain/mrblib/chain.rb,
      mrbgems/mruby-enumerator/mrblib/enumerator.rb
      @@ -96,8 +96,8 @@

      Overview

      -

      chain.rb Enumerator::Chain class -See Copyright Notice in mruby.h

      + +

      chain.rb Enumerator::Chain class See Copyright Notice in mruby.h

      @@ -105,8 +105,8 @@

      Overview

      -
      - +
      +

      @@ -132,7 +132,7 @@

      - Class Method Summary + Instance Method Summary collapse

      @@ -141,7 +141,7 @@

    • - .__update_hash ⇒ Object + #all?(pat = NONE, &block) ⇒ Boolean @@ -155,25 +155,41 @@

      -

      internal method __update_hash(oldhash, index, itemhash).

      +
      +

      ISO 15.3.2.2.1 call-seq: enum.all? [{ |obj| block } ] -> true or false enum.all?(pattern) -> true or false.

    • -

    +
  • + + + #any?(pat = NONE, &block) ⇒ Boolean + + + + + + + + + + -

    - Instance Method Summary - collapse -

    -
      + +
      +

      ISO 15.3.2.2.2 call-seq: enum.any? [{ |obj| block }] -> true or false enum.any?(pattern) -> true or false.

      +
      + + +
    • - #all?(pat = NONE, &block) ⇒ Boolean + #chain(*args) ⇒ Object @@ -187,16 +203,7 @@

      -
      - - - - - - - -
      ISO 15.3.2.2.1 call-seq: enum.all? [{objblock } ] -> true or false enum.all?(pattern) -> true or false.
      -
      +

    • @@ -204,7 +211,7 @@

    • - #any?(pat = NONE, &block) ⇒ Boolean + #chunk(&block) ⇒ Object @@ -218,15 +225,8 @@

      -
      - - - - - - - -
      ISO 15.3.2.2.2 call-seq: enum.any? [{objblock }] -> true or false enum.any?(pattern) -> true or false.
      +
      +

      call-seq: enum.chunk -> enumerator enum.chunk { |arr| block } -> enumerator.

    • @@ -235,7 +235,7 @@

    • - #chain(*args) ⇒ Object + #chunk_while(&block) ⇒ Object @@ -250,6 +250,7 @@

      +

      call-seq: enum.chunk_while {|elt_before, elt_after| bool } -> an_enumerator.

    • @@ -274,7 +275,8 @@

      -

      Call the given block for each element which is yield by +each+.

      +
      +

      Call the given block for each element which is yield by each.

      @@ -297,15 +299,8 @@

      -
      - - - - - - - -
      call-seq: enum.count -> int enum.count(item) -> int enum.count {objblock } -> int.
      +
      +

      call-seq: enum.count -> int enum.count(item) -> int enum.count { |obj| block } -> int.

      @@ -328,15 +323,8 @@

      -
      - - - - - - - -
      call-seq: enum.cycle(n=nil) {objblock } -> nil enum.cycle(n=nil) -> an_enumerator.
      +
      +

      call-seq: enum.cycle(n=nil) { |obj| block } -> nil enum.cycle(n=nil) -> an_enumerator.

      @@ -361,7 +349,8 @@

      -

      Return the first element for which value from the block is true.

      +
      +

      Return the first element for which value from the block is true.

      @@ -384,7 +373,8 @@

      -

      call-seq: enum.drop(n) -> array.

      +
      +

      call-seq: enum.drop(n) -> array.

      @@ -407,15 +397,8 @@

      -
      - - - - - - - -
      call-seq: enum.drop_while {arrblock } -> array enum.drop_while -> an_enumerator.
      +
      +

      call-seq: enum.drop_while {|arr| block } -> array enum.drop_while -> an_enumerator.

      @@ -438,7 +421,32 @@

      -

      Iterates the given block for each array of consecutive elements.

      +
      +

      Iterates the given block for each array of consecutive <n> elements.

      +
      + + + + +
    • + + + #each_entry(*args, &blk) ⇒ Object + + + + + + + + + + + + + +
      +

      call-seq: enum.each_entry { |obj| block } -> enum enum.each_entry -> an_enumerator.

    • @@ -461,7 +469,8 @@

      -

      Iterates the given block for each slice of elements.

      +
      +

      Iterates the given block for each slice of <n> elements.

      @@ -484,7 +493,8 @@

      -

      Call the given block for each element which is yield by +each+.

      +
      +

      Call the given block for each element which is yield by each.

      @@ -507,15 +517,8 @@

      -
      - - - - - - - -
      call-seq: enum.each_with_object(obj) {(*args), memo_obj… } -> obj enum.each_with_object(obj) -> an_enumerator.
      +
      +

      call-seq: enum.each_with_object(obj) { |(*args), memo_obj| … } -> obj enum.each_with_object(obj) -> an_enumerator.

      @@ -540,7 +543,8 @@

      -

      Return an array of all elements which are yield by +each+.

      +
      +

      Return an array of all elements which are yield by each.

      @@ -563,8 +567,7 @@

      -
      -
      +
      @@ -588,7 +591,8 @@

      -

      Call the given block for each element which is yield by +each+.

      +
      +

      Call the given block for each element which is yield by each.

      @@ -611,15 +615,8 @@

      -
      - - - - - - - -
      call-seq: enum.find_index(value) -> int or nil enum.find_index {objblock } -> int or nil enum.find_index -> an_enumerator.
      +
      +

      call-seq: enum.find_index(value) -> int or nil enum.find_index { |obj| block } -> int or nil enum.find_index -> an_enumerator.

      @@ -642,7 +639,8 @@

      -

      call-seq: enum.first -> obj or nil enum.first(n) -> an_array.

      +
      +

      call-seq: enum.first -> obj or nil enum.first(n) -> an_array.

      @@ -667,17 +665,8 @@

      -
      - - - - - - - - - -
      call-seq: enum.flat_map {objblock } -> array enum.collect_concat {objblock } -> array enum.flat_map -> an_enumerator enum.collect_concat -> an_enumerator.
      +
      +

      call-seq: enum.flat_map { |obj| block } -> array enum.collect_concat { |obj| block } -> array enum.flat_map -> an_enumerator enum.collect_concat -> an_enumerator.

      @@ -700,9 +689,32 @@

      -

      Call the given block for each element which is yield by +each+ and which return value was true when invoking === with +pattern+.

      +
      +

      Call the given block for each element which is yield by each and which return value was true when invoking === with pattern.

      + + + +
    • + + + #grep_v(pattern, &block) ⇒ Object + + + + + + + + + + + + + +
      +
    • @@ -723,15 +735,8 @@

      -
      - - - - - - - -
      call-seq: enum.group_by {objblock } -> a_hash enum.group_by -> an_enumerator.
      +
      +

      call-seq: enum.group_by {| obj | block } -> a_hash enum.group_by -> an_enumerator.

      @@ -754,7 +759,8 @@

      -

      redefine #hash 15.3.1.3.15.

      +
      +

      redefine #hash 15.3.1.3.15.

      @@ -779,7 +785,8 @@

      -

      Return true if at least one element which is yield by +each+ returns a true value by invoking == with +obj+.

      +
      +

      Return true if at least one element which is yield by each returns a true value by invoking == with obj.

      @@ -804,7 +811,8 @@

      -

      Call the given block for each element which is yield by +each+.

      +
      +

      Call the given block for each element which is yield by each.

      @@ -827,7 +835,8 @@

      -

      = Enumerable#lazy implementation.

      +
      +

      = Enumerable#lazy implementation.

      @@ -850,7 +859,8 @@

      -

      Return the maximum value of all elements yield by +each+.

      +
      +

      Return the maximum value of all elements yield by each.

      @@ -873,15 +883,8 @@

      -
      - - - - - - - -
      call-seq: enum.max_by {objblock } -> obj enum.max_by -> an_enumerator.
      +
      +

      call-seq: enum.max_by {|obj| block } -> obj enum.max_by -> an_enumerator.

      @@ -904,7 +907,8 @@

      -

      Return the minimum value of all elements yield by +each+.

      +
      +

      Return the minimum value of all elements yield by each.

      @@ -927,15 +931,8 @@

      -
      - - - - - - - -
      call-seq: enum.min_by {objblock } -> obj enum.min_by -> an_enumerator.
      +
      +

      call-seq: enum.min_by {|obj| block } -> obj enum.min_by -> an_enumerator.

      @@ -958,15 +955,8 @@

      -
      - - - - - - - -
      call-seq: enum.minmax -> [min, max] enum.minmax {a, bblock } -> [min, max].
      +
      +

      call-seq: enum.minmax -> [min, max] enum.minmax { |a, b| block } -> [min, max].

      @@ -989,15 +979,8 @@

      -
      - - - - - - - -
      call-seq: enum.minmax_by {objblock } -> [min, max] enum.minmax_by -> an_enumerator.
      +
      +

      call-seq: enum.minmax_by { |obj| block } -> [min, max] enum.minmax_by -> an_enumerator.

      @@ -1020,15 +1003,8 @@

      -
      - - - - - - - -
      call-seq: enum.none? [{objblock }] -> true or false enum.none?(pattern) -> true or false.
      +
      +

      call-seq: enum.none? [{ |obj| block }] -> true or false enum.none?(pattern) -> true or false.

      @@ -1051,15 +1027,8 @@

      -
      - - - - - - - -
      call-seq: enum.one? [{objblock }] -> true or false enum.one?(pattern) -> true or false.
      +
      +

      call-seq: enum.one? [{ |obj| block }] -> true or false enum.one?(pattern) -> true or false.

      @@ -1082,7 +1051,8 @@

      -

      Call the given block for each element which is yield by +each+.

      +
      +

      Call the given block for each element which is yield by each.

      @@ -1105,7 +1075,8 @@

      -

      Call the given block for each element which is yield by +each+.

      +
      +

      Call the given block for each element which is yield by each.

      @@ -1128,15 +1099,8 @@

      -
      - - - - - - - -
      call-seq: enum.reverse_each {itemblock } -> enum enum.reverse_each -> an_enumerator.
      +
      +

      call-seq: enum.reverse_each { |item| block } -> enum enum.reverse_each -> an_enumerator.

      @@ -1159,7 +1123,8 @@

      -

      Return a sorted array of all elements which are yield by +each+.

      +
      +

      Return a sorted array of all elements which are yield by each.

      @@ -1182,15 +1147,8 @@

      -
      - - - - - - - -
      call-seq: enum.sort_by {objblock } -> array enum.sort_by -> an_enumerator.
      +
      +

      call-seq: enum.sort_by { |obj| block } -> array enum.sort_by -> an_enumerator.

      @@ -1199,7 +1157,7 @@

    • - #take(n) ⇒ Object + #sum(init = 0, &block) ⇒ Object @@ -1213,7 +1171,8 @@

      -

      call-seq: enum.take(n) -> array.

      +
      +

      call-seq: enum.sum(count=1) -> numeric enum.sum(count=1)… -> numeric.

    • @@ -1222,7 +1181,7 @@

    • - #take_while(&block) ⇒ Object + #take(n) ⇒ Object @@ -1236,15 +1195,8 @@

      -
      - - - - - - - -
      call-seq: enum.take_while {arrblock } -> array enum.take_while -> an_enumerator.
      +
      +

      call-seq: enum.take(n) -> array.

    • @@ -1253,7 +1205,7 @@

    • - #tally ⇒ Object + #take_while(&block) ⇒ Object @@ -1267,7 +1219,8 @@

      -

      call-seq: enum.tally -> a_hash.

      +
      +

      call-seq: enum.take_while {|arr| block } -> array enum.take_while -> an_enumerator.

    • @@ -1276,7 +1229,7 @@

    • - #to_h(&blk) ⇒ Object + #tally ⇒ Object @@ -1290,7 +1243,8 @@

      -

      call-seq: enum.to_h -> hash.

      +
      +

      call-seq: enum.tally -> a_hash.

    • @@ -1299,7 +1253,7 @@

    • - #uniq(&block) ⇒ Object + #to_h(&blk) ⇒ Object @@ -1314,6 +1268,7 @@

      +

      call-seq: enum.to_h -> hash.

    • @@ -1322,7 +1277,7 @@

    • - #zip(*args, &block) ⇒ Object + #uniq(&block) ⇒ Object @@ -1336,82 +1291,39 @@

      -

      use Enumerator to use infinite sequence.

      -
      +

    • -

    - - - - -
    -

    Class Method Details

    +
  • + + + #zip(*args, &block) ⇒ Object + -
    -

    + + + - .__update_hashObject - - -

    -
    -

    internal method __update_hash(oldhash, index, itemhash)

    - - -
    -
    -
    -
    - - - - - - -
    -
    -
    -
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -
    -
    # File 'src/enum.c', line 11
    +  
    +    
    +

    use Enumerator to use infinite sequence.

    +
    + + -static mrb_value -enum_update_hash(mrb_state *mrb, mrb_value self) -{ - mrb_int hash; - mrb_int index; - mrb_int hv; + + + - mrb_get_args(mrb, "iii", &hash, &index, &hv); - hash ^= ((uint32_t)hv << (index % 16)); - return mrb_fixnum_value(hash); -}
    -
    -
    - -

    Instance Method Details

    @@ -1428,20 +1340,12 @@

    -

    ISO 15.3.2.2.1 - call-seq: - enum.all? [{ |obj| block } ] -> true or false - enum.all?(pattern) -> true or false

    + +

    ISO 15.3.2.2.1 call-seq: enum.all? [{ |obj| block } ] -> true or false enum.all?(pattern) -> true or false

    -

    Passes each element of the collection to the given block. The method - returns true if the block never returns - false or nil. If the block is not given, - Ruby adds an implicit block of { |obj| obj } which will - cause #all? to return +true+ when none of the collection members are - +false+ or +nil+.

    +

    Passes each element of the collection to the given block. The method returns true if the block never returns false or nil. If the block is not given, Ruby adds an implicit block of { |obj| obj } which will cause #all? to return true when none of the collection members are false or nil.

    -

    If a pattern is supplied instead, the method returns whether - pattern === element for every collection member.

    +

    If a pattern is supplied instead, the method returns whether pattern === element for every collection member.

    %w[ant bear cat].all? { |word| word.length >= 3 } #=> true
     %w[ant bear cat].all? { |word| word.length >= 4 } #=> false
    @@ -1469,8 +1373,8 @@ 

    -

    - +
    +
    @@ -1513,20 +1417,12 @@

    -

    ISO 15.3.2.2.2 - call-seq: - enum.any? [{ |obj| block }] -> true or false - enum.any?(pattern) -> true or false

    + +

    ISO 15.3.2.2.2 call-seq: enum.any? [{ |obj| block }] -> true or false enum.any?(pattern) -> true or false

    -

    Passes each element of the collection to the given block. The method - returns true if the block ever returns a value other - than false or nil. If the block is not - given, Ruby adds an implicit block of { |obj| obj } that - will cause #any? to return +true+ if at least one of the collection - members is not +false+ or +nil+.

    +

    Passes each element of the collection to the given block. The method returns true if the block ever returns a value other than false or nil. If the block is not given, Ruby adds an implicit block of { |obj| obj } that will cause #any? to return true if at least one of the collection members is not false or nil.

    -

    If a pattern is supplied instead, the method returns whether - pattern === element for any collection member.

    +

    If a pattern is supplied instead, the method returns whether pattern === element for any collection member.

    %w[ant bear cat].any? { |word| word.length >= 3 } #=> true
     %w[ant bear cat].any? { |word| word.length >= 4 } #=> true
    @@ -1555,8 +1451,8 @@ 

    -

    - +
    +
    @@ -1616,6 +1512,236 @@

    + + +
    +

    + + #chunk(&block) ⇒ Object + + + + + +

    +
    + +

    call-seq: enum.chunk -> enumerator enum.chunk { |arr| block } -> enumerator

    + +

    Each element in the returned enumerator is a 2-element array consisting of:

    +
    • +

      A value returned by the block.

      +
    • +

      An array (“chunk”) containing the element for which that value was returned, and all following elements for which the block returned the same value:

      +
    + +

    So that:

    +
    • +

      Each block return value that is different from its predecessor begins a new chunk.

      +
    • +

      Each block return value that is the same as its predecessor continues the same chunk.

      +
    + +

    Example:

    + +
    e = (0..10).chunk {|i| (i / 3).floor } # => #<Enumerator: ...>
    +# The enumerator elements.
    +e.next # => [0, [0, 1, 2]]
    +e.next # => [1, [3, 4, 5]]
    +e.next # => [2, [6, 7, 8]]
    +e.next # => [3, [9, 10]]
    +
    + +

    You can use the special symbol :_alone to force an element into its own separate chuck:

    + +
    a = [0, 0, 1, 1]
    +e = a.chunk{|i| i.even? ? :_alone : true }
    +e.to_a # => [[:_alone, [0]], [:_alone, [0]], [true, [1, 1]]]
    +
    + +

    You can use the special symbol :_separator or nil to force an element to be ignored (not included in any chunk):

    + +
    a = [0, 0, -1, 1, 1]
    +e = a.chunk{|i| i < 0 ? :_separator : true }
    +e.to_a # => [[true, [0, 0]], [true, [1, 1]]]
    +
    + + +
    +
    +
    + + +
    + + + + + + +
    +
    +
    +
    +745
    +746
    +747
    +748
    +749
    +750
    +751
    +752
    +753
    +754
    +755
    +756
    +757
    +758
    +759
    +760
    +761
    +762
    +763
    +764
    +765
    +766
    +767
    +768
    +769
    +770
    +771
    +
    +
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 745
    +
    +def chunk(&block)
    +  return to_enum :chunk unless block
    +
    +  enum = self
    +  Enumerator.new do |y|
    +    last_value, arr = nil, []
    +    enum.each do |element|
    +      value = block.call(element)
    +      case value
    +      when :_alone
    +        y.yield [last_value, arr] if arr.size > 0
    +        y.yield [value, [element]]
    +        last_value, arr = nil, []
    +      when :_separator, nil
    +        y.yield [last_value, arr] if arr.size > 0
    +        last_value, arr = nil, []
    +      when last_value
    +        arr << element
    +      else
    +        raise 'symbols beginning with an underscore are reserved' if value.is_a?(Symbol) && value.to_s[0] == '_'
    +        y.yield [last_value, arr] if arr.size > 0
    +        last_value, arr = value, [element]
    +      end
    +    end
    +    y.yield [last_value, arr] if arr.size > 0
    +  end
    +end
    +
    +
    + +
    +

    + + #chunk_while(&block) ⇒ Object + + + + + +

    +
    + +

    call-seq: enum.chunk_while {|elt_before, elt_after| bool } -> an_enumerator

    + +

    Creates an enumerator for each chunked elements. The beginnings of chunks are defined by the block.

    + +

    This method splits each chunk using adjacent elements, elt_before and elt_after, in the receiver enumerator. This method split chunks between elt_before and elt_after where the block returns false.

    + +

    The block is called the length of the receiver enumerator minus one.

    + +

    The result enumerator yields the chunked elements as an array. So each method can be called as follows:

    + +

    enum.chunk_while { |elt_before, elt_after| bool }.each { |ary| … }

    + +

    Other methods of the Enumerator class and Enumerable module, such as to_a, map, etc., are also usable.

    + +

    For example, one-by-one increasing subsequence can be chunked as follows:

    + +

    a = [1,2,4,9,10,11,12,15,16,19,20,21] b = a.chunk_while {|i, j| i+1 == j } p b.to_a #=> [[1, 2], [4], [9, 10, 11, 12], [15, 16], [19, 20, 21]] c = b.map {|a| a.length < 3 ? a : “#{a.first}-#Enumerable.aa.last” } p c #=> [[1, 2], [4], “9-12”, [15, 16], “19-21”] d = c.join(“,”) p d #=> “1,2,4,9-12,15,16,19-21”

    + +

    Increasing (non-decreasing) subsequence can be chunked as follows:

    + +

    a = [0, 9, 2, 2, 3, 2, 7, 5, 9, 5] p a.chunk_while {|i, j| i <= j }.to_a #=> [[0, 9], [2, 2, 3], [2, 7], [5, 9], [5]]

    + +

    Adjacent evens and odds can be chunked as follows: (Enumerable#chunk is another way to do it.)

    + +

    a = [7, 5, 9, 2, 0, 7, 9, 4, 2, 0] p a.chunk_while {|i, j| i.even? == j.even? }.to_a #=> [[7, 5, 9], [2, 0], [7, 9], [4, 2, 0]]

    + +

    Enumerable#slice_when does the same, except splitting when the block returns true instead of false.

    + + +
    +
    +
    + + +
    + + + + + + +
    +
    +
    +
    +823
    +824
    +825
    +826
    +827
    +828
    +829
    +830
    +831
    +832
    +833
    +834
    +835
    +836
    +837
    +838
    +839
    +840
    +841
    +
    +
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 823
    +
    +def chunk_while(&block)
    +  enum = self
    +  Enumerator.new do |y|
    +    n = 0
    +    last_value, arr = nil, []
    +    enum.each do |element|
    +      if n > 0
    +        unless block.call(last_value, element)
    +          y.yield arr
    +          arr = []
    +        end
    +      end
    +      arr.push(element)
    +      n += 1
    +      last_value = element
    +    end
    +    y.yield arr if arr.size > 0
    +  end
    +end
    +
    @@ -1633,10 +1759,8 @@

    -

    Call the given block for each element -which is yield by +each+. Append all -values of each block together and -return this value.

    + +

    Call the given block for each element which is yield by each. Append all values of each block together and return this value.

    ISO 15.3.2.2.3

    @@ -1646,8 +1770,8 @@

    -
    - +

    +
    @@ -1688,15 +1812,10 @@

    -

    call-seq: - enum.count -> int - enum.count(item) -> int - enum.count { |obj| block } -> int

    + +

    call-seq: enum.count -> int enum.count(item) -> int enum.count { |obj| block } -> int

    -

    Returns the number of items in +enum+ through enumeration. -If an argument is given, the number of items in +enum+ that -are equal to +item+ are counted. If a block is given, it -counts the number of elements yielding a true value.

    +

    Returns the number of items in enum through enumeration. If an argument is given, the number of items in enum that are equal to item are counted. If a block is given, it counts the number of elements yielding a true value.

    @@ -1704,34 +1823,34 @@

    -
    - +

    +
     
     
    +238
    +239
    +240
    +241
    +242
    +243
    +244
    +245
    +246
    +247
    +248
     249
     250
     251
     252
     253
    -254
    -255
    -256
    -257
    -258
    -259
    -260
    -261
    -262
    -263
    -264
    -265
    +254
    -
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 249
    +      
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 238
     
     def count(v=NONE, &block)
       count = 0
    @@ -1740,7 +1859,7 @@ 

    count += 1 if block.call(*val) end else - if v == NONE + if NONE.equal?(v) self.each { count += 1 } else self.each do |*val| @@ -1766,17 +1885,12 @@

    -

    call-seq: - enum.cycle(n=nil) { |obj| block } -> nil - enum.cycle(n=nil) -> an_enumerator

    + +

    call-seq: enum.cycle(n=nil) { |obj| block } -> nil enum.cycle(n=nil) -> an_enumerator

    -

    Calls block for each element of enum repeatedly n - times or forever if none or +nil+ is given. If a non-positive - number is given or the collection is empty, does nothing. Returns - +nil+ if the loop has finished without getting interrupted.

    +

    Calls block for each element of enum repeatedly n times or forever if none or nil is given. If a non-positive number is given or the collection is empty, does nothing. Returns nil if the loop has finished without getting interrupted.

    -

    Enumerable#cycle saves elements in an internal array so changes - to enum after the first pass have no effect.

    +

    Enumerable#cycle saves elements in an internal array so changes to enum after the first pass have no effect.

    If no block is given, an enumerator is returned instead.

    @@ -1791,14 +1905,25 @@

    -
    - +

    +
     
     
    +653
    +654
    +655
    +656
    +657
    +658
    +659
    +660
    +661
    +662
    +663
     664
     665
     666
    @@ -1814,21 +1939,10 @@ 

    676 677 678 -679 -680 -681 -682 -683 -684 -685 -686 -687 -688 -689 -690

    +679
    -
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 664
    +      
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 653
     
     def cycle(nv = nil, &block)
       return to_enum(:cycle, nv) unless block
    @@ -1877,11 +1991,8 @@ 

    -

    Return the first element for which -value from the block is true. If no -object matches, calls +ifnone+ and -returns its result. Otherwise returns -+nil+.

    + +

    Return the first element for which value from the block is true. If no object matches, calls ifnone and returns its result. Otherwise returns nil.

    ISO 15.3.2.2.4

    @@ -1891,8 +2002,8 @@

    -
    - +

    +
    @@ -1939,14 +2050,12 @@

    -

    call-seq: - enum.drop(n) -> array

    + +

    call-seq: enum.drop(n) -> array

    -

    Drops first n elements from enum, and returns rest elements -in an array.

    +

    Drops first n elements from enum, and returns rest elements in an array.

    -

    a = [1, 2, 3, 4, 5, 0] - a.drop(3) #=> [4, 5, 0]

    +

    a = [1, 2, 3, 4, 5, 0] a.drop(3) #=> [4, 5, 0]

    @@ -1967,8 +2076,8 @@

    -

    - + +
    @@ -2011,18 +2120,14 @@

    -

    call-seq: - enum.drop_while {|arr| block } -> array - enum.drop_while -> an_enumerator

    + +

    call-seq: enum.drop_while {|arr| block } -> array enum.drop_while -> an_enumerator

    -

    Drops elements up to, but not including, the first element for -which the block returns +nil+ or +false+ and returns an array -containing the remaining elements.

    +

    Drops elements up to, but not including, the first element for which the block returns nil or false and returns an array containing the remaining elements.

    If no block is given, an enumerator is returned instead.

    -

    a = [1, 2, 3, 4, 5, 0] - a.drop_while {|i| i < 3 } #=> [3, 4, 5, 0]

    +

    a = [1, 2, 3, 4, 5, 0] a.drop_while {|i| i < 3 } #=> [3, 4, 5, 0]

    @@ -2030,8 +2135,8 @@

    -
    - +

    +
    @@ -2078,8 +2183,8 @@

    -

    Iterates the given block for each array of consecutive -elements.

    + +

    Iterates the given block for each array of consecutive <n> elements.

    @@ -2087,7 +2192,7 @@

    -

    Examples:

    +

    Examples:

    (1..10).each_cons(3) {|a| p a}
    @@ -2130,8 +2235,8 @@ 

    -

    - +
    +
    @@ -2173,6 +2278,67 @@

    +

    + +
    +

    + + #each_entry(*args, &blk) ⇒ Object + + + + + +

    +
    + +

    call-seq: enum.each_entry { |obj| block } -> enum enum.each_entry -> an_enumerator

    + +

    Calls block once for each element in self, passing that element as a parameter, converting multiple values from yield to an array.

    + +

    If no block is given, an enumerator is returned instead.

    + +

    class Foo include Enumerable def each yield 1 yield 1, 2 yield end end Foo.new.each_entry{ |o| p o }

    + +

    produces:

    + +

    1 [1, 2] nil

    + + +
    +
    +
    + + +
    + + + + + + +
    +
    +
    +
    +911
    +912
    +913
    +914
    +915
    +916
    +917
    +
    +
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 911
    +
    +def each_entry(*args, &blk)
    +  return to_enum(:each_entry) unless blk
    +  self.each do |*a|
    +    yield a.__svalue
    +  end
    +  return self
    +end
    +
    @@ -2186,7 +2352,8 @@

    -

    Iterates the given block for each slice of elements.

    + +

    Iterates the given block for each slice of <n> elements.

    @@ -2194,7 +2361,7 @@

    -

    Examples:

    +

    Examples:

    (1..10).each_slice(3) {|a| p a}
    @@ -2233,8 +2400,8 @@ 

    -

    - +
    +
    @@ -2295,10 +2462,8 @@

    -

    Call the given block for each element -which is yield by +each+. Pass an -index to the block which starts at 0 -and increase by 1 for each element.

    + +

    Call the given block for each element which is yield by each. Pass an index to the block which starts at 0 and increase by 1 for each element.

    ISO 15.3.2.2.5

    @@ -2308,8 +2473,8 @@

    -
    - +

    +
    @@ -2356,12 +2521,10 @@

    -

    call-seq: - enum.each_with_object(obj) { |(*args), memo_obj| … } -> obj - enum.each_with_object(obj) -> an_enumerator

    + +

    call-seq: enum.each_with_object(obj) { |(*args), memo_obj| … } -> obj enum.each_with_object(obj) -> an_enumerator

    -

    Iterates the given block for each element with an arbitrary - object given, and returns the initially given object.

    +

    Iterates the given block for each element with an arbitrary object given, and returns the initially given object.

    If no block is given, returns an enumerator.

    @@ -2375,23 +2538,23 @@

    -
    - +

    +
     
     
    -607
    -608
    -609
    -610
    -611
    -612
    +596 +597 +598 +599 +600 +601
    -
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 607
    +      
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 596
     
     def each_with_object(obj, &block)
       return to_enum(:each_with_object, obj) unless block
    @@ -2419,8 +2582,8 @@ 

    -

    Return an array of all elements which -are yield by +each+.

    + +

    Return an array of all elements which are yield by each.

    ISO 15.3.2.2.6

    @@ -2430,8 +2593,8 @@

    -
    - +

    +
    @@ -2478,19 +2641,19 @@

     
     
    -830
    -831
    -832
    -833
    -834
    -835
    -836
    -837
    -838
    -839
    +819 +820 +821 +822 +823 +824 +825 +826 +827 +828

    -
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 830
    +      
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 819
     
     def filter_map(&blk)
       return to_enum(:filter_map) unless blk
    @@ -2522,10 +2685,8 @@ 

    -

    Call the given block for each element -which is yield by +each+. Return an array -which contains all elements whose block -value was true.

    + +

    Call the given block for each element which is yield by each. Return an array which contains all elements whose block value was true.

    ISO 15.3.2.2.8

    @@ -2535,8 +2696,8 @@

    -
    - +

    +
    @@ -2581,15 +2742,10 @@

    -

    call-seq: - enum.find_index(value) -> int or nil - enum.find_index { |obj| block } -> int or nil - enum.find_index -> an_enumerator

    + +

    call-seq: enum.find_index(value) -> int or nil enum.find_index { |obj| block } -> int or nil enum.find_index -> an_enumerator

    -

    Compares each entry in enum with value or passes - to block. Returns the index for the first for which the - evaluated value is non-false. If no object matches, returns - nil

    +

    Compares each entry in enum with value or passes to block. Returns the index for the first for which the evaluated value is non-false. If no object matches, returns nil

    If neither block nor argument is given, an enumerator is returned instead.

    @@ -2604,37 +2760,37 @@

    -
    - +

    +
     
     
    +699
    +700
    +701
    +702
    +703
    +704
    +705
    +706
    +707
    +708
    +709
     710
     711
     712
     713
     714
    -715
    -716
    -717
    -718
    -719
    -720
    -721
    -722
    -723
    -724
    -725
    -726
    +715
    -
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 710
    +      
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 699
     
     def find_index(val=NONE, &block)
    -  return to_enum(:find_index, val) if !block && val == NONE
    +  return to_enum(:find_index, val) if !block && NONE.equal?(val)
     
       idx = 0
       if block
    @@ -2666,13 +2822,10 @@ 

    -

    call-seq: - enum.first -> obj or nil - enum.first(n) -> an_array

    + +

    call-seq: enum.first -> obj or nil enum.first(n) -> an_array

    -

    Returns the first element, or the first +n+ elements, of the enumerable. -If the enumerable is empty, the first form returns nil, and the -second form returns an empty array.

    +

    Returns the first element, or the first n elements, of the enumerable. If the enumerable is empty, the first form returns nil, and the second form returns an empty array.

    @@ -2680,14 +2833,25 @@

    -
    - +

    +
     
     
    +205
    +206
    +207
    +208
    +209
    +210
    +211
    +212
    +213
    +214
    +215
     216
     217
     218
    @@ -2698,21 +2862,10 @@ 

    223 224 225 -226 -227 -228 -229 -230 -231 -232 -233 -234 -235 -236 -237

    +226
    -
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 216
    +      
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 205
     
     def first(*args)
       case args.length
    @@ -2756,31 +2909,14 @@ 

    -

    call-seq: - enum.flat_map { |obj| block } -> array - enum.collect_concat { |obj| block } -> array - enum.flat_map -> an_enumerator - enum.collect_concat -> an_enumerator

    + +

    call-seq: enum.flat_map { |obj| block } -> array enum.collect_concat { |obj| block } -> array enum.flat_map -> an_enumerator enum.collect_concat -> an_enumerator

    -

    Returns a new array with the concatenated results of running -block once for every element in enum.

    +

    Returns a new array with the concatenated results of running block once for every element in enum.

    If no block is given, an enumerator is returned instead.

    - - - - - - - - - - - - - -
    [1, 2, 3, 4].flat_map {e[e, -e] } #=> [1, -1, 2, -2, 3, -3, 4, -4]
    [[1, 2], [3, 4]].flat_map {ee + [100] } #=> [1, 2, 100, 3, 4, 100]
    +

    [1, 2, 3, 4].flat_map { |e| [e, -e] } #=> [1, -1, 2, -2, 3, -3, 4, -4] [[1, 2], [3, 4]].flat_map { |e| e + [100] } #=> [1, 2, 100, 3, 4, 100]

    @@ -2788,31 +2924,31 @@

    -
    - +

    +
     
     
    +270
    +271
    +272
    +273
    +274
    +275
    +276
    +277
    +278
    +279
    +280
     281
     282
    -283
    -284
    -285
    -286
    -287
    -288
    -289
    -290
    -291
    -292
    -293
    -294
    +283
    -
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 281
    +      
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 270
     
     def flat_map(&block)
       return to_enum :flat_map unless block
    @@ -2844,11 +2980,8 @@ 

    -

    Call the given block for each element -which is yield by +each+ and which return -value was true when invoking === with -+pattern+. Return an array with all -elements or the respective block values.

    + +

    Call the given block for each element which is yield by each and which return value was true when invoking === with pattern. Return an array with all elements or the respective block values.

    ISO 15.3.2.2.9

    @@ -2858,8 +2991,8 @@

    -
    - +

    +
    @@ -2893,6 +3026,50 @@

    +
    + +
    +

    + + #grep_v(pattern, &block) ⇒ Object + + + + + +

    + + + + +
    +
    +
    +
    +832
    +833
    +834
    +835
    +836
    +837
    +838
    +839
    +840
    +841
    +
    +
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 832
    +
    +def grep_v(pattern, &block)
    +  ary = []
    +  self.each{|*val|
    +    sv = val.__svalue
    +    unless pattern === sv
    +      ary.push((block)? block.call(*val): sv)
    +    end
    +  }
    +  ary
    +end
    +
    @@ -2906,13 +3083,10 @@

    -

    call-seq: - enum.group_by {| obj | block } -> a_hash - enum.group_by -> an_enumerator

    + +

    call-seq: enum.group_by {| obj | block } -> a_hash enum.group_by -> an_enumerator

    -

    Returns a hash, which keys are evaluated result from the -block, and values are arrays of elements in enum -corresponding to the key.

    +

    Returns a hash, which keys are evaluated result from the block, and values are arrays of elements in enum corresponding to the key.

    (1..6).group_by {|i| i%3}   #=> {0=>[3, 6], 1=>[1, 4], 2=>[2, 5]}
     
    @@ -2923,8 +3097,8 @@

    -
    - +

    +
    @@ -2973,7 +3147,8 @@

    -

    redefine #hash 15.3.1.3.15

    + +

    redefine #hash 15.3.1.3.15

    @@ -2981,8 +3156,8 @@

    -
    - +

    +
    @@ -3031,10 +3206,8 @@

    -

    Return true if at least one element which -is yield by +each+ returns a true value -by invoking == with +obj+. Otherwise return -false.

    + +

    Return true if at least one element which is yield by each returns a true value by invoking == with obj. Otherwise return false.

    ISO 15.3.2.2.10

    @@ -3057,8 +3230,8 @@

    -

    - +
    +
    @@ -3101,11 +3274,8 @@

    -

    Call the given block for each element -which is yield by +each+. Return value -is the sum of all block values. Pass -to each block the current sum and the -current element.

    + +

    Call the given block for each element which is yield by each. Return value is the sum of all block values. Pass to each block the current sum and the current element.

    ISO 15.3.2.2.11

    @@ -3128,8 +3298,8 @@

    -

    - +
    +
    @@ -3208,23 +3378,31 @@

    -

    = Enumerable#lazy implementation

    - -

    Enumerable#lazy returns an instance of Enumerator::Lazy. -You can use it just like as normal Enumerable object, -except these methods act as ‘lazy’:

    - -
      -
    • map collect
    • -
    • select find_all
    • -
    • reject
    • -
    • grep
    • -
    • drop
    • -
    • drop_while
    • -
    • take_while
    • -
    • flat_map collect_concat
    • -
    • zip
    • -
    + +

    = Enumerable#lazy implementation

    + +

    Enumerable#lazy returns an instance of Enumerator::Lazy. You can use it just like as normal Enumerable object, except these methods act as ‘lazy’:

    +
    • +

      map collect

      +
    • +

      select find_all

      +
    • +

      reject

      +
    • +

      grep

      +
    • +

      grep_v

      +
    • +

      drop

      +
    • +

      drop_while

      +
    • +

      take_while

      +
    • +

      flat_map collect_concat

      +
    • +

      zip

      +
    @@ -3232,20 +3410,20 @@

    -
    - +

    +
     
     
    -18
     19
    -20
    +20 +21
    -
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 18
    +      
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 19
     
     def lazy
       Enumerator::Lazy.new(self)
    @@ -3266,10 +3444,8 @@ 

    -

    Return the maximum value of all elements -yield by +each+. If no block is given <=> -will be invoked to define this value. If -a block is given it will be used instead.

    + +

    Return the maximum value of all elements yield by each. If no block is given <=> will be invoked to define this value. If a block is given it will be used instead.

    ISO 15.3.2.2.13

    @@ -3279,8 +3455,8 @@

    -
    - +

    +
    @@ -3345,24 +3521,14 @@

    -

    call-seq: - enum.max_by {|obj| block } -> obj - enum.max_by -> an_enumerator

    + +

    call-seq: enum.max_by {|obj| block } -> obj enum.max_by -> an_enumerator

    -

    Returns the object in enum that gives the maximum -value from the given block.

    +

    Returns the object in enum that gives the maximum value from the given block.

    If no block is given, an enumerator is returned instead.

    - - - - - - - - -
    %w[albatross dog horse].max_by {xx.length } #=> “albatross”
    +

    %w[albatross dog horse].max_by {|x| x.length } #=> “albatross”

    @@ -3370,14 +3536,25 @@

    -
    - +

    +
     
     
    +298
    +299
    +300
    +301
    +302
    +303
    +304
    +305
    +306
    +307
    +308
     309
     310
     311
    @@ -3387,21 +3564,10 @@ 

    315 316 317 -318 -319 -320 -321 -322 -323 -324 -325 -326 -327 -328 -329

    +318
    -
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 309
    +      
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 298
     
     def max_by(&block)
       return to_enum :max_by unless block
    @@ -3440,10 +3606,8 @@ 

    -

    Return the minimum value of all elements -yield by +each+. If no block is given <=> -will be invoked to define this value. If -a block is given it will be used instead.

    + +

    Return the minimum value of all elements yield by each. If no block is given <=> will be invoked to define this value. If a block is given it will be used instead.

    ISO 15.3.2.2.14

    @@ -3453,8 +3617,8 @@

    -
    - +

    +
    @@ -3519,24 +3683,14 @@

    -

    call-seq: - enum.min_by {|obj| block } -> obj - enum.min_by -> an_enumerator

    + +

    call-seq: enum.min_by {|obj| block } -> obj enum.min_by -> an_enumerator

    -

    Returns the object in enum that gives the minimum -value from the given block.

    +

    Returns the object in enum that gives the minimum value from the given block.

    If no block is given, an enumerator is returned instead.

    - - - - - - - - -
    %w[albatross dog horse].min_by {xx.length } #=> “dog”
    +

    %w[albatross dog horse].min_by {|x| x.length } #=> “dog”

    @@ -3544,14 +3698,25 @@

    -
    - +

    +
     
     
    +332
    +333
    +334
    +335
    +336
    +337
    +338
    +339
    +340
    +341
    +342
     343
     344
     345
    @@ -3561,21 +3726,10 @@ 

    349 350 351 -352 -353 -354 -355 -356 -357 -358 -359 -360 -361 -362 -363

    +352
    -
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 343
    +      
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 332
     
     def min_by(&block)
       return to_enum :min_by unless block
    @@ -3614,14 +3768,10 @@ 

    -

    call-seq: - enum.minmax -> [min, max] - enum.minmax { |a, b| block } -> [min, max]

    + +

    call-seq: enum.minmax -> [min, max] enum.minmax { |a, b| block } -> [min, max]

    -

    Returns two elements array which contains the minimum and the - maximum value in the enumerable. The first form assumes all - objects implement Comparable; the second uses the - block to return a <=> b.

    +

    Returns two elements array which contains the minimum and the maximum value in the enumerable. The first form assumes all objects implement Comparable; the second uses the block to return a <=> b.

    a = %w(albatross dog horse)
     a.minmax                                  #=> ["albatross", "horse"]
    @@ -3634,14 +3784,25 @@ 

    -
    - +

    +
     
     
    +368
    +369
    +370
    +371
    +372
    +373
    +374
    +375
    +376
    +377
    +378
     379
     380
     381
    @@ -3654,21 +3815,10 @@ 

    388 389 390 -391 -392 -393 -394 -395 -396 -397 -398 -399 -400 -401 -402

    +391
    -
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 379
    +      
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 368
     
     def minmax(&block)
       max = nil
    @@ -3710,13 +3860,10 @@ 

    -

    call-seq: - enum.minmax_by { |obj| block } -> [min, max] - enum.minmax_by -> an_enumerator

    + +

    call-seq: enum.minmax_by { |obj| block } -> [min, max] enum.minmax_by -> an_enumerator

    -

    Returns a two element array containing the objects in - enum that correspond to the minimum and maximum values respectively - from the given block.

    +

    Returns a two element array containing the objects in enum that correspond to the minimum and maximum values respectively from the given block.

    If no block is given, an enumerator is returned instead.

    @@ -3729,14 +3876,25 @@

    -
    - +

    +
     
     
    +406
    +407
    +408
    +409
    +410
    +411
    +412
    +413
    +414
    +415
    +416
     417
     418
     419
    @@ -3752,21 +3910,10 @@ 

    429 430 431 -432 -433 -434 -435 -436 -437 -438 -439 -440 -441 -442 -443

    +432
    -
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 417
    +      
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 406
     
     def minmax_by(&block)
       return to_enum :minmax_by unless block
    @@ -3782,7 +3929,7 @@ 

    max = min = val.__svalue max_cmp = min_cmp = block.call(*val) first = false - else + else if (cmp = block.call(*val)) > max_cmp max = val.__svalue max_cmp = cmp @@ -3811,17 +3958,12 @@

    -

    call-seq: - enum.none? [{ |obj| block }] -> true or false - enum.none?(pattern) -> true or false

    + +

    call-seq: enum.none? [{ |obj| block }] -> true or false enum.none?(pattern) -> true or false

    -

    Passes each element of the collection to the given block. The method - returns true if the block never returns true - for all elements. If the block is not given, none? will return - true only if none of the collection members is true.

    +

    Passes each element of the collection to the given block. The method returns true if the block never returns true for all elements. If the block is not given, none? will return true only if none of the collection members is true.

    -

    If a pattern is supplied instead, the method returns whether - pattern === element for none of the collection members.

    +

    If a pattern is supplied instead, the method returns whether pattern === element for none of the collection members.

    %w(ant bear cat).none? { |word| word.length == 5 } #=> true
     %w(ant bear cat).none? { |word| word.length >= 4 } #=> false
    @@ -3851,36 +3993,36 @@ 

    -

    - +
    +
     
     
    +455
    +456
    +457
    +458
    +459
    +460
    +461
    +462
    +463
    +464
    +465
     466
     467
     468
     469
    -470
    -471
    -472
    -473
    -474
    -475
    -476
    -477
    -478
    -479
    -480
    -481
    +470
    -
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 466
    +      
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 455
     
     def none?(pat=NONE, &block)
    -  if pat != NONE
    +  if !NONE.equal?(pat)
         self.each do |*val|
           return false if pat === val.__svalue
         end
    @@ -3911,27 +4053,14 @@ 

    -

    call-seq: - enum.one? [{ |obj| block }] -> true or false - enum.one?(pattern) -> true or false

    + +

    call-seq: enum.one? [{ |obj| block }] -> true or false enum.one?(pattern) -> true or false

    -

    Passes each element of the collection to the given block. The method -returns true if the block returns true -exactly once. If the block is not given, one? will return -true only if exactly one of the collection members is -true.

    +

    Passes each element of the collection to the given block. The method returns true if the block returns true exactly once. If the block is not given, one? will return true only if exactly one of the collection members is true.

    -

    If a pattern is supplied instead, the method returns whether -pattern === element for exactly one collection member.

    +

    If a pattern is supplied instead, the method returns whether pattern === element for exactly one collection member.

    -

    %w(ant bear cat).one? { |word| word.length == 4 } #=> true - %w(ant bear cat).one? { |word| word.length > 4 } #=> false - %w(ant bear cat).one? { |word| word.length < 4 } #=> false - %wbear cat.one?(/t/) #=> false - [nil, true, 99].one? #=> false - [nil, true, false].one? #=> true - [ nil, true, 99 ].one?(Integer) #=> true - [].one? #=> false

    +

    %w(ant bear cat).one? { |word| word.length == 4 } #=> true %w(ant bear cat).one? { |word| word.length > 4 } #=> false %w(ant bear cat).one? { |word| word.length < 4 } #=> false %wbear cat.one?(/t/) #=> false [nil, true, 99].one? #=> false [nil, true, false].one? #=> true [ nil, true, 99 ].one?(Integer) #=> true [].one? #=> false

    @@ -3952,14 +4081,25 @@

    -

    - + +
     
     
    +495
    +496
    +497
    +498
    +499
    +500
    +501
    +502
    +503
    +504
    +505
     506
     507
     508
    @@ -3969,25 +4109,14 @@ 

    512 513 514 -515 -516 -517 -518 -519 -520 -521 -522 -523 -524 -525 -526

    +515
    -
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 506
    +      
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 495
     
     def one?(pat=NONE, &block)
       count = 0
    -  if pat!=NONE
    +  if !NONE.equal?(pat)
         self.each do |*val|
           count += 1 if pat === val.__svalue
           return false if count > 1
    @@ -4022,13 +4151,8 @@ 

    -

    Call the given block for each element -which is yield by +each+. Return an -array which contains two arrays. The -first array contains all elements -whose block value was true. The second -array contains all elements whose -block value was false.

    + +

    Call the given block for each element which is yield by each. Return an array which contains two arrays. The first array contains all elements whose block value was true. The second array contains all elements whose block value was false.

    ISO 15.3.2.2.16

    @@ -4038,8 +4162,8 @@

    -
    - +

    +
    @@ -4094,10 +4218,8 @@

    -

    Call the given block for each element -which is yield by +each+. Return an -array which contains only the elements -whose block value was false.

    + +

    Call the given block for each element which is yield by each. Return an array which contains only the elements whose block value was false.

    ISO 15.3.2.2.17

    @@ -4107,8 +4229,8 @@

    -
    - +

    +
    @@ -4153,9 +4275,8 @@

    -

    call-seq: - enum.reverse_each { |item| block } -> enum - enum.reverse_each -> an_enumerator

    + +

    call-seq: enum.reverse_each { |item| block } -> enum enum.reverse_each -> an_enumerator

    Builds a temporary array and traverses that array in reverse order.

    @@ -4177,28 +4298,28 @@

    -
    - +

    +
     
     
    -632
    -633
    -634
    -635
    -636
    -637
    -638
    -639
    -640
    -641
    -642
    +621 +622 +623 +624 +625 +626 +627 +628 +629 +630 +631
    -
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 632
    +      
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 621
     
     def reverse_each(&block)
       return to_enum :reverse_each unless block
    @@ -4227,12 +4348,8 @@ 

    -

    Return a sorted array of all elements -which are yield by +each+. If no block -is given <=> will be invoked on each -element to define the order. Otherwise -the given block will be used for -sorting.

    + +

    Return a sorted array of all elements which are yield by each. If no block is given <=> will be invoked on each element to define the order. Otherwise the given block will be used for sorting.

    ISO 15.3.2.2.19

    @@ -4242,8 +4359,8 @@

    -
    - +

    +
    @@ -4276,12 +4393,10 @@

    -

    call-seq: - enum.sort_by { |obj| block } -> array - enum.sort_by -> an_enumerator

    + +

    call-seq: enum.sort_by { |obj| block } -> array enum.sort_by -> an_enumerator

    -

    Sorts enum using a set of keys generated by mapping the -values in enum through the given block.

    +

    Sorts enum using a set of keys generated by mapping the values in enum through the given block.

    If no block is given, an enumerator is returned instead.

    @@ -4291,45 +4406,90 @@

    -
    - +

    + + +
     
     
    +192
     193
     194
    -195
    -196
    -197
    -198
    -199
    -200
    -201
    -202
    -203
    -204
    -205
    -206
    +195
    -
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 193
    +      
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 192
     
     def sort_by(&block)
       return to_enum :sort_by unless block
    +  self.to_a.sort_by(&block)
    +end
    +
    +
    + +
    +

    + + #sum(init = 0, &block) ⇒ Object + - ary = [] - orig = [] - self.each_with_index{|e, i| - orig.push(e) - ary.push([block.call(e), i]) - } - if ary.size > 1 - ary.sort! + + + +

    +
    + +

    call-seq: enum.sum(count=1) -> numeric enum.sum(count=1)… -> numeric

    + +

    Returns the sum of elements. For example, [e1, e2, e3].sum returns e1 + e2 + e3. If a block is given, each element is processed by the block, e.g [e1, e2, e3].sumEnumerable._1_1.m gives e1.m + e2.m + e3.m.

    + + +
    +
    +
    + + +
    + + + + + @@ -4347,13 +4507,12 @@

    -

    call-seq: - enum.take(n) -> array

    + +

    call-seq: enum.take(n) -> array

    -

    Returns first n elements from enum.

    +

    Returns first n elements from enum.

    -

    a = [1, 2, 3, 4, 5, 0] - a.take(3) #=> [1, 2, 3]

    +

    a = [1, 2, 3, 4, 5, 0] a.take(3) #=> [1, 2, 3]

    @@ -4374,8 +4533,8 @@

    -

    - + +
    +
    +
    +
    +870
    +871
    +872
    +873
    +874
    +875
    +876
    +877
    +878
    +879
    +880
    +881
    +882
    +
    +
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 870
    +
    +def sum(init=0,&block)
    +  result=init
    +  if block
    +    self.each do |e|
    +      result += block.call(e)
    +    end
    +  else
    +    self.each do |e|
    +      result += e
    +    end
       end
    -  ary.collect{|e,i| orig[i]}
    +  result
     end
    @@ -4428,12 +4587,10 @@

    -

    call-seq: - enum.take_while {|arr| block } -> array - enum.take_while -> an_enumerator

    + +

    call-seq: enum.take_while {|arr| block } -> array enum.take_while -> an_enumerator

    -

    Passes elements to the block until the block returns +nil+ or +false+, -then stops iterating and returns an array of all prior elements.

    +

    Passes elements to the block until the block returns nil or false, then stops iterating and returns an array of all prior elements.

    If no block is given, an enumerator is returned instead.

    @@ -4447,8 +4604,8 @@

    -
    - +

    +
    @@ -4495,12 +4652,10 @@

    -

    call-seq: - enum.tally -> a_hash

    + +

    call-seq: enum.tally -> a_hash

    -

    Tallys the collection. Returns a hash where the keys are the -elements and the values are numbers of elements in the collection -that correspond to the key.

    +

    Tallys the collection. Returns a hash where the keys are the elements and the values are numbers of elements in the collection that correspond to the key.

    [“a”, “b”, “c”, “b”].tally #=> “b”=>2, “c”=>1

    @@ -4510,8 +4665,8 @@

    -
    - +

    +
    @@ -4552,11 +4707,10 @@

    -

    call-seq: - enum.to_h -> hash

    + +

    call-seq: enum.to_h -> hash

    -

    Returns the result of interpreting enum as a list of - [key, value] pairs.

    +

    Returns the result of interpreting enum as a list of [key, value] pairs.

    %i[hello world].each_with_index.to_h
       # => {:hello => 0, :world => 1}
    @@ -4568,14 +4722,25 @@ 

    -
    - +

    +
     
     
    +783
    +784
    +785
    +786
    +787
    +788
    +789
    +790
    +791
    +792
    +793
     794
     795
     796
    @@ -4583,21 +4748,10 @@ 

    798 799 800 -801 -802 -803 -804 -805 -806 -807 -808 -809 -810 -811 -812

    +801
    -
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 794
    +      
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 783
     
     def to_h(&blk)
       h = {}
    @@ -4638,24 +4792,24 @@ 

     
     
    +803
    +804
    +805
    +806
    +807
    +808
    +809
    +810
    +811
    +812
    +813
     814
     815
     816
    -817
    -818
    -819
    -820
    -821
    -822
    -823
    -824
    -825
    -826
    -827
    -828
    +817

    -
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 814
    +      
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 803
     
     def uniq(&block)
       hash = {}
    @@ -4688,7 +4842,8 @@ 

    -

    use Enumerator to use infinite sequence

    + +

    use Enumerator to use infinite sequence

    @@ -4696,14 +4851,25 @@

    -
    - +

    +
     
     
    +744
    +745
    +746
    +747
    +748
    +749
    +750
    +751
    +752
    +753
    +754
     755
     756
     757
    @@ -4719,21 +4885,10 @@ 

    767 768 769 -770 -771 -772 -773 -774 -775 -776 -777 -778 -779 -780 -781

    +770
    -
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 755
    +      
    # File 'mrbgems/mruby-enum-ext/mrblib/enum.rb', line 744
     
     def zip(*arg, &block)
       result = block ? nil : []
    @@ -4771,11 +4926,11 @@ 

    - + diff --git a/docs/api/Enumerator.html b/docs/api/Enumerator.html index 17cfd82..da756cc 100644 --- a/docs/api/Enumerator.html +++ b/docs/api/Enumerator.html @@ -6,17 +6,17 @@ Class: Enumerator - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -112,16 +112,12 @@

    Overview

    -

    A class which allows both internal and external iteration.

    + +

    A class which allows both internal and external iteration.

    -

    An Enumerator can be created by the following methods. -- Kernel#to_enum -- Kernel#enum_for -- Enumerator.new

    +

    An Enumerator can be created by the following methods. - Kernel#to_enum - Kernel#enum_for - Enumerator.new

    -

    Most methods have two forms: a block form where the contents -are evaluated for each item in the enumeration, and a non-block form -which returns a new Enumerator wrapping the iteration.

    +

    Most methods have two forms: a block form where the contents are evaluated for each item in the enumeration, and a non-block form which returns a new Enumerator wrapping the iteration.

      enumerator = %w(one two three).each
       puts enumerator.class # => Enumerator
    @@ -146,17 +142,13 @@ 

    Overview

    # foo: three
    -

    This allows you to chain Enumerators together. For example, you -can map a list’s elements to strings containing the index -and the element as a string via:

    +

    This allows you to chain Enumerators together. For example, you can map a list’s elements to strings containing the index and the element as a string via:

      puts %w[foo bar baz].map.with_index { |w, i| "#{i}:#{w}" }
       # => ["0:foo", "1:bar", "2:baz"]
     
    -

    An Enumerator can also be used as an external iterator. -For example, Enumerator#next returns the next value of the iterator -or raises StopIteration if the Enumerator is at the end.

    +

    An Enumerator can also be used as an external iterator. For example, Enumerator#next returns the next value of the iterator or raises StopIteration if the Enumerator is at the end.

      e = [1,2,3].each   # returns an enumerator object.
       puts e.next   # => 1
    @@ -204,8 +196,8 @@ 

    Overview

    -
    - +
    +

    Direct Known Subclasses

    Lazy

    @@ -230,117 +222,6 @@

    Constants included

    Enumerable::NONE

    -

    Instance Attribute Summary collapse

    -
      - -
    • - - - #args ⇒ Object - - - - - - - - - - - - - - - - -

      Returns the value of attribute args.

      -
      - -
    • - - -
    • - - - #fib ⇒ Object - - - - - - - - - readonly - - - - - - - - - -

      Returns the value of attribute fib.

      -
      - -
    • - - -
    • - - - #meth ⇒ Object - - - - - - - - - - - - - - - - -

      Returns the value of attribute meth.

      -
      - -
    • - - -
    • - - - #obj ⇒ Object - - - - - - - - - - - - - - - - -

      Returns the value of attribute obj.

      -
      - -
    • - - -
    - @@ -369,14 +250,8 @@

    -
    - - - - - - -
    call-seq: Enumerator.produce(initial = nil) val -> enumerator.
    +
    +

    call-seq: Enumerator.produce(initial = nil) { |val| } -> enumerator.

    @@ -408,8 +283,7 @@

    -
    -
    +
    @@ -431,17 +305,8 @@

    -
    - - - - - - - - - -
    call-seq: enum.each {elmblock } -> obj enum.each -> enum enum.each(*appending_args) {elmblock } -> obj enum.each(*appending_args) -> an_enumerator.
    +
    +

    call-seq: enum.each { |elm| block } -> obj enum.each -> enum enum.each(appending_args) { |elm| block } -> obj enum.each(appending_args) -> an_enumerator.

    @@ -464,15 +329,8 @@

    -
    - - - - - - - -
    call-seq: e.each_with_index {(*args), idx… } e.each_with_index.
    +
    +

    call-seq: e.each_with_index {|(*args), idx| … } e.each_with_index.

    @@ -495,7 +353,8 @@

    -

    call-seq: e.feed obj -> nil.

    +
    +

    call-seq: e.feed obj -> nil.

    @@ -504,7 +363,7 @@

  • - #initialize(obj, method = :each, *args) ⇒ Enumerator + #initialize(obj, method = :each, *args, **kwd) ⇒ Enumerator @@ -520,7 +379,8 @@

    -

    Creates a new Enumerator object, which can be used as an Enumerable.

    +
    +

    Creates a new Enumerator object, which can be used as an Enumerable.

  • @@ -543,8 +403,7 @@

    -
    -
    +
    @@ -566,8 +425,7 @@

    -
    -
    +
    @@ -589,7 +447,8 @@

    -

    call-seq: e.next -> object.

    +
    +

    call-seq: e.next -> object.

    @@ -612,7 +471,8 @@

    -

    call-seq: e.next_values -> array.

    +
    +

    call-seq: e.next_values -> array.

    @@ -635,7 +495,8 @@

    -

    call-seq: e.peek -> object.

    +
    +

    call-seq: e.peek -> object.

    @@ -658,7 +519,8 @@

    -

    call-seq: e.peek_values -> array.

    +
    +

    call-seq: e.peek_values -> array.

    @@ -681,9 +543,32 @@

    -

    call-seq: e.rewind -> e.

    +
    +

    call-seq: e.rewind -> e.

    + + + +
  • + + + #size ⇒ Object + + + + + + + + + + + + + +
    +
  • @@ -704,15 +589,8 @@

    -
    - - - - - - - -
    call-seq: e.with_index(offset = 0) {(*args), idx… } e.with_index(offset = 0).
    +
    +

    call-seq: e.with_index(offset = 0) {|(*args), idx| … } e.with_index(offset = 0).

    @@ -735,17 +613,8 @@

    -
    - - - - - - - - - -
    call-seq: e.each_with_object(obj) {(*args), obj… } e.each_with_object(obj) e.with_object(obj) {(*args), obj… } e.with_object(obj).
    +
    +

    call-seq: e.each_with_object(obj) {|(args), obj| … } e.each_with_object(obj) e.with_object(obj) {|(args), obj| … } e.with_object(obj).

    @@ -764,14 +633,14 @@

    Methods included from Enumerable

    -

    __update_hash, #all?, #any?, #chain, #collect, #count, #cycle, #detect, #drop, #drop_while, #each_cons, #each_slice, #each_with_object, #entries, #filter_map, #find_all, #find_index, #first, #flat_map, #grep, #group_by, #hash, #include?, #inject, #lazy, #max, #max_by, #min, #min_by, #minmax, #minmax_by, #none?, #one?, #partition, #reject, #reverse_each, #sort, #sort_by, #take, #take_while, #tally, #to_h, #uniq, #zip

    +

    #all?, #any?, #chain, #chunk, #chunk_while, #collect, #count, #cycle, #detect, #drop, #drop_while, #each_cons, #each_entry, #each_slice, #each_with_object, #entries, #filter_map, #find_all, #find_index, #first, #flat_map, #grep, #grep_v, #group_by, #hash, #include?, #inject, #lazy, #max, #max_by, #min, #min_by, #minmax, #minmax_by, #none?, #one?, #partition, #reject, #reverse_each, #sort, #sort_by, #sum, #take, #take_while, #tally, #to_h, #uniq, #zip

    Constructor Details

    - #initialize(obj, method = :each, *args) ⇒ Enumerator + #initialize(obj, method = :each, *args, **kwd) ⇒ Enumerator @@ -779,12 +648,10 @@

    -

    Creates a new Enumerator object, which can be used as an -Enumerable.

    + +

    Creates a new Enumerator object, which can be used as an Enumerable.

    -

    In the first form, iteration is defined by the given block, in -which a “yielder” object, given as block parameter, can be used to -yield a value by calling the +yield+ method (aliased as +«+):

    +

    In the first form, iteration is defined by the given block, in which a “yielder” object, given as block parameter, can be used to yield a value by calling the yield method (aliased as +<<+):

    fib = Enumerator.new do |y|
       a = b = 1
    @@ -797,12 +664,9 @@ 

    p fib.take(10) # => [1, 1, 2, 3, 5, 8, 13, 21, 34, 55]

    -

    In the second, deprecated, form, a generated Enumerator iterates over the -given object using the given method with the given arguments passed. This -form is left only for internal use.

    +

    In the second, deprecated, form, a generated Enumerator iterates over the given object using the given method with the given arguments passed. This form is left only for internal use.

    -

    Use of this form is discouraged. Use Kernel#enum_for or Kernel#to_enum -instead.

    +

    Use of this form is discouraged. Use Kernel#enum_for or Kernel#to_enum instead.

    @@ -812,8 +676,8 @@

    -

    - +
    +
    @@ -835,21 +699,23 @@

    129 130 131 -132 +132 +133

    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 117
     
    -def initialize(obj=NONE, meth=:each, *args, &block)
    +def initialize(obj=NONE, meth=:each, *args, **kwd, &block)
       if block
         obj = Generator.new(&block)
    -  elsif obj == NONE
    +  elsif NONE.equal?(obj)
         raise ArgumentError, "wrong number of arguments (given 0, expected 1+)"
       end
     
       @obj = obj
       @meth = meth
       @args = args
    +  @kwd = kwd
       @fib = nil
       @dst = nil
       @lookahead = nil
    @@ -863,187 +729,6 @@ 

    -
    -

    Instance Attribute Details

    - - - -
    -

    - - #argsObject - - - - - -

    -
    -

    Returns the value of attribute args

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -133
    -134
    -135
    -
    -
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 133
    -
    -def args
    -  @args
    -end
    -
    -
    - - - -
    -

    - - #fibObject (readonly) - - - - - -

    -
    -

    Returns the value of attribute fib

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -134
    -135
    -136
    -
    -
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 134
    -
    -def fib
    -  @fib
    -end
    -
    -
    - - - -
    -

    - - #methObject - - - - - -

    -
    -

    Returns the value of attribute meth

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -133
    -134
    -135
    -
    -
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 133
    -
    -def meth
    -  @meth
    -end
    -
    -
    - - - -
    -

    - - #objObject - - - - - -

    -
    -

    Returns the value of attribute obj

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -133
    -134
    -135
    -
    -
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 133
    -
    -def obj
    -  @obj
    -end
    -
    -
    - -
    -

    Class Method Details

    @@ -1060,38 +745,20 @@

    -

    call-seq: - Enumerator.produce(initial = nil) { |val| } -> enumerator

    + +

    call-seq: Enumerator.produce(initial = nil) { |val| } -> enumerator

    -

    Creates an infinite enumerator from any block, just called over and -over. Result of the previous iteration is passed to the next one. -If +initial+ is provided, it is passed to the first iteration, and -becomes the first element of the enumerator; if it is not provided, -first iteration receives +nil+, and its result becomes first -element of the iterator.

    +

    Creates an infinite enumerator from any block, just called over and over. Result of the previous iteration is passed to the next one. If initial is provided, it is passed to the first iteration, and becomes the first element of the enumerator; if it is not provided, first iteration receives nil, and its result becomes first element of the iterator.

    Raising StopIteration from the block stops an iteration.

    Examples of usage:

    -

    Enumerator.produce(1, &:succ) # => enumerator of 1, 2, 3, 4, ….

    +

    Enumerator.produce(1, &:succ) # => enumerator of 1, 2, 3, 4, …

    Enumerator.produce { rand(10) } # => infinite random number sequence

    - - - - - - - - - - - - - -
    ancestors = Enumerator.produce(node) {prevnode = prev.parent or raise StopIteration }
    enclosing_section = ancestors.find {nn.type == :section }
    +

    ancestors = Enumerator.produce(node) { |prev| node = prev.parent or raise StopIteration } enclosing_section = ancestors.find { |n| n.type == :section }

    @@ -1112,40 +779,40 @@

    -

    - +
    +
     
     
    -580
    -581
    -582
    -583
    -584
    -585
    -586
    -587
    -588
    -589
    -590
    -591
    -592
    -593
    -594
     595
     596
    -597
    +597 +598 +599 +600 +601 +602 +603 +604 +605 +606 +607 +608 +609 +610 +611 +612
    -
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 580
    +      
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 595
     
     def Enumerator.produce(init=NONE, &block)
       raise ArgumentError, "no block given" if block.nil?
       Enumerator.new do |y|
    -    if init == NONE
    +    if NONE.equal?(init)
           val = nil
         else
           val = init
    @@ -1212,40 +879,24 @@ 

    -

    call-seq: - enum.each { |elm| block } -> obj - enum.each -> enum - enum.each(appending_args) { |elm| block } -> obj - enum.each(appending_args) -> an_enumerator

    + +

    call-seq: enum.each { |elm| block } -> obj enum.each -> enum enum.each(appending_args) { |elm| block } -> obj enum.each(appending_args) -> an_enumerator

    -

    Iterates over the block according to how this Enumerator was constructed. -If no block and no arguments are given, returns self.

    +

    Iterates over the block according to how this Enumerator was constructed. If no block and no arguments are given, returns self.

    === Examples

    -

    Array.new(3) #=> [nil, nil, nil] - Array.new(3) { |i| i } #=> [0, 1, 2] - Array.to_enum(:new, 3).to_a #=> [0, 1, 2] - Array.to_enum(:new).each(3).to_a #=> [0, 1, 2]

    +

    Array.new(3) #=> [nil, nil, nil] Array.new(3) { |i| i } #=> [0, 1, 2] Array.to_enum(:new, 3).to_a #=> [0, 1, 2] Array.to_enum(:new).each(3).to_a #=> [0, 1, 2]

    obj = Object.new

    -

    def obj.each_arg(a, b=:b, *rest) - yield a - yield b - yield rest - :method_returned - end

    +

    def obj.each_arg(a, b=:b, *rest) yield a yield b yield rest :method_returned end

    enum = obj.to_enum :each_arg, :a, :x

    -

    enum.each.to_a #=> [:a, :x, []] - enum.each.equal?(enum) #=> true - enum.each { |elm| elm } #=> :method_returned

    +

    enum.each.to_a #=> [:a, :x, []] enum.each.equal?(enum) #=> true enum.each { |elm| elm } #=> :method_returned

    -

    enum.each(:y, :z).to_a #=> [:a, :x, [:y, :z]] - enum.each(:y, :z).equal?(enum) #=> false - enum.each(:y, :z) { |elm| elm } #=> :method_returned

    +

    enum.each(:y, :z).to_a #=> [:a, :x, [:y, :z]] enum.each(:y, :z).equal?(enum) #=> false enum.each(:y, :z) { |elm| elm } #=> :method_returned

    @@ -1253,49 +904,49 @@

    -
    - +

    + @@ -1313,9 +964,8 @@

    -

    call-seq: - e.each_with_index {|(*args), idx| … } - e.each_with_index

    + +

    call-seq: e.each_with_index {|(*args), idx| … } e.each_with_index

    Same as Enumerator#with_index(0), i.e. there is no starting offset.

    @@ -1327,20 +977,20 @@

    -
    - +

    +
     
     
    -270
    -271
    -272
    -273
    -274
    -275
    -276
    -277
    -278
    -279
    -280
    -281
    -282
    -283
    -284
    -285
    +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300
    -
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 270
    +      
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 285
     
     def each(*argv, &block)
       obj = self
       if 0 < argv.length
         obj = self.dup
    -    args = obj.args
    +    args = obj.instance_eval{@args}
         if !args.empty?
           args = args.dup
           args.concat argv
         else
           args = argv.dup
         end
    -    obj.args = args
    +    obj.instance_eval{@args = args}
       end
       return obj unless block
    -  enumerator_block_call(&block)
    +  __enumerator_block_call(&block)
     end
     
     
    -184
    -185
    -186
    +191 +192 +193
    -
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 184
    +      
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 191
     
     def each_with_index(&block)
       with_index(0, &block)
    @@ -1361,49 +1011,20 @@ 

    -

    call-seq: - e.feed obj -> nil

    + +

    call-seq: e.feed obj -> nil

    -

    Sets the value to be returned by the next yield inside +e+.

    +

    Sets the value to be returned by the next yield inside e.

    If the value is not set, the yield returns nil.

    This value is cleared after being yielded.

    -

    # Array#map passes the array’s elements to “yield” and collects the - # results of “yield” as an array. - # Following example shows that “next” returns the passed elements and - # values passed to “feed” are collected as an array which can be - # obtained by StopIteration#result. - e = [1,2,3].map - p e.next #=> 1 - e.feed “a” - p e.next #=> 2 - e.feed “b” - p e.next #=> 3 - e.feed “c” - begin - e.next - rescue StopIteration - p $!.result #=> [“a”, “b”, “c”] - end

    - -

    o = Object.new - def o.each - x = yield # (2) blocks - p x # (5) => “foo” - x = yield # (6) blocks - p x # (8) => nil - x = yield # (9) blocks - p x # not reached w/o another e.next - end

    - -

    e = o.to_enum - e.next # (1) - e.feed “foo” # (3) - e.next # (4) - e.next # (7) - # (10)

    +

    # Array#map passes the array’s elements to “yield” and collects the # results of “yield” as an array. # Following example shows that “next” returns the passed elements and # values passed to “feed” are collected as an array which can be # obtained by StopIteration#result. e = [1,2,3].map p e.next #=> 1 e.feed “a” p e.next #=> 2 e.feed “b” p e.next #=> 3 e.feed “c” begin e.next rescue StopIteration p $!.result #=> [“a”, “b”, “c”] end

    + +

    o = Object.new def o.each x = yield # (2) blocks p x # (5) => “foo” x = yield # (6) blocks p x # (8) => nil x = yield # (9) blocks p x # not reached w/o another e.next end

    + +

    e = o.to_enum e.next # (1) e.feed “foo” # (3) e.next # (4) e.next # (7) # (10)

    @@ -1424,22 +1045,22 @@

    -

    - + +
     
     
    -520
    -521
    -522
    -523
    -524
    +535 +536 +537 +538 +539
    -
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 520
    +      
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 535
     
     def feed(value)
       raise TypeError, "feed value already set" if @feedvalue
    @@ -1464,7 +1085,6 @@ 

    -
    @@ -1483,14 +1103,15 @@

    -

    - + +
     
     
    +135
     136
     137
     138
    @@ -1501,17 +1122,32 @@ 

    143 144 145 -146

    +146 +147 +148 +149 +150 +151 +152 +153
    -
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 136
    +      
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 135
     
     def initialize_copy(obj)
       raise TypeError, "can't copy type #{obj.class}" unless obj.kind_of? Enumerator
    -  raise TypeError, "can't copy execution context" if obj.fib
    -  @obj = obj.obj
    -  @meth = obj.meth
    -  @args = obj.args
    +  raise TypeError, "can't copy execution context" if obj.instance_eval{@fib}
    +  meth = args = kwd = fib = nil
    +  obj.instance_eval {
    +    obj = @obj
    +    meth = @meth
    +    args = @args
    +    kwd = @kwd
    +  }
    +  @obj = obj
    +  @meth = meth
    +  @args = args
    +  @kwd = kwd
       @fib = nil
       @lookahead = nil
       @feedvalue = nil
    @@ -1537,17 +1173,17 @@ 

     
     
    -225
    -226
    -227
    -228
    -229
    -230
    -231
    -232
    +232 +233 +234 +235 +236 +237 +238 +239

    -
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 225
    +      
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 232
     
     def inspect
       if @args && @args.size > 0
    @@ -1573,24 +1209,16 @@ 

    -

    call-seq: - e.next -> object

    + +

    call-seq: e.next -> object

    -

    Returns the next object in the enumerator, and move the internal position -forward. When the position reached at the end, StopIteration is raised.

    +

    Returns the next object in the enumerator, and move the internal position forward. When the position reached at the end, StopIteration is raised.

    === Example

    -

    a = [1,2,3] - e = a.to_enum - p e.next #=> 1 - p e.next #=> 2 - p e.next #=> 3 - p e.next #raises StopIteration

    +

    a = [1,2,3] e = a.to_enum p e.next #=> 1 p e.next #=> 2 p e.next #=> 3 p e.next #raises StopIteration

    -

    Note that enumeration sequence by +next+ does not affect other non-external -enumeration methods, unless the underlying iteration methods itself has -side-effect

    +

    Note that enumeration sequence by next does not affect other non-external enumeration methods, unless the underlying iteration methods itself has side-effect

    @@ -1598,20 +1226,20 @@

    -
    - +

    +
     
     
    -312
    -313
    -314
    +327 +328 +329
    -
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 312
    +      
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 327
     
     def next
       next_values.__svalue
    @@ -1632,48 +1260,20 @@ 

    -

    call-seq: - e.next_values -> array

    + +

    call-seq: e.next_values -> array

    -

    Returns the next object as an array in the enumerator, and move the -internal position forward. When the position reached at the end, -StopIteration is raised.

    +

    Returns the next object as an array in the enumerator, and move the internal position forward. When the position reached at the end, StopIteration is raised.

    -

    This method can be used to distinguish yield and yield -nil.

    +

    This method can be used to distinguish yield and yield nil.

    === Example

    -

    o = Object.new - def o.each - yield - yield 1 - yield 1, 2 - yield nil - yield [1, 2] - end - e = o.to_enum - p e.next_values - p e.next_values - p e.next_values - p e.next_values - p e.next_values - e = o.to_enum - p e.next - p e.next - p e.next - p e.next - p e.next

    - -

    ## yield args next_values next - # yield [] nil - # yield 1 [1] 1 - # yield 1, 2 [1, 2] [1, 2] - # yield nil [nil] nil - # yield [1, 2] [[1, 2]] [1, 2]

    - -

    Note that +next_values+ does not affect other non-external enumeration -methods unless underlying iteration method itself has side-effect

    +

    o = Object.new def o.each yield yield 1 yield 1, 2 yield nil yield [1, 2] end e = o.to_enum p e.next_values p e.next_values p e.next_values p e.next_values p e.next_values e = o.to_enum p e.next p e.next p e.next p e.next p e.next

    + +

    ## yield args next_values next # yield [] nil # yield 1 [1] 1 # yield 1, 2 [1, 2] [1, 2] # yield nil [nil] nil # yield [1, 2] [[1, 2]] [1, 2]

    + +

    Note that next_values does not affect other non-external enumeration methods unless underlying iteration method itself has side-effect

    @@ -1694,29 +1294,14 @@

    -

    - + +
     
     
    -360
    -361
    -362
    -363
    -364
    -365
    -366
    -367
    -368
    -369
    -370
    -371
    -372
    -373
    -374
     375
     376
     377
    @@ -1740,10 +1325,25 @@ 

    395 396 397 -398

    +398 +399 +400 +401 +402 +403 +404 +405 +406 +407 +408 +409 +410 +411 +412 +413
    -
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 360
    +      
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 375
     
     def next_values
       if @lookahead
    @@ -1800,24 +1400,14 @@ 

    -

    call-seq: - e.peek -> object

    + +

    call-seq: e.peek -> object

    -

    Returns the next object in the enumerator, but doesn’t move the internal -position forward. If the position is already at the end, StopIteration -is raised.

    +

    Returns the next object in the enumerator, but doesn’t move the internal position forward. If the position is already at the end, StopIteration is raised.

    === Example

    -

    a = [1,2,3] - e = a.to_enum - p e.next #=> 1 - p e.peek #=> 2 - p e.peek #=> 2 - p e.peek #=> 2 - p e.next #=> 2 - p e.next #=> 3 - p e.next #raises StopIteration

    +

    a = [1,2,3] e = a.to_enum p e.next #=> 1 p e.peek #=> 2 p e.peek #=> 2 p e.peek #=> 2 p e.next #=> 2 p e.next #=> 3 p e.next #raises StopIteration

    @@ -1825,20 +1415,20 @@

    -
    - +

    +
     
     
    -420
    -421
    -422
    +435 +436 +437
    -
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 420
    +      
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 435
     
     def peek
       peek_values.__svalue
    @@ -1859,30 +1449,14 @@ 

    -

    call-seq: - e.peek_values -> array

    + +

    call-seq: e.peek_values -> array

    -

    Returns the next object as an array, similar to Enumerator#next_values, but -doesn’t move the internal position forward. If the position is already at -the end, StopIteration is raised.

    +

    Returns the next object as an array, similar to Enumerator#next_values, but doesn’t move the internal position forward. If the position is already at the end, StopIteration is raised.

    === Example

    -

    o = Object.new - def o.each - yield - yield 1 - yield 1, 2 - end - e = o.to_enum - p e.peek_values #=> [] - e.next - p e.peek_values #=> [1] - p e.peek_values #=> [1] - e.next - p e.peek_values #=> [1, 2] - e.next - p e.peek_values # raises StopIteration

    +

    o = Object.new def o.each yield yield 1 yield 1, 2 end e = o.to_enum p e.peek_values #=> [] e.next p e.peek_values #=> [1] p e.peek_values #=> [1] e.next p e.peek_values #=> [1, 2] e.next p e.peek_values # raises StopIteration

    @@ -1890,23 +1464,23 @@

    -
    - +

    +
     
     
    -450
    -451
    -452
    -453
    -454
    -455
    +465 +466 +467 +468 +469 +470
    -
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 450
    +      
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 465
     
     def peek_values
       if @lookahead.nil?
    @@ -1930,8 +1504,8 @@ 

    -

    call-seq: - e.rewind -> e

    + +

    call-seq: e.rewind -> e

    Rewinds the enumeration sequence to the beginning.

    @@ -1943,26 +1517,26 @@

    -
    - +

    +
     
     
    -465
    -466
    -467
    -468
    -469
    -470
    -471
    -472
    -473
    +480 +481 +482 +483 +484 +485 +486 +487 +488
    -
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 465
    +      
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 480
     
     def rewind
       @obj.rewind if @obj.respond_to? :rewind
    @@ -1976,6 +1550,44 @@ 

    +
    + +
    +

    + + #sizeObject + + + + + +

    + + + + +
    +
    +
    +
    +241
    +242
    +243
    +244
    +245
    +246
    +247
    +
    +
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 241
    +
    +def size
    +  if @size
    +    @size
    +  elsif @obj.respond_to?(:size)
    +    @obj.size
    +  end
    +end
    +
    @@ -1989,15 +1601,12 @@

    -

    call-seq: - e.with_index(offset = 0) {|(*args), idx| … } - e.with_index(offset = 0)

    + +

    call-seq: e.with_index(offset = 0) {|(*args), idx| … } e.with_index(offset = 0)

    -

    Iterates the given block for each element with an index, which -starts from +offset+. If no block is given, returns a new Enumerator -that includes the index, starting from +offset+

    +

    Iterates the given block for each element with an index, which starts from offset. If no block is given, returns a new Enumerator that includes the index, starting from offset

    -

    +offset+:: the starting index to use

    +

    offset:: the starting index to use

    @@ -2005,21 +1614,14 @@

    -
    - +

    +
     
     
    -159
    -160
    -161
    -162
    -163
    -164
    -165
     166
     167
     168
    @@ -2027,10 +1629,17 @@ 

    170 171 172 -173

    +173 +174 +175 +176 +177 +178 +179 +180
    -
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 159
    +      
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 166
     
     def with_index(offset=0, &block)
       return to_enum :with_index, offset unless block
    @@ -2042,7 +1651,7 @@ 

    end n = offset - 1 - enumerator_block_call do |*i| + __enumerator_block_call do |*i| n += 1 block.call i.__svalue, n end @@ -2063,14 +1672,10 @@

    -

    call-seq: - e.each_with_object(obj) {|(args), obj| … } - e.each_with_object(obj) - e.with_object(obj) {|(args), obj| … } - e.with_object(obj)

    + +

    call-seq: e.each_with_object(obj) {|(args), obj| … } e.each_with_object(obj) e.with_object(obj) {|(args), obj| … } e.with_object(obj)

    -

    Iterates the given block for each element with an arbitrary object, +obj+, -and returns +obj+

    +

    Iterates the given block for each element with an arbitrary object, obj, and returns obj

    If no block is given, returns a new Enumerator.

    @@ -2080,7 +1685,7 @@

    -

    Examples:

    +

    Examples:

    to_three = Enumerator.new do |y|
    @@ -2101,30 +1706,30 @@ 

    -
    - +

    +
     
     
    -216
    -217
    -218
    -219
    -220
    -221
    -222
    -223
    +223 +224 +225 +226 +227 +228 +229 +230
    -
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 216
    +      
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 223
     
     def with_object(object, &block)
       return to_enum(:with_object, object) unless block
     
    -  enumerator_block_call do |i|
    +  __enumerator_block_call do |i|
         block.call [i,object]
       end
       object
    @@ -2138,11 +1743,11 @@ 

    - + diff --git a/docs/api/Enumerator/Chain.html b/docs/api/Enumerator/Chain.html index dec58e4..09b49f2 100644 --- a/docs/api/Enumerator/Chain.html +++ b/docs/api/Enumerator/Chain.html @@ -6,17 +6,17 @@ Class: Enumerator::Chain - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -146,8 +146,7 @@

    -
    -
    +
    @@ -169,8 +168,7 @@

    -
    -
    +
    @@ -194,7 +192,8 @@

    -

    A new instance of Chain.

    +
    +

    A new instance of Chain.

    @@ -217,8 +216,7 @@

    -
    -
    +
    @@ -240,8 +238,7 @@

    -
    -
    +
    @@ -263,8 +260,7 @@

    -
    -
    +
    @@ -282,7 +278,7 @@

    Methods included from Enumerable

    -

    __update_hash, #all?, #any?, #chain, #collect, #count, #cycle, #detect, #drop, #drop_while, #each_cons, #each_slice, #each_with_index, #each_with_object, #entries, #filter_map, #find_all, #find_index, #first, #flat_map, #grep, #group_by, #hash, #include?, #inject, #lazy, #max, #max_by, #min, #min_by, #minmax, #minmax_by, #none?, #one?, #partition, #reject, #reverse_each, #sort, #sort_by, #take, #take_while, #tally, #to_h, #uniq, #zip

    +

    #all?, #any?, #chain, #chunk, #chunk_while, #collect, #count, #cycle, #detect, #drop, #drop_while, #each_cons, #each_entry, #each_slice, #each_with_index, #each_with_object, #entries, #filter_map, #find_all, #find_index, #first, #flat_map, #grep, #grep_v, #group_by, #hash, #include?, #inject, #lazy, #max, #max_by, #min, #min_by, #minmax, #minmax_by, #none?, #one?, #partition, #reject, #reverse_each, #sort, #sort_by, #sum, #take, #take_while, #tally, #to_h, #uniq, #zip

    Constructor Details

    @@ -297,7 +293,8 @@

    -

    Returns a new instance of Chain

    + +

    Returns a new instance of Chain.

    @@ -305,8 +302,8 @@

    -
    - +

    +
    @@ -527,11 +524,11 @@

    - + diff --git a/docs/api/Enumerator/Generator.html b/docs/api/Enumerator/Generator.html index f9f5982..8428fff 100644 --- a/docs/api/Enumerator/Generator.html +++ b/docs/api/Enumerator/Generator.html @@ -6,17 +6,17 @@ Class: Enumerator::Generator - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -110,7 +110,8 @@

    Overview

    -

    just for internal

    + +

    just for internal

    @@ -118,8 +119,8 @@

    Overview

    -
    - +
    + @@ -158,8 +159,7 @@

    -
    -
    +
    @@ -183,7 +183,8 @@

    -

    A new instance of Generator.

    +
    +

    A new instance of Generator.

    @@ -202,7 +203,7 @@

    Methods included from Enumerable

    -

    __update_hash, #all?, #any?, #chain, #collect, #count, #cycle, #detect, #drop, #drop_while, #each_cons, #each_slice, #each_with_index, #each_with_object, #entries, #filter_map, #find_all, #find_index, #first, #flat_map, #grep, #group_by, #hash, #include?, #inject, #lazy, #max, #max_by, #min, #min_by, #minmax, #minmax_by, #none?, #one?, #partition, #reject, #reverse_each, #sort, #sort_by, #take, #take_while, #tally, #to_h, #uniq, #zip

    +

    #all?, #any?, #chain, #chunk, #chunk_while, #collect, #count, #cycle, #detect, #drop, #drop_while, #each_cons, #each_entry, #each_slice, #each_with_index, #each_with_object, #entries, #filter_map, #find_all, #find_index, #first, #flat_map, #grep, #grep_v, #group_by, #hash, #include?, #inject, #lazy, #max, #max_by, #min, #min_by, #minmax, #minmax_by, #none?, #one?, #partition, #reject, #reverse_each, #sort, #sort_by, #sum, #take, #take_while, #tally, #to_h, #uniq, #zip

    Constructor Details

    @@ -217,7 +218,8 @@

    -

    Returns a new instance of Generator

    + +

    Returns a new instance of Generator.

    @@ -238,22 +240,22 @@

    -

    - +
    + @@ -1006,23 +1056,23 @@

     
     
    -161
    -162
    -163
    -164
    -165
    -166
    -167
    -168
    -169
    -170
    -171
    -172
     173
    -174
    +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186

     
     
    -529
    -530
    -531
    -532
    -533
    +544 +545 +546 +547 +548
    -
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 529
    +      
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 544
     
     def initialize(&block)
       raise TypeError, "wrong argument type #{self.class} (expected Proc)" unless block.kind_of? Proc
    @@ -287,13 +289,13 @@ 

     
     
    -535
    -536
    -537
    -538
    +550 +551 +552 +553

    -
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 535
    +      
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 550
     
     def each(*args, &block)
       args.unshift Yielder.new(&block)
    @@ -308,11 +310,11 @@ 

    - + diff --git a/docs/api/Enumerator/Lazy.html b/docs/api/Enumerator/Lazy.html index a16110f..718343c 100644 --- a/docs/api/Enumerator/Lazy.html +++ b/docs/api/Enumerator/Lazy.html @@ -6,17 +6,17 @@ Class: Enumerator::Lazy - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -107,11 +107,10 @@

    Overview

    -

    == Acknowledgements

    + +

    == Acknowledgements

    -

    Based on https://github.com/yhara/enumerable-lazy - Inspired by https://github.com/antimon2/enumerable_lz - http://jp.rubyist.net/magazine/?0034-Enumerable_lz (ja)

    +

    Based on github.com/yhara/enumerable-lazy Inspired by github.com/antimon2/enumerable_lz jp.rubyist.net/magazine/?0034-Enumerable_lz (ja)

    @@ -119,8 +118,8 @@

    Overview

    -
    - +
    + @@ -133,11 +132,6 @@

    Constants included -

    Instance Attribute Summary

    - -

    Attributes inherited from Enumerator

    -

    #args, #fib, #meth, #obj

    -

    @@ -164,8 +158,7 @@

    -
    -
    +
    @@ -187,8 +180,7 @@

    -
    -
    +
    @@ -212,8 +204,7 @@

    -
    -
    +
    @@ -235,8 +226,29 @@

    -
    -
    +
    + + + + +
  • + + + #grep_v(pattern) ⇒ Object + + + + + + + + + + + + + +
  • @@ -260,7 +272,8 @@

    -

    A new instance of Lazy.

    +
    +

    A new instance of Lazy.

    @@ -285,8 +298,7 @@

    -
    -
    +
    @@ -308,8 +320,7 @@

    -
    -
    +
    @@ -333,8 +344,7 @@

    -
    -
    +
    @@ -356,8 +366,7 @@

    -
    -
    +
    @@ -379,8 +388,7 @@

    -
    -
    +
    @@ -404,8 +412,7 @@

    -
    -
    +
    @@ -427,8 +434,7 @@

    -
    -
    +
    @@ -450,8 +456,7 @@

    -
    -
    +
    @@ -469,7 +474,7 @@

    Methods inherited from Enumerator

    -

    #+, #each, #each_with_index, #feed, #initialize_copy, #inspect, #next, #next_values, #peek, #peek_values, produce, #rewind, #with_index, #with_object

    +

    #+, #each, #each_with_index, #feed, #initialize_copy, #inspect, #next, #next_values, #peek, #peek_values, produce, #rewind, #size, #with_index, #with_object

    @@ -480,7 +485,7 @@

    Methods inherited from Methods included from Enumerable

    -

    __update_hash, #all?, #any?, #chain, #count, #cycle, #detect, #each_cons, #each_slice, #each_with_index, #each_with_object, #entries, #filter_map, #find_index, #first, #group_by, #hash, #include?, #inject, #lazy, #max, #max_by, #min, #min_by, #minmax, #minmax_by, #none?, #one?, #partition, #reverse_each, #sort, #sort_by, #tally, #to_h

    +

    #all?, #any?, #chain, #chunk, #chunk_while, #count, #cycle, #detect, #each_cons, #each_entry, #each_slice, #each_with_index, #each_with_object, #entries, #filter_map, #find_index, #first, #group_by, #hash, #include?, #inject, #lazy, #max, #max_by, #min, #min_by, #minmax, #minmax_by, #none?, #one?, #partition, #reverse_each, #sort, #sort_by, #sum, #tally, #to_h

    Constructor Details

    @@ -495,7 +500,8 @@

    -

    Returns a new instance of Lazy

    + +

    Returns a new instance of Lazy.

    @@ -503,15 +509,14 @@

    -
    - +

    +
     
     
    -30
     31
     32
     33
    @@ -524,10 +529,11 @@ 

    40 41 42 -43

    +43 +44
    -
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 30
    +      
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 31
     
     def initialize(obj, &block)
       super(){|yielder|
    @@ -570,19 +576,19 @@ 

     
     
    -89
    -90
    -91
    -92
    -93
    -94
    -95
    -96
    -97
    -98
    +101 +102 +103 +104 +105 +106 +107 +108 +109 +110

    -
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 89
    +      
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 101
     
     def drop(n)
       dropped = 0
    @@ -614,22 +620,22 @@ 

     
     
    -100
    -101
    -102
    -103
    -104
    -105
    -106
    -107
    -108
    -109
    -110
    -111
    -112
    +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124

    -
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 100
    +      
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 112
     
     def drop_while(&block)
       dropping = true
    @@ -668,18 +674,18 @@ 

     
     
    -138
    -139
    -140
    -141
    -142
    -143
    -144
    -145
    -146
    +150 +151 +152 +153 +154 +155 +156 +157 +158

    -
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 138
    +      
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 150
     
     def flat_map(&block)
       Lazy.new(self){|yielder, val|
    @@ -710,16 +716,16 @@ 

     
     
    -81
    -82
    -83
    -84
     85
     86
    -87
    +87 +88 +89 +90 +91

    -
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 81
    +      
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 85
     
     def grep(pattern)
       Lazy.new(self){|yielder, val|
    @@ -731,6 +737,44 @@ 

    +
    + +
    +

    + + #grep_v(pattern) ⇒ Object + + + + + +

    + + + + +
    +
    +
    +
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    +
    +
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 93
    +
    +def grep_v(pattern)
    +  Lazy.new(self){|yielder, val|
    +    unless pattern === val
    +      yielder << val
    +    end
    +  }
    +end
    +
    @@ -752,14 +796,14 @@

     
     
    -57
    -58
    -59
    -60
    -61
    +61 +62 +63 +64 +65

    -
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 57
    +      
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 61
     
     def map(&block)
       Lazy.new(self){|yielder, val|
    @@ -786,16 +830,16 @@ 

     
     
    -73
    -74
    -75
    -76
     77
     78
    -79
    +79 +80 +81 +82 +83

    -
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 73
    +      
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 77
     
     def reject(&block)
       Lazy.new(self){|yielder, val|
    @@ -828,16 +872,16 @@ 

     
     
    -64
    -65
    -66
    -67
     68
     69
    -70
    +70 +71 +72 +73 +74

    -
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 64
    +      
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 68
     
     def select(&block)
       Lazy.new(self){|yielder, val|
    @@ -866,22 +910,22 @@ 

     
     
    -114
    -115
    -116
    -117
    -118
    -119
    -120
    -121
    -122
    -123
    -124
    -125
    -126
    +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138

    -
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 114
    +      
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 126
     
     def take(n)
       if n == 0
    @@ -916,18 +960,18 @@ 

     
     
    -128
    -129
    -130
    -131
    -132
    -133
    -134
    -135
    -136
    +140 +141 +142 +143 +144 +145 +146 +147 +148

    -
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 128
    +      
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 140
     
     def take_while(&block)
       Lazy.new(self){|yielder, val|
    @@ -962,7 +1006,6 @@ 

     
     
    -45
     46
     47
     48
    @@ -971,19 +1014,26 @@ 

    51 52 53 -54

    +54 +55 +56 +57 +58

    -
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 45
    +      
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 46
     
     def to_enum(meth=:each, *args, &block)
       unless self.respond_to?(meth)
         raise ArgumentError, "undefined method #{meth}"
       end
       lz = Lazy.new(self, &block)
    -  lz.obj = self
    -  lz.meth = meth
    -  lz.args = args
    +  obj = self
    +  lz.instance_eval {
    +    @obj = obj
    +    @meth = meth
    +    @args = args
    +  }
       lz
     end
    -
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 161
    +      
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 173
     
     def uniq(&block)
       hash = {}
    @@ -1058,20 +1108,20 @@ 

     
     
    -149
    -150
    -151
    -152
    -153
    -154
    -155
    -156
    -157
    -158
    -159
    +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171

    -
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 149
    +      
    # File 'mrbgems/mruby-enum-lazy/mrblib/lazy.rb', line 161
     
     def zip(*args, &block)
       enums = [self] + args
    @@ -1093,11 +1143,11 @@ 

    - + diff --git a/docs/api/Enumerator/Yielder.html b/docs/api/Enumerator/Yielder.html index 94663fe..dd684f5 100644 --- a/docs/api/Enumerator/Yielder.html +++ b/docs/api/Enumerator/Yielder.html @@ -6,17 +6,17 @@ Class: Enumerator::Yielder - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -105,7 +105,8 @@

    Overview

    -

    just for internal

    + +

    just for internal

    @@ -113,8 +114,8 @@

    Overview

    -
    - +
    + @@ -147,8 +148,7 @@

    -
    -
    +
    @@ -172,7 +172,8 @@

    -

    A new instance of Yielder.

    +
    +

    A new instance of Yielder.

    @@ -195,8 +196,7 @@

    -
    -
    +
    @@ -218,7 +218,8 @@

    -

    Returns a new instance of Yielder

    + +

    Returns a new instance of Yielder.

    @@ -239,22 +240,22 @@

    -

    - +
    +
     
     
    -543
    -544
    -545
    -546
    -547
    +558 +559 +560 +561 +562
    -
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 543
    +      
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 558
     
     def initialize(&block)
       raise LocalJumpError, "no block given" unless block
    @@ -288,13 +289,13 @@ 

     
     
    -553
    -554
    -555
    -556
    +568 +569 +570 +571

    -
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 553
    +      
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 568
     
     def << *args
       self.yield(*args)
    @@ -320,12 +321,12 @@ 

     
     
    -549
    -550
    -551
    +564 +565 +566

    -
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 549
    +      
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 564
     
     def yield(*args)
       @proc.call(*args)
    @@ -339,11 +340,11 @@ 

    - + diff --git a/docs/api/Errno.html b/docs/api/Errno.html new file mode 100644 index 0000000..053a1bf --- /dev/null +++ b/docs/api/Errno.html @@ -0,0 +1,321 @@ + + + + + + + Module: Errno + + — Documentation by YARD 0.9.37 + + + + + + + + + + + + + + + + + + + + + + + +
    + + +

    Module: Errno + + + +

    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    mrbgems/mruby-errno/mrblib/errno.rb
    +
    + +
    + + + + + + + + + +

    + Class Method Summary + collapse +

    + + + + + + +
    +

    Class Method Details

    + + +
    +

    + + .const_defined?(name) ⇒ Boolean + + + + + +

    +
    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + +
    • + +
    + +
    + + + + + + +
    +
    +
    +
    +2
    +3
    +4
    +
    +
    # File 'mrbgems/mruby-errno/mrblib/errno.rb', line 2
    +
    +def Errno.const_defined?(name)
    +  __errno_defined?(name) or super
    +end
    +
    +
    + +
    +

    + + .const_missing(name) ⇒ Object + + + + + +

    + + + + +
    +
    +
    +
    +6
    +7
    +8
    +
    +
    # File 'mrbgems/mruby-errno/mrblib/errno.rb', line 6
    +
    +def Errno.const_missing(name)
    +  __errno_define(name) or super
    +end
    +
    +
    + +
    +

    + + .constantsObject + + + + + +

    +
    + +

    Module#constants is defined in mruby-metaprog So, it may be raised NoMethodError

    + + +
    +
    +
    + + +
    + + + + + + +
    +
    +
    +
    +12
    +13
    +14
    +
    +
    # File 'mrbgems/mruby-errno/mrblib/errno.rb', line 12
    +
    +def Errno.constants
    +  __errno_list(super)
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/api/Exception.html b/docs/api/Exception.html index fba2773..95162a7 100644 --- a/docs/api/Exception.html +++ b/docs/api/Exception.html @@ -6,17 +6,17 @@ Exception: Exception - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -70,22 +70,6 @@

    -
    -
    Inherits:
    -
    - Object - -
      -
    • Object
    • - - - -
    - show all - -
    -
    - @@ -98,27 +82,11 @@
    Defined in:
    -
    src/error.c
    +
    mrblib/10error.rb
    -

    Overview

    -
    -

    15.2.22

    - - -
    -
    -
    - - -
    - -
    -

    Direct Known Subclasses

    -

    NoMemoryError, ScriptError, StandardError, SystemStackError

    -
    @@ -137,7 +105,7 @@

  • - #backtrace ⇒ Object + #message ⇒ Object @@ -152,146 +120,7 @@

    -
    - -

  • - - -
  • - - - #exception ⇒ Object - - - - - - - - - - - - - -

    call-seq: exc.exception(string) -> an_exception or exc.

    -
    - -
  • - - -
  • - - - #new(msg = nil) ⇒ Exception - - - - - - - constructor - - - - - - - - -

    Construct a new Exception object, optionally passing in a message.

    -
    - -
  • - - -
  • - - - #inspect ⇒ String - - - - - - - - - - - - - -

    Returns this exception’s file name, line number, message and class name.

    -
    - -
  • - - -
  • - - - #message ⇒ String - - - - - - - - - - - - - -

    Returns the result of invoking exception.to_s.

    -
    - -
  • - - -
  • - - - #set_backtrace ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #to_s ⇒ String - - - - - - - - - - - - - -

    Returns exception’s message (or the name of the exception if no message is set).

    +

    call-seq: exception.message -> string.

  • @@ -300,81 +129,6 @@

    -
    -

    Constructor Details

    - -
    -

    - - #new(msg = nil) ⇒ Exception - - - - - -

    -
    -

    Construct a new Exception object, optionally passing in - a message.

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -
    -
    # File 'src/error.c', line 43
    -
    -static mrb_value
    -exc_initialize(mrb_state *mrb, mrb_value exc)
    -{
    -  mrb_value mesg;
    -
    -  if (mrb_get_args(mrb, "|o", &mesg) == 1) {
    -    mrb_iv_set(mrb, exc, mrb_intern_lit(mrb, "mesg"), mesg);
    -  }
    -  return exc;
    -}
    -
    -
    - -
    @@ -382,93 +136,9 @@

    Instance Method Details

    -

    - - #backtraceObject - - - - - -

    -
    - -
    -

    - - #exceptionObject - - - - - -

    -
    -

    call-seq: - exc.exception(string) -> an_exception or exc

    - -

    With no argument, or if the argument is the same as the receiver, -return the receiver. Otherwise, create a new -exception object of the same class as the receiver, but with a -message equal to string.

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -
    -
    # File 'src/error.c', line 67
    -
    -static mrb_value
    -exc_exception(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value exc;
    -  mrb_value a;
    -  mrb_int argc;
    -
    -  argc = mrb_get_args(mrb, "|o", &a);
    -  if (argc == 0) return self;
    -  if (mrb_obj_equal(mrb, self, a)) return self;
    -  exc = mrb_obj_clone(mrb, self);
    -  mrb_iv_set(mrb, exc, mrb_intern_lit(mrb, "mesg"), a);
    -
    -  return exc;
    -}
    -
    -
    - -
    -

    +

    - #inspectString + #messageObject @@ -476,345 +146,50 @@

    -

    Returns this exception’s file name, line number, -message and class name. -If file name or line number is not set, -returns message and class name.

    - - -
    -
    -
    - -
    -
    +

    call-seq: exception.message -> string

    - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (String) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -131
    -132
    -133
    -134
    -135
    -136
    -137
    -138
    -139
    -140
    -141
    -142
    -143
    -144
    -145
    -146
    -147
    -148
    -149
    -150
    -151
    -152
    -153
    -154
    -155
    -156
    -157
    -158
    -159
    -160
    -161
    -162
    -
    -
    # File 'src/error.c', line 131
    -
    -static mrb_value
    -exc_inspect(mrb_state *mrb, mrb_value exc)
    -{
    -  mrb_value str, mesg, file, line;
    -  mrb_bool append_mesg;
    -  const char *cname;
    -
    -  mesg = mrb_attr_get(mrb, exc, mrb_intern_lit(mrb, "mesg"));
    -  file = mrb_attr_get(mrb, exc, mrb_intern_lit(mrb, "file"));
    -  line = mrb_attr_get(mrb, exc, mrb_intern_lit(mrb, "line"));
    -
    -  append_mesg = !mrb_nil_p(mesg);
    -  if (append_mesg) {
    -    mesg = mrb_obj_as_string(mrb, mesg);
    -    append_mesg = RSTRING_LEN(mesg) > 0;
    -  }
    -
    -  cname = mrb_obj_classname(mrb, exc);
    -  str = mrb_str_new_cstr(mrb, cname);
    -  if (mrb_string_p(file) && mrb_fixnum_p(line)) {
    -    if (append_mesg) {
    -      str = mrb_format(mrb, "%v:%v: %v (%v)", file, line, mesg, str);
    -    }
    -    else {
    -      str = mrb_format(mrb, "%v:%v: %v", file, line, str);
    -    }
    -  }
    -  else if (append_mesg) {
    -    str = mrb_format(mrb, "%v: %v", str, mesg);
    -  }
    -  return str;
    -}
    -
    -
    - -
    -

    - - #messageString - - - - - -

    -
    -

    Returns the result of invoking exception.to_s. -Normally this returns the exception’s message or name.

    +

    Returns the result of invoking exception.to_s. Normally this returns the exception’s message or name.

    -
    -
    - - -
    -
    - -

    Returns:

    -
      - -
    • - - - (String) - - - -
    • - -
    - -
    - - - -
    -
     
     
    -115
    -116
    -117
    -118
    -119
    +9 +10 +11
    -
    # File 'src/error.c', line 115
    +      
    # File 'mrblib/10error.rb', line 9
     
    -static mrb_value
    -exc_message(mrb_state *mrb, mrb_value exc)
    -{
    -  return mrb_funcall(mrb, exc, "to_s", 0);
    -}
    +def message + to_s +end
    -
    -

    - - #set_backtraceObject - - - - - -

    - - - - -
    -
    -
    -
    -185
    -186
    -187
    -188
    -189
    -190
    -191
    -192
    -193
    -
    -
    # File 'src/error.c', line 185
    -
    -static mrb_value
    -exc_set_backtrace(mrb_state *mrb, mrb_value exc)
    -{
    -  mrb_value backtrace;
    -
    -  mrb_get_args(mrb, "o", &backtrace);
    -  set_backtrace(mrb, exc, backtrace);
    -  return backtrace;
    -}
    -
    -
    - -
    -

    - - #to_sString - - - - - -

    -
    -

    Returns exception’s message (or the name of the exception if -no message is set).

    - - -
    -
    -
    - -
    -
    - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (String) - - - -
    • - -
    - -
    - - - -
    - - - - - - -
    -
    -
    -
    -91
    -92
    -93
    -94
    -95
    -96
    -97
    -98
    -99
    -100
    -101
    -102
    -103
    -104
    -105
    -
    -
    # File 'src/error.c', line 91
    -
    -static mrb_value
    -exc_to_s(mrb_state *mrb, mrb_value exc)
    -{
    -  mrb_value mesg = mrb_attr_get(mrb, exc, mrb_intern_lit(mrb, "mesg"));
    -  struct RObject *p;
    -
    -  if (!mrb_string_p(mesg)) {
    -    return mrb_str_new_cstr(mrb, mrb_obj_classname(mrb, exc));
    -  }
    -  p = mrb_obj_ptr(mesg);
    -  if (!p->c) {
    -    p->c = mrb->string_class;
    -  }
    -  return mesg;
    -}
    -
    - -
    + - - \ No newline at end of file diff --git a/docs/api/FalseClass.html b/docs/api/FalseClass.html deleted file mode 100644 index df9bfb3..0000000 --- a/docs/api/FalseClass.html +++ /dev/null @@ -1,721 +0,0 @@ - - - - - - - Class: FalseClass - - — Documentation by YARD 0.9.20 - - - - - - - - - - - - - - - - - - - - - - - -
    - - -

    Class: FalseClass - - - -

    -
    - -
    -
    Inherits:
    -
    - Object - -
      -
    • Object
    • - - - -
    - show all - -
    -
    - - - - - - - - - - - -
    -
    Defined in:
    -
    src/object.c
    -
    - -
    - - - - - - - - - -

    - Instance Method Summary - collapse -

    - -
      - -
    • - - - #& ⇒ Object - - - - - - - - - - - - - -

      And—Returns false.

      -
      - -
    • - - -
    • - - - #^ ⇒ Object - - - - - - - - - - - - - -

      Exclusive Or—If obj is nil or false, returns false; otherwise, returns true.

      -
      - -
    • - - -
    • - - - #to_s ⇒ Object - - - - - - - - - - - - - -

      ‘nuf said…

      -
      - -
    • - - -
    • - - - #to_s ⇒ Object - - - - - - - - - - - - - -

      ‘nuf said…

      -
      - -
    • - - -
    • - - - #| ⇒ Object - - - - - - - - - - - - - -

      Or—Returns false if obj is nil or false; true otherwise.

      -
      - -
    • - - -
    - - - - -
    -

    Instance Method Details

    - - -
    -

    - - - #&(obj) ⇒ false - - #&(obj) ⇒ false - - - - - - -

    -
    -

    And—Returns false. obj is always -evaluated as it is the argument to a method call—there is no -short-circuit evaluation in this case.

    - - -
    -
    -
    - -

    Overloads:

    -
      - - -
    • - #&(obj) ⇒ false -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (false) - - - -
      • - -
      - -
      - - -
    • - - -
    • - #&(obj) ⇒ false -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (false) - - - -
      • - -
      - -
      - - -
    • - -
    - - -
    - - - - - - -
    -
    -
    -
    -201
    -202
    -203
    -204
    -205
    -
    -
    # File 'src/object.c', line 201
    -
    -static mrb_value
    -false_and(mrb_state *mrb, mrb_value obj)
    -{
    -  return mrb_false_value();
    -}
    -
    -
    - -
    -

    - - - #^(obj) ⇒ Boolean - - #^(obj) ⇒ Boolean - - - - - - -

    -
    -

    Exclusive Or—If obj is nil or -false, returns false; otherwise, returns -true.

    - - -
    -
    -
    - -

    Overloads:

    -
      - - -
    • - #^(obj) ⇒ Boolean -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Boolean) - - - -
      • - -
      - -
      - - -
    • - - -
    • - #^(obj) ⇒ Boolean -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Boolean) - - - -
      • - -
      - -
      - - -
    • - -
    - - -
    - - - - - - -
    -
    -
    -
    -220
    -221
    -222
    -223
    -224
    -225
    -226
    -227
    -
    -
    # File 'src/object.c', line 220
    -
    -static mrb_value
    -false_xor(mrb_state *mrb, mrb_value obj)
    -{
    -  mrb_bool obj2;
    -
    -  mrb_get_args(mrb, "b", &obj2);
    -  return mrb_bool_value(obj2);
    -}
    -
    -
    - -
    -

    - - #to_sObject - - - - - -

    -
    -

    ‘nuf said…

    - - -
    -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -257
    -258
    -259
    -260
    -261
    -
    -
    # File 'src/object.c', line 257
    -
    -static mrb_value
    -false_to_s(mrb_state *mrb, mrb_value obj)
    -{
    -  return mrb_str_new_lit_frozen(mrb, "false");
    -}
    -
    -
    - -
    -

    - - #to_sObject - - - - - -

    -
    -

    ‘nuf said…

    - - -
    -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -257
    -258
    -259
    -260
    -261
    -
    -
    # File 'src/object.c', line 257
    -
    -static mrb_value
    -false_to_s(mrb_state *mrb, mrb_value obj)
    -{
    -  return mrb_str_new_lit_frozen(mrb, "false");
    -}
    -
    -
    - -
    -

    - - - #|(obj) ⇒ Boolean - - #|(obj) ⇒ Boolean - - - - - - -

    -
    -

    Or—Returns false if obj is -nil or false; true otherwise.

    - - -
    -
    -
    - -

    Overloads:

    -
      - - -
    • - #|(obj) ⇒ Boolean -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Boolean) - - - -
      • - -
      - -
      - - -
    • - - -
    • - #|(obj) ⇒ Boolean -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Boolean) - - - -
      • - -
      - -
      - - -
    • - -
    - - -
    - - - - - - -
    -
    -
    -
    -240
    -241
    -242
    -243
    -244
    -245
    -246
    -247
    -
    -
    # File 'src/object.c', line 240
    -
    -static mrb_value
    -false_or(mrb_state *mrb, mrb_value obj)
    -{
    -  mrb_bool obj2;
    -
    -  mrb_get_args(mrb, "b", &obj2);
    -  return mrb_bool_value(obj2);
    -}
    -
    -
    - -
    - -
    - - - -
    - - \ No newline at end of file diff --git a/docs/api/Fiber.html b/docs/api/Fiber.html deleted file mode 100644 index f21ca56..0000000 --- a/docs/api/Fiber.html +++ /dev/null @@ -1,813 +0,0 @@ - - - - - - - Class: Fiber - - — Documentation by YARD 0.9.20 - - - - - - - - - - - - - - - - - - - - - - - -
    - - -

    Class: Fiber - - - -

    -
    - -
    -
    Inherits:
    -
    - Object - -
      -
    • Object
    • - - - -
    - show all - -
    -
    - - - - - - - - - - - -
    -
    Defined in:
    -
    mrbgems/mruby-fiber/src/fiber.c
    -
    - -
    - - - - - - - - - -

    - Instance Method Summary - collapse -

    - -
      - -
    • - - - #== ⇒ Object - - - - - - - - - - - - - -
      -
      - -
    • - - -
    • - - - #alive? ⇒ Boolean - - - - - - - - - - - - - -
      -
      - -
    • - - -
    • - - - #new { ... } ⇒ Object - - - - - - - constructor - - - - - - - - -

      Creates a fiber, whose execution is suspend until it is explicitly resumed using Fiber#resume method.

      -
      - -
    • - - -
    • - - - #resume(args, ...) ⇒ Object - - - - - - - - - - - - - -

      Resumes the fiber from the point at which the last Fiber.yield was called, or starts running it if it is the first call to resume.

      -
      - -
    • - - -
    • - - - #transfer(args, ...) ⇒ Object - - - - - - - - - - - - - -

      Transfers control to receiver fiber of the method call.

      -
      - -
    • - - -
    - - -
    -

    Constructor Details

    - -
    -

    - - #new { ... } ⇒ Object - - - - - -

    -
    -

    Creates a fiber, whose execution is suspend until it is explicitly -resumed using Fiber#resume method. -The code running inside the fiber can give up control by calling -Fiber.yield in which case it yields control back to caller -(the caller of the Fiber#resume).

    - -

    Upon yielding or termination the Fiber returns the value of the last -executed expression

    - -

    For instance:

    - -

    fiber = Fiber.new do - Fiber.yield 1 - 2 - end

    - -

    puts fiber.resume - puts fiber.resume - puts fiber.resume

    - -

    produces

    - -

    1 - 2 - resuming dead fiber (FiberError)

    - -

    The Fiber#resume method accepts an arbitrary number of -parameters, if it is the first call to resume then they -will be passed as block arguments. Otherwise they will be the return -value of the call to Fiber.yield

    - -

    Example:

    - -

    fiber = Fiber.new do |first| - second = Fiber.yield first + 2 - end

    - -

    puts fiber.resume 10 - puts fiber.resume 14 - puts fiber.resume 18

    - -

    produces

    - -

    12 - 14 - resuming dead fiber (FiberError)

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Yields:

    -
      - -
    • - - - - - - - -

      []

      -
      - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -90
    -91
    -92
    -93
    -94
    -95
    -96
    -97
    -98
    -99
    -100
    -101
    -102
    -103
    -104
    -105
    -106
    -107
    -108
    -109
    -110
    -111
    -112
    -113
    -114
    -115
    -116
    -117
    -118
    -119
    -120
    -121
    -122
    -123
    -124
    -125
    -126
    -127
    -128
    -129
    -130
    -131
    -132
    -133
    -134
    -
    -
    # File 'mrbgems/mruby-fiber/src/fiber.c', line 64
    -
    -static mrb_value
    -fiber_init(mrb_state *mrb, mrb_value self)
    -{
    -  static const struct mrb_context mrb_context_zero = { 0 };
    -  struct RFiber *f = fiber_ptr(self);
    -  struct mrb_context *c;
    -  struct RProc *p;
    -  mrb_callinfo *ci;
    -  mrb_value blk;
    -  size_t slen;
    -
    -  mrb_get_args(mrb, "&!", &blk);
    -
    -  if (f->cxt) {
    -    mrb_raise(mrb, E_RUNTIME_ERROR, "cannot initialize twice");
    -  }
    -  p = mrb_proc_ptr(blk);
    -  if (MRB_PROC_CFUNC_P(p)) {
    -    mrb_raise(mrb, E_FIBER_ERROR, "tried to create Fiber from C defined method");
    -  }
    -
    -  c = (struct mrb_context*)mrb_malloc(mrb, sizeof(struct mrb_context));
    -  *c = mrb_context_zero;
    -  f->cxt = c;
    -
    -  /* initialize VM stack */
    -  slen = FIBER_STACK_INIT_SIZE;
    -  if (p->body.irep->nregs > slen) {
    -    slen += p->body.irep->nregs;
    -  }
    -  c->stbase = (mrb_value *)mrb_malloc(mrb, slen*sizeof(mrb_value));
    -  c->stend = c->stbase + slen;
    -  c->stack = c->stbase;
    -
    -#ifdef MRB_NAN_BOXING
    -  {
    -    mrb_value *p = c->stbase;
    -    mrb_value *pend = c->stend;
    -
    -    while (p < pend) {
    -      SET_NIL_VALUE(*p);
    -      p++;
    -    }
    -  }
    -#else
    -  memset(c->stbase, 0, slen * sizeof(mrb_value));
    -#endif
    -
    -  /* copy receiver from a block */
    -  c->stack[0] = mrb->c->stack[0];
    -
    -  /* initialize callinfo stack */
    -  c->cibase = (mrb_callinfo *)mrb_calloc(mrb, FIBER_CI_INIT_SIZE, sizeof(mrb_callinfo));
    -  c->ciend = c->cibase + FIBER_CI_INIT_SIZE;
    -  c->ci = c->cibase;
    -  c->ci->stackent = c->stack;
    -
    -  /* adjust return callinfo */
    -  ci = c->ci;
    -  ci->target_class = MRB_PROC_TARGET_CLASS(p);
    -  ci->proc = p;
    -  mrb_field_write_barrier(mrb, (struct RBasic*)mrb_obj_ptr(self), (struct RBasic*)p);
    -  ci->pc = p->body.irep->iseq;
    -  ci[1] = ci[0];
    -  c->ci++;                      /* push dummy callinfo */
    -
    -  c->fib = f;
    -  c->status = MRB_FIBER_CREATED;
    -
    -  return self;
    -}
    -
    -
    - -
    - - -
    -

    Instance Method Details

    - - -
    -

    - - #==Object - - - - - -

    - - - - -
    -
    -
    -
    -291
    -292
    -293
    -294
    -295
    -296
    -297
    -298
    -299
    -300
    -301
    -
    -
    # File 'mrbgems/mruby-fiber/src/fiber.c', line 291
    -
    -static mrb_value
    -fiber_eq(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value other;
    -  mrb_get_args(mrb, "o", &other);
    -
    -  if (!mrb_fiber_p(other)) {
    -    return mrb_false_value();
    -  }
    -  return mrb_bool_value(fiber_ptr(self) == fiber_ptr(other));
    -}
    -
    -
    - -
    -

    - - #alive?Boolean - - - - - -

    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Boolean) - - - -
    • - -
    - -
    - - -
    - -
    -

    - - #resume(args, ...) ⇒ Object - - - - - -

    -
    -

    Resumes the fiber from the point at which the last Fiber.yield -was called, or starts running it if it is the first call to -resume. Arguments passed to resume will be the value of -the Fiber.yield expression or will be passed as block -parameters to the fiber’s block if this is the first resume.

    - -

    Alternatively, when resume is called it evaluates to the arguments passed -to the next Fiber.yield statement inside the fiber’s block -or to the block value if it runs to completion without any -Fiber.yield

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Object) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -255
    -256
    -257
    -258
    -259
    -260
    -261
    -262
    -263
    -264
    -265
    -266
    -267
    -
    -
    # File 'mrbgems/mruby-fiber/src/fiber.c', line 255
    -
    -static mrb_value
    -fiber_resume(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value *a;
    -  mrb_int len;
    -  mrb_bool vmexec = FALSE;
    -
    -  mrb_get_args(mrb, "*!", &a, &len);
    -  if (mrb->c->ci->acc < 0) {
    -    vmexec = TRUE;
    -  }
    -  return fiber_switch(mrb, self, len, a, TRUE, vmexec);
    -}
    -
    -
    - -
    -

    - - #transfer(args, ...) ⇒ Object - - - - - -

    -
    -

    Transfers control to receiver fiber of the method call. -Unlike resume the receiver wouldn’t be pushed to call -stack of fibers. Instead it will switch to the call stack of -transferring fiber. -When resuming a fiber that was transferred to another fiber it would -cause double resume error. Though when the fiber is re-transferred -and Fiber.yield is called, the fiber would be resumable.

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Object) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -315
    -316
    -317
    -318
    -319
    -320
    -321
    -322
    -323
    -324
    -325
    -326
    -327
    -328
    -329
    -330
    -331
    -332
    -333
    -334
    -335
    -336
    -337
    -
    -
    # File 'mrbgems/mruby-fiber/src/fiber.c', line 315
    -
    -static mrb_value
    -fiber_transfer(mrb_state *mrb, mrb_value self)
    -{
    -  struct mrb_context *c = fiber_check(mrb, self);
    -  mrb_value* a;
    -  mrb_int len;
    -
    -  fiber_check_cfunc(mrb, mrb->c);
    -  mrb_get_args(mrb, "*!", &a, &len);
    -
    -  if (c == mrb->root_c) {
    -    mrb->c->status = MRB_FIBER_TRANSFERRED;
    -    fiber_switch_context(mrb, c);
    -    MARK_CONTEXT_MODIFY(c);
    -    return fiber_result(mrb, a, len);
    -  }
    -
    -  if (c == mrb->c) {
    -    return fiber_result(mrb, a, len);
    -  }
    -
    -  return fiber_switch(mrb, self, len, a, FALSE, FALSE);
    -}
    -
    -
    - -
    - -
    - - - -
    - - \ No newline at end of file diff --git a/docs/api/File.html b/docs/api/File.html index 98db1b3..e6ddba3 100644 --- a/docs/api/File.html +++ b/docs/api/File.html @@ -6,17 +6,17 @@ Class: File - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -105,8 +105,8 @@
    Defined in:
    -
    mrbgems/mruby-io/src/file.c,
    - mrbgems/mruby-io/mrblib/file.rb,
    mrbgems/mruby-io/mrblib/file_constants.rb,
    mrbgems/mruby-io/mrblib/file_constants.rb
    +
    mrbgems/mruby-io/mrblib/file.rb,
    + mrbgems/mruby-io/mrblib/file_constants.rb,
    mrbgems/mruby-io/mrblib/file_constants.rb
    @@ -129,13 +129,7 @@

    Constant Summary

    Constants included from Constants

    -

    Constants::APPEND, Constants::BINARY, Constants::CREAT, Constants::DSYNC, Constants::EXCL, Constants::FNM_CASEFOLD, Constants::FNM_DOTMATCH, Constants::FNM_NOESCAPE, Constants::FNM_PATHNAME, Constants::FNM_SYSCASE, Constants::NOCTTY, Constants::NOFOLLOW, Constants::NONBLOCK, Constants::RDONLY, Constants::RDWR, Constants::SYNC, Constants::TRUNC, Constants::WRONLY

    - - - -

    Constants inherited - from IO

    -

    IO::BUF_SIZE, IO::SEEK_CUR, IO::SEEK_END, IO::SEEK_SET

    +

    Constants::FNM_CASEFOLD, Constants::FNM_DOTMATCH, Constants::FNM_NOESCAPE, Constants::FNM_PATHNAME, Constants::FNM_SYSCASE

    Instance Attribute Summary collapse

    @@ -161,7 +155,8 @@

    Instance Attribute Summary collaps -

    Returns the value of attribute path.

    +
    +

    Returns the value of attribute path.

    @@ -197,8 +192,7 @@

    -
    -
    +
    @@ -220,8 +214,7 @@

    -
    -
    +
    @@ -243,31 +236,7 @@

    -
    -
    - - - - -
  • - - - .expand_path(path, default_dir = '.') ⇒ Object - - - - - - - - - - - - - -
    -
    +
  • @@ -289,8 +258,7 @@

    -
    -
    +
    @@ -312,8 +280,7 @@

    -
    -
    +
    @@ -335,8 +302,7 @@

    -
    -
    +
    @@ -358,8 +324,7 @@

    -
    -
    +
    @@ -381,8 +346,7 @@

    -
    -
    +
    @@ -404,8 +368,7 @@

    -
    -
    +
    @@ -427,8 +390,7 @@

    -
    -
    +
    @@ -450,8 +412,7 @@

    -
    -
    +
    @@ -473,8 +434,7 @@

    -
    -
    +
    @@ -496,8 +456,7 @@

    -
    -
    +
    @@ -519,8 +478,7 @@

    -
    -
    +
    @@ -537,7 +495,7 @@

  • - #concat_path(path, base_path) ⇒ Object + #atime ⇒ Object @@ -551,8 +509,7 @@

    -
    -
    +

  • @@ -560,7 +517,7 @@

  • - #flock ⇒ Object + #ctime ⇒ Object @@ -574,8 +531,7 @@

    -
    -
    +

  • @@ -599,9 +555,32 @@

    -

    A new instance of File.

    +
    +

    A new instance of File.

    + + + +
  • + + + #inspect ⇒ Object + + + + + + + + + + + + + +
    +
  • @@ -622,8 +601,7 @@

    -
    -
    +
    @@ -647,7 +625,7 @@

    Methods inherited from IO

    -

    #<<, #_check_readable, #_read_buf, #close, #close_on_exec=, #close_on_exec?, #close_write, #closed?, #each, #each_byte, #eof?, #fileno, #flush, #getc, #gets, #hash, #initialize_copy, #isatty, open, #pid, pipe, popen, #pos, #pos=, #print, #printf, #puts, read, #read, #readchar, #readline, #readlines, #rewind, #seek, #sync, #sync=, #sysread, #sysseek, #syswrite, #ungetc, #write

    +

    #<<, #each, #each_byte, #each_char, #hash, open, pipe, popen, #pos=, #print, #printf, #puts, read, #rewind, #ungetbyte

    Constructor Details

    @@ -662,7 +640,8 @@

    -

    Returns a new instance of File

    + +

    Returns a new instance of File.

    @@ -670,8 +649,8 @@

    -
    - +

    +
    @@ -692,7 +671,7 @@

    # File 'mrbgems/mruby-io/mrblib/file.rb', line 4
     
     def initialize(fd_or_path, mode = "r", perm = 0666)
    -  if fd_or_path.kind_of? Fixnum
    +  if fd_or_path.kind_of? Integer
         super(fd_or_path, mode)
       else
         @path = fd_or_path
    @@ -723,7 +702,8 @@ 

    -

    Returns the value of attribute path

    + +

    Returns the value of attribute path.

    @@ -731,8 +711,8 @@

    -
    - +

    +
    @@ -774,7 +754,6 @@

    -
    @@ -793,20 +772,20 @@

    -

    - + +
     
     
    -147
    -148
    -149
    +87 +88 +89
    -
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 147
    +      
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 87
     
     def self.directory?(file)
       FileTest.directory?(file)
    @@ -829,7 +808,6 @@ 

    -
    @@ -848,20 +826,20 @@

    -

    - + +
     
     
    -151
    -152
    -153
    +91 +92 +93
    -
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 151
    +      
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 91
     
     def self.exist?(file)
       FileTest.exist?(file)
    @@ -884,7 +862,6 @@ 

    -
    @@ -903,20 +880,20 @@

    -

    - + + - - -
     
     
    -155
    -156
    -157
    +95 +96 +97
    -
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 155
    +      
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 95
     
     def self.exists?(file)
       FileTest.exists?(file)
    @@ -927,9 +904,9 @@ 

    -

    +

    - .expand_path(path, default_dir = '.') ⇒ Object + .extname(filename) ⇒ Object @@ -941,201 +918,21 @@

     
     
    -58
    -59
    -60
    -61
    -62
    -63
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -90
    -91
    -92
    -93
    -94
    -95
    -96
    -97
    -98
    -99
    -100
    -101
    -102
    -103
    -104
    -105
    -106
    -107
    -108
    -109
    -110
    -111
    -112
    -113
    -114
    -115
    -116
    -117
    -118
    -119
    -120
    -121
    -122
    -123
    -124
    -125
    -126
     127
     128
     129
     130
     131
    -132
    -133
    -134
    -135
    -

    -
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 58
    -
    -def self.expand_path(path, default_dir = '.')
    -  def concat_path(path, base_path)
    -    if path[0] == "/" || path[1] == ':' # Windows root!
    -      expanded_path = path
    -    elsif path[0] == "~"
    -      if (path[1] == "/" || path[1] == nil)
    -        dir = path[1, path.size]
    -        home_dir = _gethome
    -
    -        unless home_dir
    -          raise ArgumentError, "couldn't find HOME environment -- expanding '~'"
    -        end
    -
    -        expanded_path = home_dir
    -        expanded_path += dir if dir
    -        expanded_path += "/"
    -      else
    -        splitted_path = path.split("/")
    -        user = splitted_path[0][1, splitted_path[0].size]
    -        dir = "/" + splitted_path[1, splitted_path.size].join("/")
    -
    -        home_dir = _gethome(user)
    -
    -        unless home_dir
    -          raise ArgumentError, "user #{user} doesn't exist"
    -        end
    -
    -        expanded_path = home_dir
    -        expanded_path += dir if dir
    -        expanded_path += "/"
    -      end
    -    else
    -      expanded_path = concat_path(base_path, _getwd)
    -      expanded_path += "/" + path
    -    end
    -
    -    expanded_path
    -  end
    -
    -  expanded_path = concat_path(path, default_dir)
    -  drive_prefix = ""
    -  if File::ALT_SEPARATOR && expanded_path.size > 2 &&
    -      ("A".."Z").include?(expanded_path[0].upcase) && expanded_path[1] == ":"
    -    drive_prefix = expanded_path[0, 2]
    -    expanded_path = expanded_path[2, expanded_path.size]
    -  end
    -  expand_path_array = []
    -  if File::ALT_SEPARATOR && expanded_path.include?(File::ALT_SEPARATOR)
    -    expanded_path.gsub!(File::ALT_SEPARATOR, '/')
    -  end
    -  while expanded_path.include?('//')
    -    expanded_path = expanded_path.gsub('//', '/')
    -  end
    -
    -  if expanded_path != "/"
    -    expanded_path.split('/').each do |path_token|
    -      if path_token == '..'
    -        if expand_path_array.size > 1
    -          expand_path_array.pop
    -        end
    -      elsif path_token == '.'
    -        # nothing to do.
    -      else
    -        expand_path_array << path_token
    -      end
    -    end
    -
    -    expanded_path = expand_path_array.join("/")
    -    if expanded_path.empty?
    -      expanded_path = '/'
    -    end
    -  end
    -  if drive_prefix.empty?
    -    expanded_path
    -  else
    -    drive_prefix + expanded_path.gsub("/", File::ALT_SEPARATOR)
    -  end
    -end
    -
    - - -
    -

    - - .extname(filename) ⇒ Object - - - - - -

    - - @@ -1155,7 +952,6 @@

    -
    @@ -1174,20 +970,20 @@

    -

    - + +

    -
    -
    -
    -187
    -188
    -189
    -190
    -191
    -192
    +132
    -
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 187
    +      
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 127
     
     def self.extname(filename)
       fname = self.basename(filename)
    -  return '' if fname[0] == '.' || fname.index('.').nil?
    -  ext = fname.split('.').last
    -  ext.empty? ? '' : ".#{ext}"
    +  epos = fname.rindex('.')
    +  return '' if epos == 0 || epos.nil?
    +  return fname[epos..-1]
     end
     
     
    -159
    -160
    -161
    +99 +100 +101
    -
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 159
    +      
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 99
     
     def self.file?(file)
       FileTest.file?(file)
    @@ -1212,18 +1008,18 @@ 

     
     
    -137
    -138
    -139
    -140
    -141
    -142
    -143
    -144
    -145
    +77 +78 +79 +80 +81 +82 +83 +84 +85

    -
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 137
    +      
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 77
     
     def self.foreach(file)
       if block_given?
    @@ -1254,25 +1050,6 @@ 

     
     
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
     33
     34
     35
    @@ -1296,10 +1073,29 @@ 

    53 54 55 -56

    +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75

    -
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 14
    +      
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 33
     
     def self.join(*names)
       return "" if names.empty?
    @@ -1364,24 +1160,20 @@ 

     
     
    -194
    -195
    -196
    -197
    -198
    -199
    -200
    -201
    -202
    +134 +135 +136 +137 +138 +139 +140

    -
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 194
    +      
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 134
     
     def self.path(filename)
       if filename.kind_of?(String)
         filename
    -  elsif filename.respond_to?(:to_path)
    -    filename.to_path
       else
         raise TypeError, "no implicit conversion of #{filename.class} into String"
       end
    @@ -1404,7 +1196,6 @@ 

    -
    @@ -1423,20 +1214,20 @@

    -

    - + +
     
     
    -163
    -164
    -165
    +103 +104 +105
    -
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 163
    +      
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 103
     
     def self.pipe?(file)
       FileTest.pipe?(file)
    @@ -1461,12 +1252,12 @@ 

     
     
    -167
    -168
    -169
    +107 +108 +109

    -
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 167
    +      
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 107
     
     def self.size(file)
       FileTest.size(file)
    @@ -1489,7 +1280,6 @@ 

    -
    @@ -1508,20 +1298,20 @@

    -

    - + + @@ -3696,9 +1121,9 @@

    -

    +

    - #write(string) ⇒ Object + #ungetbyte(c) ⇒ Object @@ -3710,29 +1135,29 @@

     
     
    -124
    -125
    -126
    -127
    -128
    -129
    -130
    -131
    -132
    -133
    +101 +102 +103 +104 +105 +106 +107 +108 +109 +110

    @@ -3743,11 +1168,11 @@

    - + diff --git a/docs/api/IOError.html b/docs/api/IOError.html index bc9d354..06497da 100644 --- a/docs/api/IOError.html +++ b/docs/api/IOError.html @@ -6,17 +6,17 @@ Exception: IOError - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -73,14 +73,12 @@
    Inherits:
    - StandardError + StandardError

     
     
    -171
    -172
    -173
    +111 +112 +113
    -
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 171
    +      
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 111
     
     def self.size?(file)
       FileTest.size?(file)
    @@ -1544,7 +1334,6 @@ 

    -
    @@ -1563,20 +1352,20 @@

    -

    - + +
     
     
    -175
    -176
    -177
    +115 +116 +117
    -
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 175
    +      
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 115
     
     def self.socket?(file)
       FileTest.socket?(file)
    @@ -1599,7 +1388,6 @@ 

    -
    @@ -1618,20 +1406,20 @@

    -

    - + +
     
     
    -179
    -180
    -181
    +119 +120 +121
    -
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 179
    +      
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 119
     
     def self.symlink?(file)
       FileTest.symlink?(file)
    @@ -1654,7 +1442,6 @@ 

    -
    @@ -1673,20 +1460,20 @@

    -

    - + + + +
     
     
    -183
    -184
    -185
    +123 +124 +125
    -
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 183
    +      
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 123
     
     def self.zero?(file)
       FileTest.zero?(file)
    @@ -1703,9 +1490,9 @@ 

    Instance Method Details

    -

    +

    - #concat_path(path, base_path) ⇒ Object + #atimeObject @@ -1717,83 +1504,49 @@

     
     
    -59
    -60
    -61
    -62
    -63
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -90
    -91
    -92
    -93
    -94
    -95
    +14 +15 +16 +17

    -
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 59
    -
    -def concat_path(path, base_path)
    -  if path[0] == "/" || path[1] == ':' # Windows root!
    -    expanded_path = path
    -  elsif path[0] == "~"
    -    if (path[1] == "/" || path[1] == nil)
    -      dir = path[1, path.size]
    -      home_dir = _gethome
    -
    -      unless home_dir
    -        raise ArgumentError, "couldn't find HOME environment -- expanding '~'"
    -      end
    +      
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 14
     
    -      expanded_path = home_dir
    -      expanded_path += dir if dir
    -      expanded_path += "/"
    -    else
    -      splitted_path = path.split("/")
    -      user = splitted_path[0][1, splitted_path[0].size]
    -      dir = "/" + splitted_path[1, splitted_path.size].join("/")
    +def atime
    +  t = self._atime
    +  t && Time.at(t)
    +end
    +
    + + +
    +

    + + #ctimeObject + - home_dir = _gethome(user) + - unless home_dir - raise ArgumentError, "user #{user} doesn't exist" - end + +

    + + + @@ -1801,9 +1554,9 @@

    -

    +

    - #flockObject + #inspectObject @@ -1815,76 +1568,16 @@

     
     
    -353
    -354
    -355
    -356
    -357
    -358
    -359
    -360
    -361
    -362
    -363
    -364
    -365
    -366
    -367
    -368
    -369
    -370
    -371
    -372
    -373
    -374
    -375
    -376
    -377
    -378
    -379
    -380
    -381
    -382
    -383
    -384
    -385
    +29 +30 +31

    +
     
    -      expanded_path = home_dir
    -      expanded_path += dir if dir
    -      expanded_path += "/"
    -    end
    -  else
    -    expanded_path = concat_path(base_path, _getwd)
    -    expanded_path += "/" + path
    -  end
     
    -  expanded_path
    +19
    +20
    +21
    +22
    +
    +
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 19
    +
    +def ctime
    +  t = self._ctime
    +  t && Time.at(t)
     end
    -
    # File 'mrbgems/mruby-io/src/file.c', line 353
    -
    -mrb_value
    -mrb_file_flock(mrb_state *mrb, mrb_value self)
    -{
    -#if defined(sun)
    -  mrb_raise(mrb, E_NOTIMP_ERROR, "flock is not supported on Illumos/Solaris/Windows");
    -#else
    -  mrb_int operation;
    -  int fd;
    -
    -  mrb_get_args(mrb, "i", &operation);
    -  fd = (int)mrb_fixnum(mrb_io_fileno(mrb, self));
    -
    -  while (flock(fd, (int)operation) == -1) {
    -    switch (errno) {
    -      case EINTR:
    -        /* retry */
    -        break;
    -      case EAGAIN:      /* NetBSD */
    -#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
    -      case EWOULDBLOCK: /* FreeBSD OpenBSD Linux */
    -#endif
    -        if (operation & LOCK_NB) {
    -          return mrb_false_value();
    -        }
    -        /* FALLTHRU - should not happen */
    -      default:
    -        mrb_sys_fail(mrb, "flock failed");
    -        break;
    -    }
    -  }
    -#endif
    -  return mrb_fixnum_value(0);
    -}
    +
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 29
    +
    +def inspect
    +  "<#{self.class}:#{@path}>"
    +end
    @@ -1905,36 +1598,18 @@

     
     
    -339
    -340
    -341
    -342
    -343
    -344
    -345
    -346
    -347
    -348
    -349
    -350
    -351
    +24 +25 +26 +27

    -
    # File 'mrbgems/mruby-io/src/file.c', line 339
    -
    -static mrb_value
    -mrb_file_mtime(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value obj;
    -  struct stat st;
    -  int fd;
    -
    -  obj = mrb_obj_value(mrb_class_get(mrb, "Time"));
    -  fd = (int)mrb_fixnum(mrb_io_fileno(mrb, self));
    -  if (fstat(fd, &st) == -1)
    -    return mrb_false_value();
    -  return mrb_funcall(mrb, obj, "at", 1, mrb_fixnum_value(st.st_mtime));
    -}
    +
    # File 'mrbgems/mruby-io/mrblib/file.rb', line 24
    +
    +def mtime
    +  t = self._mtime
    +  t && Time.at(t)
    +end
    @@ -1944,11 +1619,11 @@

    - + diff --git a/docs/api/File/Constants.html b/docs/api/File/Constants.html index 23a593f..1410b3a 100644 --- a/docs/api/File/Constants.html +++ b/docs/api/File/Constants.html @@ -6,17 +6,17 @@ Module: File::Constants - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -87,9 +87,7 @@
    Defined in:
    -
    mrbgems/mruby-io/src/file.c,
    - mrbgems/mruby-io/mrblib/file_constants.rb
    -
    +
    mrbgems/mruby-io/mrblib/file_constants.rb
    @@ -103,71 +101,6 @@

    -
    RDONLY = - -
    -
    0
    - -
    WRONLY = - -
    -
    1
    - -
    RDWR = - -
    -
    2
    - -
    NONBLOCK = - -
    -
    4
    - -
    APPEND = - -
    -
    8
    - -
    BINARY = - -
    -
    0
    - -
    SYNC = - -
    -
    128
    - -
    NOFOLLOW = - -
    -
    256
    - -
    CREAT = - -
    -
    512
    - -
    TRUNC = - -
    -
    1024
    - -
    EXCL = - -
    -
    2048
    - -
    NOCTTY = - -
    -
    131072
    - -
    DSYNC = - -
    -
    4194304
    -
    FNM_SYSCASE =
    @@ -206,11 +139,11 @@

    - + diff --git a/docs/api/Fixnum.html b/docs/api/Fixnum.html deleted file mode 100644 index ec36e8b..0000000 --- a/docs/api/Fixnum.html +++ /dev/null @@ -1,1825 +0,0 @@ - - - - - - - Class: Fixnum - - — Documentation by YARD 0.9.20 - - - - - - - - - - - - - - - - - - - - - - - -
    - - -

    Class: Fixnum - - - -

    -
    - -
    -
    Inherits:
    -
    - Integer - - - show all - -
    -
    - - - - - - - - - - - -
    -
    Defined in:
    -
    src/numeric.c
    -
    - -
    - -

    Overview

    -
    -

    Fixnum Class

    - - -
    -
    -
    - - -
    - - - - - - - - - -

    - Instance Method Summary - collapse -

    - -
      - -
    • - - - #% ⇒ Object - - - - - - - - - - - - - -

      Returns fix modulo other.

      -
      - -
    • - - -
    • - - - #&(integer) ⇒ Object - - - - - - - - - - - - - -

      Bitwise AND.

      -
      - -
    • - - -
    • - - - #*(numeric) ⇒ Object - - - - - - - - - - - - - -

      Performs multiplication: the class of the resulting object depends on the class of numeric and on the magnitude of the result.

      -
      - -
    • - - -
    • - - - #+(numeric) ⇒ Object - - - - - - - - - - - - - -

      Performs addition: the class of the resulting object depends on the class of numeric and on the magnitude of the result.

      -
      - -
    • - - -
    • - - - #-(numeric) ⇒ Object - - - - - - - - - - - - - -

      Performs subtraction: the class of the resulting object depends on the class of numeric and on the magnitude of the result.

      -
      - -
    • - - -
    • - - - #<<(count) ⇒ Integer, Float - - - - - - - - - - - - - -

      Shifts fix left count positions (right if count is negative).

      -
      - -
    • - - -
    • - - - #==(other) ⇒ Boolean - - - - - - - - - - - - - -

      Return true if fix equals other numerically.

      -
      - -
    • - - -
    • - - - #>>(count) ⇒ Integer, Float - - - - - - - - - - - - - -

      Shifts fix right count positions (left if count is negative).

      -
      - -
    • - - -
    • - - - #^(integer) ⇒ Object - - - - - - - - - - - - - -

      Bitwise EXCLUSIVE OR.

      -
      - -
    • - - -
    • - - - #divmod(numeric) ⇒ Array - - - - - - - - - - - - - -

      See Numeric#divmod.

      -
      - -
    • - - -
    • - - - #eql?(numeric) ⇒ Boolean - - - - - - - - - - - - - -

      Returns true if num and numeric are the same type and have equal values.

      -
      - -
    • - - -
    • - - - #to_s(base = 10) ⇒ String - - - - - - - - - - - - - -

      Returns a string containing the representation of fix radix base (between 2 and 36).

      -
      - -
    • - - -
    • - - - #to_f ⇒ Object - - - - - - - - - - - - - -

      15.2.8.3.23.

      -
      - -
    • - - -
    • - - - #to_s(base = 10) ⇒ String - - - - - - - - - - - - - -

      Returns a string containing the representation of fix radix base (between 2 and 36).

      -
      - -
    • - - -
    • - - - #|(integer) ⇒ Object - - - - - - - - - - - - - -

      Bitwise OR.

      -
      - -
    • - - -
    • - - - #~ ⇒ Integer - - - - - - - - - - - - - -

      One’s complement: returns a number where each bit is flipped.

      -
      - -
    • - - -
    - - - - - - - - - - - -

    Methods inherited from Integer

    -

    #ceil, #floor, #to_i, #to_int

    - - - - - - - - - -

    Methods included from Integral

    -

    #**, #/, #<, #<=, #<=>, #>, #>=, #__coerce_step_counter, #div, #downto, #next, #quo, #step, #times, #upto

    - - - - - - - - - -

    Methods inherited from Numeric

    -

    #+@, #-@, #abs, #finite?, #infinite?, #negative?, #nonzero?, #positive?, #to_r, #zero?

    - - - - - - - - - -

    Methods included from Comparable

    -

    #<, #<=, #>, #>=, #between?, #clamp

    - - -
    -

    Instance Method Details

    - - -
    -

    - - - #%(other) ⇒ Object - - #modulo(other) ⇒ Object - - - - - - -

    -
    -

    Returns fix modulo other. -See numeric.divmod for more information.

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -886
    -887
    -888
    -889
    -890
    -891
    -892
    -893
    -894
    -895
    -896
    -897
    -898
    -899
    -900
    -901
    -902
    -903
    -904
    -905
    -906
    -907
    -908
    -909
    -910
    -911
    -912
    -913
    -914
    -915
    -916
    -917
    -918
    -919
    -920
    -
    -
    # File 'src/numeric.c', line 886
    -
    -static mrb_value
    -fix_mod(mrb_state *mrb, mrb_value x)
    -{
    -  mrb_value y;
    -  mrb_int a, b;
    -
    -  mrb_get_args(mrb, "o", &y);
    -  a = mrb_fixnum(x);
    -   if (mrb_fixnum_p(y) && a != MRB_INT_MIN && (b=mrb_fixnum(y)) != MRB_INT_MIN) {
    -    mrb_int mod;
    -
    -    if (b == 0) {
    -#ifdef MRB_WITHOUT_FLOAT
    -      /* ZeroDivisionError */
    -      return mrb_fixnum_value(0);
    -#else
    -      if (a > 0) return mrb_float_value(mrb, INFINITY);
    -      if (a < 0) return mrb_float_value(mrb, INFINITY);
    -      return mrb_float_value(mrb, NAN);
    -#endif
    -    }
    -    fixdivmod(mrb, a, b, NULL, &mod);
    -    return mrb_fixnum_value(mod);
    -  }
    -#ifdef MRB_WITHOUT_FLOAT
    -  mrb_raise(mrb, E_TYPE_ERROR, "non fixnum value");
    -#else
    -  else {
    -    mrb_float mod;
    -
    -    flodivmod(mrb, (mrb_float)a, mrb_to_flo(mrb, y), NULL, &mod);
    -    return mrb_float_value(mrb, mod);
    -  }
    -#endif
    -}
    -
    -
    - -
    -

    - - #&(integer) ⇒ Object - - - - - -

    -
    -

    Bitwise AND.

    - - -
    -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -1054
    -1055
    -1056
    -1057
    -1058
    -1059
    -1060
    -1061
    -
    -
    # File 'src/numeric.c', line 1054
    -
    -static mrb_value
    -fix_and(mrb_state *mrb, mrb_value x)
    -{
    -  mrb_value y;
    -
    -  mrb_get_args(mrb, "o", &y);
    -  bit_op(x, y, and, &);
    -}
    -
    -
    - -
    -

    - - #*(numeric) ⇒ Object - - - - - -

    -
    -

    Performs multiplication: the class of the resulting object depends on -the class of numeric and on the magnitude of the -result.

    - - -
    -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -839
    -840
    -841
    -842
    -843
    -844
    -845
    -846
    -
    -
    # File 'src/numeric.c', line 839
    -
    -static mrb_value
    -fix_mul(mrb_state *mrb, mrb_value x)
    -{
    -  mrb_value y;
    -
    -  mrb_get_args(mrb, "o", &y);
    -  return fixnum_mul(mrb, x, y);
    -}
    -
    -
    - -
    -

    - - #+(numeric) ⇒ Object - - - - - -

    -
    -

    Performs addition: the class of the resulting object depends on -the class of numeric and on the magnitude of the -result.

    - - -
    -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -1312
    -1313
    -1314
    -1315
    -1316
    -1317
    -1318
    -1319
    -
    -
    # File 'src/numeric.c', line 1312
    -
    -static mrb_value
    -fix_plus(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value other;
    -
    -  mrb_get_args(mrb, "o", &other);
    -  return fixnum_plus(mrb, self, other);
    -}
    -
    -
    - -
    -

    - - #-(numeric) ⇒ Object - - - - - -

    -
    -

    Performs subtraction: the class of the resulting object depends on -the class of numeric and on the magnitude of the -result.

    - - -
    -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -1370
    -1371
    -1372
    -1373
    -1374
    -1375
    -1376
    -1377
    -
    -
    # File 'src/numeric.c', line 1370
    -
    -static mrb_value
    -fix_minus(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value other;
    -
    -  mrb_get_args(mrb, "o", &other);
    -  return fixnum_minus(mrb, self, other);
    -}
    -
    -
    - -
    -

    - - #<<(count) ⇒ Integer, Float - - - - - -

    -
    -

    Shifts fix left count positions (right if count is negative).

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    - - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -1167
    -1168
    -1169
    -1170
    -1171
    -1172
    -1173
    -1174
    -1175
    -1176
    -1177
    -1178
    -1179
    -1180
    -1181
    -1182
    -
    -
    # File 'src/numeric.c', line 1167
    -
    -static mrb_value
    -fix_lshift(mrb_state *mrb, mrb_value x)
    -{
    -  mrb_int width, val;
    -
    -  mrb_get_args(mrb, "i", &width);
    -  if (width == 0) {
    -    return x;
    -  }
    -  val = mrb_fixnum(x);
    -  if (val == 0) return x;
    -  if (width < 0) {
    -    return rshift(val, -width);
    -  }
    -  return lshift(mrb, val, width);
    -}
    -
    -
    - -
    -

    - - #==(other) ⇒ Boolean - - - - - -

    -
    -

    Return true if fix equals other -numerically.

    - -

    1 == 2 #=> false - 1 == 1.0 #=> true

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Boolean) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -995
    -996
    -997
    -998
    -999
    -1000
    -1001
    -1002
    -1003
    -1004
    -1005
    -1006
    -1007
    -1008
    -1009
    -1010
    -1011
    -
    -
    # File 'src/numeric.c', line 995
    -
    -static mrb_value
    -fix_equal(mrb_state *mrb, mrb_value x)
    -{
    -  mrb_value y;
    -
    -  mrb_get_args(mrb, "o", &y);
    -  switch (mrb_type(y)) {
    -  case MRB_TT_FIXNUM:
    -    return mrb_bool_value(mrb_fixnum(x) == mrb_fixnum(y));
    -#ifndef MRB_WITHOUT_FLOAT
    -  case MRB_TT_FLOAT:
    -    return mrb_bool_value((mrb_float)mrb_fixnum(x) == mrb_float(y));
    -#endif
    -  default:
    -    return mrb_false_value();
    -  }
    -}
    -
    -
    - -
    -

    - - #>>(count) ⇒ Integer, Float - - - - - -

    -
    -

    Shifts fix right count positions (left if count is negative).

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    - - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -1192
    -1193
    -1194
    -1195
    -1196
    -1197
    -1198
    -1199
    -1200
    -1201
    -1202
    -1203
    -1204
    -1205
    -1206
    -1207
    -
    -
    # File 'src/numeric.c', line 1192
    -
    -static mrb_value
    -fix_rshift(mrb_state *mrb, mrb_value x)
    -{
    -  mrb_int width, val;
    -
    -  mrb_get_args(mrb, "i", &width);
    -  if (width == 0) {
    -    return x;
    -  }
    -  val = mrb_fixnum(x);
    -  if (val == 0) return x;
    -  if (width < 0) {
    -    return lshift(mrb, val, -width);
    -  }
    -  return rshift(val, width);
    -}
    -
    -
    - -
    -

    - - #^(integer) ⇒ Object - - - - - -

    -
    -

    Bitwise EXCLUSIVE OR.

    - - -
    -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -1088
    -1089
    -1090
    -1091
    -1092
    -1093
    -1094
    -1095
    -
    -
    # File 'src/numeric.c', line 1088
    -
    -static mrb_value
    -fix_xor(mrb_state *mrb, mrb_value x)
    -{
    -  mrb_value y;
    -
    -  mrb_get_args(mrb, "o", &y);
    -  bit_op(x, y, or, ^);
    -}
    -
    -
    - -
    -

    - - #divmod(numeric) ⇒ Array - - - - - -

    -
    -

    See Numeric#divmod.

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Array) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -928
    -929
    -930
    -931
    -932
    -933
    -934
    -935
    -936
    -937
    -938
    -939
    -940
    -941
    -942
    -943
    -944
    -945
    -946
    -947
    -948
    -949
    -950
    -951
    -952
    -953
    -954
    -955
    -956
    -957
    -958
    -959
    -960
    -961
    -962
    -963
    -964
    -
    -
    # File 'src/numeric.c', line 928
    -
    -static mrb_value
    -fix_divmod(mrb_state *mrb, mrb_value x)
    -{
    -  mrb_value y;
    -
    -  mrb_get_args(mrb, "o", &y);
    -
    -  if (mrb_fixnum_p(y)) {
    -    mrb_int div, mod;
    -
    -    if (mrb_fixnum(y) == 0) {
    -#ifdef MRB_WITHOUT_FLOAT
    -      return mrb_assoc_new(mrb, mrb_fixnum_value(0), mrb_fixnum_value(0));
    -#else
    -      return mrb_assoc_new(mrb, ((mrb_fixnum(x) == 0) ?
    -                                 mrb_float_value(mrb, NAN):
    -                                 mrb_float_value(mrb, INFINITY)),
    -                           mrb_float_value(mrb, NAN));
    -#endif
    -    }
    -    fixdivmod(mrb, mrb_fixnum(x), mrb_fixnum(y), &div, &mod);
    -    return mrb_assoc_new(mrb, mrb_fixnum_value(div), mrb_fixnum_value(mod));
    -  }
    -#ifdef MRB_WITHOUT_FLOAT
    -  mrb_raise(mrb, E_TYPE_ERROR, "non fixnum value");
    -#else
    -  else {
    -    mrb_float div, mod;
    -    mrb_value a, b;
    -
    -    flodivmod(mrb, (mrb_float)mrb_fixnum(x), mrb_to_flo(mrb, y), &div, &mod);
    -    a = mrb_int_value(mrb, div);
    -    b = mrb_float_value(mrb, mod);
    -    return mrb_assoc_new(mrb, a, b);
    -  }
    -#endif
    -}
    -
    -
    - -
    -

    - - #eql?(numeric) ⇒ Boolean - - - - - -

    -
    -

    Returns true if num and numeric are the -same type and have equal values.

    - -

    1 == 1.0 #=> true - 1.eql?(1.0) #=> false - (1.0).eql?(1.0) #=> true

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Boolean) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -368
    -369
    -370
    -371
    -372
    -373
    -374
    -375
    -376
    -
    -
    # File 'src/numeric.c', line 368
    -
    -static mrb_value
    -fix_eql(mrb_state *mrb, mrb_value x)
    -{
    -  mrb_value y;
    -
    -  mrb_get_args(mrb, "o", &y);
    -  if (!mrb_fixnum_p(y)) return mrb_false_value();
    -  return mrb_bool_value(mrb_fixnum(x) == mrb_fixnum(y));
    -}
    -
    -
    - -
    -

    - - #to_s(base = 10) ⇒ String - - - - - -

    -
    -

    Returns a string containing the representation of fix radix -base (between 2 and 36).

    - -

    12345.to_s #=> “12345” - 12345.to_s(2) #=> “11000000111001” - 12345.to_s(8) #=> “30071” - 12345.to_s(10) #=> “12345” - 12345.to_s(16) #=> “3039” - 12345.to_s(36) #=> “9ix”

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (String) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -1425
    -1426
    -1427
    -1428
    -1429
    -1430
    -1431
    -1432
    -
    -
    # File 'src/numeric.c', line 1425
    -
    -static mrb_value
    -fix_to_s(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_int base = 10;
    -
    -  mrb_get_args(mrb, "|i", &base);
    -  return mrb_fixnum_to_str(mrb, self, base);
    -}
    -
    -
    - -
    -

    - - #to_fObject - - - - - -

    -
    -

    15.2.8.3.23

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -1219
    -1220
    -1221
    -1222
    -1223
    -
    -
    # File 'src/numeric.c', line 1219
    -
    -static mrb_value
    -fix_to_f(mrb_state *mrb, mrb_value num)
    -{
    -  return mrb_float_value(mrb, (mrb_float)mrb_fixnum(num));
    -}
    -
    -
    - -
    -

    - - #to_s(base = 10) ⇒ String - - - - - -

    -
    -

    Returns a string containing the representation of fix radix -base (between 2 and 36).

    - -

    12345.to_s #=> “12345” - 12345.to_s(2) #=> “11000000111001” - 12345.to_s(8) #=> “30071” - 12345.to_s(10) #=> “12345” - 12345.to_s(16) #=> “3039” - 12345.to_s(36) #=> “9ix”

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (String) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -1425
    -1426
    -1427
    -1428
    -1429
    -1430
    -1431
    -1432
    -
    -
    # File 'src/numeric.c', line 1425
    -
    -static mrb_value
    -fix_to_s(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_int base = 10;
    -
    -  mrb_get_args(mrb, "|i", &base);
    -  return mrb_fixnum_to_str(mrb, self, base);
    -}
    -
    -
    - -
    -

    - - #|(integer) ⇒ Object - - - - - -

    -
    -

    Bitwise OR.

    - - -
    -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -1071
    -1072
    -1073
    -1074
    -1075
    -1076
    -1077
    -1078
    -
    -
    # File 'src/numeric.c', line 1071
    -
    -static mrb_value
    -fix_or(mrb_state *mrb, mrb_value x)
    -{
    -  mrb_value y;
    -
    -  mrb_get_args(mrb, "o", &y);
    -  bit_op(x, y, or, |);
    -}
    -
    -
    - -
    -

    - - #~Integer - - - - - -

    -
    -

    One’s complement: returns a number where each bit is flipped. - ex.0—00001 (1)-> 1—11110 (-2) - ex.0—00010 (2)-> 1—11101 (-3) - ex.0—00100 (4)-> 1—11011 (-5)

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    - - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -1024
    -1025
    -1026
    -1027
    -1028
    -1029
    -1030
    -
    -
    # File 'src/numeric.c', line 1024
    -
    -static mrb_value
    -fix_rev(mrb_state *mrb, mrb_value num)
    -{
    -  mrb_int val = mrb_fixnum(num);
    -
    -  return mrb_fixnum_value(~val);
    -}
    -
    -
    - -
    - -
    - - - -
    - - \ No newline at end of file diff --git a/docs/api/Float.html b/docs/api/Float.html index 0e8efb2..5937a5c 100644 --- a/docs/api/Float.html +++ b/docs/api/Float.html @@ -6,17 +6,17 @@ Class: Float - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -73,13 +73,11 @@
    Inherits:
    - Numeric + Object @@ -100,23 +98,11 @@
    Defined in:
    -
    src/numeric.c
    +
    mrblib/numeric.rb
    -

    Overview

    -
    -

    15.2.9

    - - -
    -
    -
    - - -
    - @@ -135,7 +121,7 @@

  • - #% ⇒ Object + #step(num = nil, step = 1, &block) ⇒ Object @@ -149,2729 +135,128 @@

    -

    Return the modulo after division of flt by other.

    -
    +

  • -
  • - - - #& ⇒ Object - - - - - - - - - - - - - -
    -
    + -
  • - - -
  • - - - #*(other) ⇒ Float - - - - - - - - - - - -

    Returns a new float which is the product of float and other.

    -
    - -
  • - -
  • - - - #+ ⇒ Object - +
    +

    Instance Method Details

    - - - - - - - - - +
    +

    -

    15.2.9.3.1.

    -
    + #step(num = nil, step = 1, &block) ⇒ Object -

  • - - -
  • - - - #-(other) ⇒ Float - - - - - - - - - -

    Returns a new float which is the difference of float and other.

    -
    - -
  • - - -
  • - - - #<< ⇒ Object - - +
  • +
    - - - - - - - - +
    +
    +
    -
    -
    +

    Raises:

    + - - - - - - - - - +
    - -

    15.2.8.3.16.

    -
    - - + + + + + +
    +
     
    -      
    -        
  • - - - #finite? ⇒ Boolean - +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159
  • +
    +
    # File 'mrblib/numeric.rb', line 135
    +
    +def step(num=nil, step=1, &block)
    +  raise ArgumentError, "step can't be 0" if step == 0
    +  return to_enum(:step, num, step) unless block
    +
    +  i = self
    +  if num == self || step.infinite?
    +    block.call(i) if step > 0 && i <= (num||i) || step < 0 && i >= (num||-i)
    +  elsif num == nil
    +    while true
    +      block.call(i)
    +      i += step
    +    end
    +  elsif step > 0
    +    while i <= num
    +      block.call(i)
    +      i += step
    +    end
    +  else
    +    while i >= num
    +      block.call(i)
    +      i += step
    +    end
    +  end
    +  self
    +end
    +
    + - - - - - - - - - - -

    Returns true if flt is a valid IEEE floating point number (it is not infinite, and nan? is false).

    -
    - - + - -
  • - - - #floor ⇒ Integer - - - - - - - - - - - - - -

    Returns the largest integer less than or equal to flt.

    -
    - -
  • - - -
  • - - - #infinite? ⇒ nil, ... - - - - - - - - - - - - - -

    Returns nil, -1, or +1 depending on whether flt is finite, -infinity, or +infinity.

    -
    - -
  • - - -
  • - - - #to_s ⇒ String - - - - - - - - - - - - - -

    Returns a string containing a representation of self.

    -
    - -
  • - - -
  • - - - #nan? ⇒ Boolean - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #round([ndigits]) ⇒ Integer, Float - - - - - - - - - - - - - -

    Rounds flt to a given precision in decimal digits (default 0 digits).

    -
    - -
  • - - -
  • - - - #to_f ⇒ self - - - - - - - - - - - - - -

    As flt is already a float, returns +self+.

    -
    - -
  • - - -
  • - - - #to_i ⇒ Object - - - - - - - - - - - - - -

    Returns flt truncated to an Integer.

    -
    - -
  • - - -
  • - - - #to_int ⇒ Object - - - - - - - - - - - - - -

    Returns flt truncated to an Integer.

    -
    - -
  • - - -
  • - - - #to_s ⇒ String - - - - - - - - - - - - - -

    Returns a string containing a representation of self.

    -
    - -
  • - - -
  • - - - #truncate ⇒ Object - - - - - - - - - - - - - -

    Returns flt truncated to an Integer.

    -
    - -
  • - - -
  • - - - #| ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #~ ⇒ Object - - - - - - - - - - - - - -

    15.2.9.3.7.

    -
    - -
  • - - - - - - - - - - - - - - -

    Methods inherited from Numeric

    -

    #+@, #-@, #abs, #negative?, #nonzero?, #positive?, #to_r, #zero?

    - - - - - - - - - -

    Methods included from Comparable

    -

    #<, #<=, #>, #>=, #between?, #clamp

    - - -
    -

    Instance Method Details

    - - -
    -

    - - - #%(other) ⇒ Float - - #modulo(other) ⇒ Float - - - - - - -

    -
    -

    Return the modulo after division of flt by other.

    - -

    6543.21.modulo(137) #=> 104.21 - 6543.21.modulo(137.24) #=> 92.9299999999996

    - - -
    -
    -
    - -

    Overloads:

    -
      - - -
    • - #%(other) ⇒ Float -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Float) - - - -
      • - -
      - -
      - - -
    • - - -
    • - #modulo(other) ⇒ Float -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Float) - - - -
      • - -
      - -
      - - -
    • - -
    - - -
    - - - - - - -
    -
    -
    -
    -343
    -344
    -345
    -346
    -347
    -348
    -349
    -350
    -351
    -352
    -353
    -
    -
    # File 'src/numeric.c', line 343
    -
    -static mrb_value
    -flo_mod(mrb_state *mrb, mrb_value x)
    -{
    -  mrb_value y;
    -  mrb_float mod;
    -
    -  mrb_get_args(mrb, "o", &y);
    -
    -  flodivmod(mrb, mrb_float(x), mrb_to_flo(mrb, y), 0, &mod);
    -  return mrb_float_value(mrb, mod);
    -}
    -
    -
    - -
    -

    - - #&Object - - - - - -

    - - - - -
    -
    -
    -
    -1037
    -
    -
    # File 'src/numeric.c', line 1037
    -
    -static mrb_value flo_and(mrb_state *mrb, mrb_value x);
    -
    -
    - -
    -

    - - #*(other) ⇒ Float - - - - - -

    -
    -

    Returns a new float which is the product of float -and other.

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Float) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -281
    -282
    -283
    -284
    -285
    -286
    -287
    -288
    -
    -
    # File 'src/numeric.c', line 281
    -
    -static mrb_value
    -flo_mul(mrb_state *mrb, mrb_value x)
    -{
    -  mrb_value y;
    -
    -  mrb_get_args(mrb, "o", &y);
    -  return mrb_float_value(mrb, mrb_float(x) * mrb_to_flo(mrb, y));
    -}
    -
    -
    - -
    -

    - - #+Object - - - - - -

    -
    -

    15.2.9.3.1

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -1597
    -1598
    -1599
    -1600
    -1601
    -1602
    -1603
    -1604
    -
    -
    # File 'src/numeric.c', line 1597
    -
    -static mrb_value
    -flo_plus(mrb_state *mrb, mrb_value x)
    -{
    -  mrb_value y;
    -
    -  mrb_get_args(mrb, "o", &y);
    -  return mrb_float_value(mrb, mrb_float(x) + mrb_to_flo(mrb, y));
    -}
    -
    -
    - -
    -

    - - #-(other) ⇒ Float - - - - - -

    -
    -

    Returns a new float which is the difference of float -and other.

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Float) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -263
    -264
    -265
    -266
    -267
    -268
    -269
    -270
    -
    -
    # File 'src/numeric.c', line 263
    -
    -static mrb_value
    -flo_minus(mrb_state *mrb, mrb_value x)
    -{
    -  mrb_value y;
    -
    -  mrb_get_args(mrb, "o", &y);
    -  return mrb_float_value(mrb, mrb_float(x) - mrb_to_flo(mrb, y));
    -}
    -
    -
    - -
    -

    - - #<<Object - - - - - -

    - - - - -
    -
    -
    -
    -535
    -536
    -537
    -538
    -539
    -540
    -541
    -542
    -
    -
    # File 'src/numeric.c', line 535
    -
    -static mrb_value
    -flo_lshift(mrb_state *mrb, mrb_value x)
    -{
    -  mrb_int width;
    -
    -  mrb_get_args(mrb, "i", &width);
    -  return flo_shift(mrb, x, width);
    -}
    -
    -
    - -
    -

    - - #==(obj) ⇒ Boolean - - - - - -

    -
    -

    Returns true only if obj has the same value -as flt. Contrast this with Float#eql?, which -requires obj to be a Float.

    - -

    1.0 == 1 #=> true

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Boolean) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -402
    -403
    -404
    -405
    -406
    -407
    -408
    -409
    -410
    -411
    -412
    -413
    -414
    -415
    -416
    -
    -
    # File 'src/numeric.c', line 402
    -
    -static mrb_value
    -flo_eq(mrb_state *mrb, mrb_value x)
    -{
    -  mrb_value y;
    -  mrb_get_args(mrb, "o", &y);
    -
    -  switch (mrb_type(y)) {
    -  case MRB_TT_FIXNUM:
    -    return mrb_bool_value(mrb_float(x) == (mrb_float)mrb_fixnum(y));
    -  case MRB_TT_FLOAT:
    -    return mrb_bool_value(mrb_float(x) == mrb_float(y));
    -  default:
    -    return mrb_false_value();
    -  }
    -}
    -
    -
    - -
    -

    - - #>>Object - - - - - -

    - - - - -
    -
    -
    -
    -526
    -527
    -528
    -529
    -530
    -531
    -532
    -533
    -
    -
    # File 'src/numeric.c', line 526
    -
    -static mrb_value
    -flo_rshift(mrb_state *mrb, mrb_value x)
    -{
    -  mrb_int width;
    -
    -  mrb_get_args(mrb, "i", &width);
    -  return flo_shift(mrb, x, -width);
    -}
    -
    -
    - -
    -

    - - #^Object - - - - - -

    - - - - -
    -
    -
    -
    -1039
    -
    -
    # File 'src/numeric.c', line 1039
    -
    -static mrb_value flo_xor(mrb_state *mrb, mrb_value x);
    -
    -
    - -
    -

    - - #ceilInteger - - - - - -

    -
    -

    Returns the smallest Integer greater than or equal to -flt.

    - -

    1.2.ceil #=> 2 - 2.0.ceil #=> 2 - (-1.2).ceil #=> -1 - (-2.0).ceil #=> -2

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    - - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -646
    -647
    -648
    -649
    -650
    -651
    -652
    -653
    -
    -
    # File 'src/numeric.c', line 646
    -
    -static mrb_value
    -flo_ceil(mrb_state *mrb, mrb_value num)
    -{
    -  mrb_float f = ceil(mrb_float(num));
    -
    -  mrb_check_num_exact(mrb, f);
    -  return mrb_int_value(mrb, f);
    -}
    -
    -
    - -
    -

    - - #divmodObject - - - - - -

    -
    -

    15.2.9.3.15

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -967
    -968
    -969
    -970
    -971
    -972
    -973
    -974
    -975
    -976
    -977
    -978
    -979
    -980
    -
    -
    # File 'src/numeric.c', line 967
    -
    -static mrb_value
    -flo_divmod(mrb_state *mrb, mrb_value x)
    -{
    -  mrb_value y;
    -  mrb_float div, mod;
    -  mrb_value a, b;
    -
    -  mrb_get_args(mrb, "o", &y);
    -
    -  flodivmod(mrb, mrb_float(x), mrb_to_flo(mrb, y), &div, &mod);
    -  a = mrb_int_value(mrb, div);
    -  b = mrb_float_value(mrb, mod);
    -  return mrb_assoc_new(mrb, a, b);
    -}
    -
    -
    - -
    -

    - - #eql?Boolean - - - - - -

    -
    -

    15.2.8.3.16

    - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Boolean) - - - -
    • - -
    - -
    - - - - - - -
    -
    -
    -
    -379
    -380
    -381
    -382
    -383
    -384
    -385
    -386
    -387
    -
    -
    # File 'src/numeric.c', line 379
    -
    -static mrb_value
    -flo_eql(mrb_state *mrb, mrb_value x)
    -{
    -  mrb_value y;
    -
    -  mrb_get_args(mrb, "o", &y);
    -  if (!mrb_float_p(y)) return mrb_false_value();
    -  return mrb_bool_value(mrb_float(x) == mrb_float(y));
    -}
    -
    -
    - -
    -

    - - #finite?Boolean - - - - - -

    -
    -

    Returns true if flt is a valid IEEE floating -point number (it is not infinite, and nan? is -false).

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Boolean) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -593
    -594
    -595
    -596
    -597
    -
    -
    # File 'src/numeric.c', line 593
    -
    -static mrb_value
    -flo_finite_p(mrb_state *mrb, mrb_value num)
    -{
    -  return mrb_bool_value(isfinite(mrb_float(num)));
    -}
    -
    -
    - -
    -

    - - #floorInteger - - - - - -

    -
    -

    Returns the largest integer less than or equal to flt.

    - -

    1.2.floor #=> 1 - 2.0.floor #=> 2 - (-1.2).floor #=> -2 - (-2.0).floor #=> -2

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    - - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -623
    -624
    -625
    -626
    -627
    -628
    -629
    -630
    -
    -
    # File 'src/numeric.c', line 623
    -
    -static mrb_value
    -flo_floor(mrb_state *mrb, mrb_value num)
    -{
    -  mrb_float f = floor(mrb_float(num));
    -
    -  mrb_check_num_exact(mrb, f);
    -  return mrb_int_value(mrb, f);
    -}
    -
    -
    - -
    -

    - - #infinite?nil, ... - - - - - -

    -
    -

    Returns nil, -1, or +1 depending on whether flt -is finite, -infinity, or +infinity.

    - -

    (0.0).infinite? #=> nil - (-1.0/0.0).infinite? #=> -1 - (+1.0/0.0).infinite? #=> 1

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (nil, -1, +1) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -571
    -572
    -573
    -574
    -575
    -576
    -577
    -578
    -579
    -580
    -
    -
    # File 'src/numeric.c', line 571
    -
    -static mrb_value
    -flo_infinite_p(mrb_state *mrb, mrb_value num)
    -{
    -  mrb_float value = mrb_float(num);
    -
    -  if (isinf(value)) {
    -    return mrb_fixnum_value(value < 0 ? -1 : 1);
    -  }
    -  return mrb_nil_value();
    -}
    -
    -
    - -
    -

    - - #to_sString - - - - - -

    -
    -

    Returns a string containing a representation of self. As well as a -fixed or exponential form of the number, the call may return -“NaN”, “Infinity”, and -“-Infinity”.

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (String) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -209
    -210
    -211
    -212
    -213
    -214
    -215
    -216
    -217
    -218
    -219
    -220
    -221
    -222
    -223
    -224
    -225
    -226
    -227
    -228
    -229
    -230
    -231
    -232
    -233
    -234
    -235
    -236
    -237
    -238
    -239
    -240
    -241
    -242
    -243
    -244
    -245
    -246
    -247
    -248
    -249
    -250
    -251
    -252
    -
    -
    # File 'src/numeric.c', line 209
    -
    -static mrb_value
    -flo_to_s(mrb_state *mrb, mrb_value flt)
    -{
    -  mrb_float f = mrb_float(flt);
    -
    -  if (isinf(f)) {
    -    return f < 0 ? mrb_str_new_lit(mrb, "-Infinity")
    -                 : mrb_str_new_lit(mrb, "Infinity");
    -  }
    -  else if (isnan(f)) {
    -    return mrb_str_new_lit(mrb, "NaN");
    -  }
    -  else {
    -    char fmt[] = "%." MRB_STRINGIZE(FLO_TO_STR_PREC) "g";
    -    mrb_value str = mrb_float_to_str(mrb, flt, fmt);
    -    mrb_int len;
    -    char *begp, *p, *endp;
    -
    -    insert_dot_zero:
    -    begp = RSTRING_PTR(str);
    -    len = RSTRING_LEN(str);
    -    for (p = begp, endp = p + len; p < endp; ++p) {
    -      if (*p == '.') {
    -        return str;
    -      }
    -      else if (*p == 'e') {
    -        ptrdiff_t e_pos = p - begp;
    -        mrb_str_cat(mrb, str, ".0", 2);
    -        p = RSTRING_PTR(str) + e_pos;
    -        memmove(p + 2, p, len - e_pos);
    -        memcpy(p, ".0", 2);
    -        return str;
    -      }
    -    }
    -
    -    if (FLO_TO_STR_PREC + (begp[0] == '-') <= len) {
    -      --fmt[sizeof(fmt) - 3];  /* %.16g(%.8g) -> %.15g(%.7g) */
    -      str = mrb_float_to_str(mrb, flt, fmt);
    -      goto insert_dot_zero;
    -    }
    -
    -    return str;
    -  }
    -}
    -
    -
    - -
    -

    - - #nan?Boolean - - - - - -

    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Boolean) - - - -
    • - -
    - -
    - - - - - - -
    -
    -
    -
    -759
    -760
    -761
    -762
    -763
    -
    -
    # File 'src/numeric.c', line 759
    -
    -static mrb_value
    -flo_nan_p(mrb_state *mrb, mrb_value num)
    -{
    -  return mrb_bool_value(isnan(mrb_float(num)));
    -}
    -
    -
    - -
    -

    - - #round([ndigits]) ⇒ Integer, Float - - - - - -

    -
    -

    Rounds flt to a given precision in decimal digits (default 0 digits). -Precision may be negative. Returns a floating point number when ndigits -is more than zero.

    - -

    1.4.round #=> 1 - 1.5.round #=> 2 - 1.6.round #=> 2 - (-1.5).round #=> -2

    - -

    1.234567.round(2) #=> 1.23 - 1.234567.round(3) #=> 1.235 - 1.234567.round(4) #=> 1.2346 - 1.234567.round(5) #=> 1.23457

    - -

    34567.89.round(-5) #=> 0 - 34567.89.round(-4) #=> 30000 - 34567.89.round(-3) #=> 35000 - 34567.89.round(-2) #=> 34600 - 34567.89.round(-1) #=> 34570 - 34567.89.round(0) #=> 34568 - 34567.89.round(1) #=> 34567.9 - 34567.89.round(2) #=> 34567.89 - 34567.89.round(3) #=> 34567.89

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    - - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -686
    -687
    -688
    -689
    -690
    -691
    -692
    -693
    -694
    -695
    -696
    -697
    -698
    -699
    -700
    -701
    -702
    -703
    -704
    -705
    -706
    -707
    -708
    -709
    -710
    -711
    -712
    -713
    -714
    -715
    -716
    -717
    -718
    -719
    -720
    -721
    -722
    -723
    -724
    -725
    -726
    -727
    -728
    -729
    -730
    -731
    -732
    -733
    -734
    -735
    -
    -
    # File 'src/numeric.c', line 686
    -
    -static mrb_value
    -flo_round(mrb_state *mrb, mrb_value num)
    -{
    -  double number, f;
    -  mrb_int ndigits = 0;
    -  mrb_int i;
    -
    -  mrb_get_args(mrb, "|i", &ndigits);
    -  number = mrb_float(num);
    -
    -  if (0 < ndigits && (isinf(number) || isnan(number))) {
    -    return num;
    -  }
    -  mrb_check_num_exact(mrb, number);
    -
    -  f = 1.0;
    -  i = ndigits >= 0 ? ndigits : -ndigits;
    -  if (ndigits > DBL_DIG+2) return num;
    -  while  (--i >= 0)
    -    f = f*10.0;
    -
    -  if (isinf(f)) {
    -    if (ndigits < 0) number = 0;
    -  }
    -  else {
    -    double d;
    -
    -    if (ndigits < 0) number /= f;
    -    else number *= f;
    -
    -    /* home-made inline implementation of round(3) */
    -    if (number > 0.0) {
    -      d = floor(number);
    -      number = d + (number - d >= 0.5);
    -    }
    -    else if (number < 0.0) {
    -      d = ceil(number);
    -      number = d - (d - number >= 0.5);
    -    }
    -
    -    if (ndigits < 0) number *= f;
    -    else number /= f;
    -  }
    -
    -  if (ndigits > 0) {
    -    if (!isfinite(number)) return num;
    -    return mrb_float_value(mrb, number);
    -  }
    -  return mrb_int_value(mrb, number);
    -}
    -
    -
    - -
    -

    - - #to_fself - - - - - -

    -
    -

    As flt is already a float, returns +self+.

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (self) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -552
    -553
    -554
    -555
    -556
    -
    -
    # File 'src/numeric.c', line 552
    -
    -static mrb_value
    -flo_to_f(mrb_state *mrb, mrb_value num)
    -{
    -  return num;
    -}
    -
    -
    - -
    -

    - - - #to_iInteger - - #truncateInteger - - - - - - -

    -
    -

    Returns flt truncated to an Integer.

    - - -
    -
    -
    - -

    Overloads:

    -
      - - -
    • - #to_iInteger -
      -
      - - - -
      -
      -
      - -

      Returns:

      - - -
      - - -
    • - - -
    • - #truncateInteger -
      -
      - - - -
      -
      -
      - -

      Returns:

      - - -
      - - -
    • - -
    - - -
    - - - - - - -
    -
    -
    -
    -747
    -748
    -749
    -750
    -751
    -752
    -753
    -754
    -755
    -756
    -757
    -
    -
    # File 'src/numeric.c', line 747
    -
    -static mrb_value
    -flo_truncate(mrb_state *mrb, mrb_value num)
    -{
    -  mrb_float f = mrb_float(num);
    -
    -  if (f > 0.0) f = floor(f);
    -  if (f < 0.0) f = ceil(f);
    -
    -  mrb_check_num_exact(mrb, f);
    -  return mrb_int_value(mrb, f);
    -}
    -
    -
    - -
    -

    - - - #to_iInteger - - #truncateInteger - - - - - - -

    -
    -

    Returns flt truncated to an Integer.

    - - -
    -
    -
    - -

    Overloads:

    -
      - - -
    • - #to_iInteger -
      -
      - - - -
      -
      -
      - -

      Returns:

      - - -
      - - -
    • - - -
    • - #truncateInteger -
      -
      - - - -
      -
      -
      - -

      Returns:

      - - -
      - - -
    • - -
    - - -
    - - - - - - -
    -
    -
    -
    -747
    -748
    -749
    -750
    -751
    -752
    -753
    -754
    -755
    -756
    -757
    -
    -
    # File 'src/numeric.c', line 747
    -
    -static mrb_value
    -flo_truncate(mrb_state *mrb, mrb_value num)
    -{
    -  mrb_float f = mrb_float(num);
    -
    -  if (f > 0.0) f = floor(f);
    -  if (f < 0.0) f = ceil(f);
    -
    -  mrb_check_num_exact(mrb, f);
    -  return mrb_int_value(mrb, f);
    -}
    -
    -
    - -
    -

    - - #to_sString - - - - - -

    -
    -

    Returns a string containing a representation of self. As well as a -fixed or exponential form of the number, the call may return -“NaN”, “Infinity”, and -“-Infinity”.

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (String) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -209
    -210
    -211
    -212
    -213
    -214
    -215
    -216
    -217
    -218
    -219
    -220
    -221
    -222
    -223
    -224
    -225
    -226
    -227
    -228
    -229
    -230
    -231
    -232
    -233
    -234
    -235
    -236
    -237
    -238
    -239
    -240
    -241
    -242
    -243
    -244
    -245
    -246
    -247
    -248
    -249
    -250
    -251
    -252
    -
    -
    # File 'src/numeric.c', line 209
    -
    -static mrb_value
    -flo_to_s(mrb_state *mrb, mrb_value flt)
    -{
    -  mrb_float f = mrb_float(flt);
    -
    -  if (isinf(f)) {
    -    return f < 0 ? mrb_str_new_lit(mrb, "-Infinity")
    -                 : mrb_str_new_lit(mrb, "Infinity");
    -  }
    -  else if (isnan(f)) {
    -    return mrb_str_new_lit(mrb, "NaN");
    -  }
    -  else {
    -    char fmt[] = "%." MRB_STRINGIZE(FLO_TO_STR_PREC) "g";
    -    mrb_value str = mrb_float_to_str(mrb, flt, fmt);
    -    mrb_int len;
    -    char *begp, *p, *endp;
    -
    -    insert_dot_zero:
    -    begp = RSTRING_PTR(str);
    -    len = RSTRING_LEN(str);
    -    for (p = begp, endp = p + len; p < endp; ++p) {
    -      if (*p == '.') {
    -        return str;
    -      }
    -      else if (*p == 'e') {
    -        ptrdiff_t e_pos = p - begp;
    -        mrb_str_cat(mrb, str, ".0", 2);
    -        p = RSTRING_PTR(str) + e_pos;
    -        memmove(p + 2, p, len - e_pos);
    -        memcpy(p, ".0", 2);
    -        return str;
    -      }
    -    }
    -
    -    if (FLO_TO_STR_PREC + (begp[0] == '-') <= len) {
    -      --fmt[sizeof(fmt) - 3];  /* %.16g(%.8g) -> %.15g(%.7g) */
    -      str = mrb_float_to_str(mrb, flt, fmt);
    -      goto insert_dot_zero;
    -    }
    -
    -    return str;
    -  }
    -}
    -
    -
    - -
    -

    - - - #to_iInteger - - #truncateInteger - - - - - - -

    -
    -

    Returns flt truncated to an Integer.

    - - -
    -
    -
    - -

    Overloads:

    -
      - - -
    • - #to_iInteger -
      -
      - - - -
      -
      -
      - -

      Returns:

      - - -
      - - -
    • - - -
    • - #truncateInteger -
      -
      - - - -
      -
      -
      - -

      Returns:

      - - -
      - - -
    • - -
    - - -
    - - - - - - -
    -
    -
    -
    -747
    -748
    -749
    -750
    -751
    -752
    -753
    -754
    -755
    -756
    -757
    -
    -
    # File 'src/numeric.c', line 747
    -
    -static mrb_value
    -flo_truncate(mrb_state *mrb, mrb_value num)
    -{
    -  mrb_float f = mrb_float(num);
    -
    -  if (f > 0.0) f = floor(f);
    -  if (f < 0.0) f = ceil(f);
    -
    -  mrb_check_num_exact(mrb, f);
    -  return mrb_int_value(mrb, f);
    -}
    -
    -
    - -
    -

    - - #|Object - - - - - -

    - - - - -
    -
    -
    -
    -1038
    -
    -
    # File 'src/numeric.c', line 1038
    -
    -static mrb_value flo_or(mrb_state *mrb, mrb_value x);
    -
    -
    - -
    -

    - - #~Object - - - - - -

    -
    -

    15.2.9.3.7

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -444
    -445
    -446
    -447
    -448
    -449
    -450
    -
    -
    # File 'src/numeric.c', line 444
    -
    -static mrb_value
    -flo_rev(mrb_state *mrb, mrb_value x)
    -{
    -  int64_t v1;
    -  v1 = (int64_t)mrb_float(x);
    -  return int64_value(mrb, ~v1);
    -}
    -
    -
    - -
    + + - - \ No newline at end of file diff --git a/docs/api/FloatDomainError.html b/docs/api/FloatDomainError.html index cb7fa5a..8af5ee9 100644 --- a/docs/api/FloatDomainError.html +++ b/docs/api/FloatDomainError.html @@ -6,17 +6,17 @@ Exception: FloatDomainError - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -78,9 +78,7 @@
    • Object
    • - - - + @@ -124,36 +122,14 @@ - - - - - - - - - - - -

      Method Summary

      - -

      Methods inherited from Exception

      -

      #backtrace, #exception, #initialize, #inspect, #message, #set_backtrace, #to_s

      -
      -

      Constructor Details

      - -

      This class inherits a constructor from Exception

      - -
      - - + diff --git a/docs/api/FrozenError.html b/docs/api/FrozenError.html index 809b093..102edb6 100644 --- a/docs/api/FrozenError.html +++ b/docs/api/FrozenError.html @@ -6,17 +6,17 @@ Exception: FrozenError - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -117,11 +117,11 @@ - + diff --git a/docs/api/GC.html b/docs/api/GC.html deleted file mode 100644 index f83c793..0000000 --- a/docs/api/GC.html +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - Module: GC - - — Documentation by YARD 0.9.20 - - - - - - - - - - - - - - - - - - - - - - - -
      - - -

      Module: GC - - - -

      -
      - - - - - - - - - - - -
      -
      Defined in:
      -
      src/gc.c
      -
      - -
      - - - - - - - - - - -
      - - - -
      - - \ No newline at end of file diff --git a/docs/api/Hash.html b/docs/api/Hash.html index 2477504..58cf2a2 100644 --- a/docs/api/Hash.html +++ b/docs/api/Hash.html @@ -6,17 +6,17 @@ Class: Hash - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -104,7 +104,7 @@
      Defined in:
      mrblib/hash.rb,
      - src/hash.c,
      mrblib/hash.rb,
      mrbgems/mruby-hash-ext/mrblib/hash.rb
      + mrbgems/mruby-hash-ext/mrblib/hash.rb
      @@ -112,9 +112,10 @@

      Overview

      -

      Hash is enumerable

      + +

      Hash

      -

      ISO 15.2.13.3

      +

      ISO 15.2.13

      @@ -122,8 +123,8 @@

      Overview

      -
      - +
      + @@ -162,7 +163,8 @@

      -

      call-seq: Hash[ key, value, … ] -> new_hash Hash[ [ [key, value], … ] ] -> new_hash Hash[ object ] -> new_hash.

      +
      +

      call-seq: Hash[ key, value, … ] -> new_hash Hash[ [ [key, value], … ] ] -> new_hash Hash[ object ] -> new_hash.

      @@ -194,7 +196,8 @@

      -

      call-seq: hash < other -> true or false.

      +
      +

      call-seq: hash < other -> true or false.

      @@ -217,7 +220,8 @@

      -

      call-seq: hash <= other -> true or false.

      +
      +

      call-seq: hash <= other -> true or false.

      @@ -240,7 +244,8 @@

      -

      Equality—Two hashes are equal if they each contain the same number of keys and if each key-value pair is equal to (according to Object#==) the corresponding elements in the other hash.

      +
      +

      call-seq: hash == object -> true or false.

      @@ -263,7 +268,8 @@

      -

      call-seq: hash > other -> true or false.

      +
      +

      call-seq: hash > other -> true or false.

      @@ -286,7 +292,8 @@

      -

      call-seq: hash >= other -> true or false.

      +
      +

      call-seq: hash >= other -> true or false.

      @@ -295,7 +302,7 @@

    • - #[](key) ⇒ Object + #compact ⇒ Object @@ -309,7 +316,8 @@

      -

      Element Reference—Retrieves the value object corresponding to the key object.

      +
      +

      call-seq: hsh.compact -> new_hsh.

    • @@ -318,7 +326,7 @@

    • - #[]= ⇒ Object + #compact! ⇒ Object @@ -332,7 +340,8 @@

      -

      Element Assignment—Associates the value given by value with the key given by key.

      +
      +

      call-seq: hsh.compact! -> hsh.

    • @@ -341,7 +350,7 @@

    • - #__delete ⇒ Object + #delete(key, &block) ⇒ Object @@ -355,7 +364,8 @@

      -

      core of 15.2.13.4.8.

      +
      +

      call-seq: hash.delete(key) -> value or nil hash.delete(key) {|key| … } -> object.

    • @@ -364,7 +374,7 @@

    • - #_inspect(recur_list) ⇒ Object + #delete_if(&block) ⇒ Object @@ -378,7 +388,8 @@

      -

      internal method for Hash inspection.

      +
      +

      call-seq: hsh.delete_if {| key, value | block } -> hsh hsh.delete_if -> an_enumerator.

    • @@ -387,7 +398,7 @@

    • - #clear ⇒ Hash + #dig(idx, *args) ⇒ Object @@ -401,7 +412,8 @@

      -

      Removes all key-value pairs from hsh.

      +
      +

      call-seq: hsh.dig(key,…) -> object.

    • @@ -410,32 +422,11 @@

    • - #compact ⇒ Object - - + #each(&block) ⇒ Object - - - - - - - - - - -

      call-seq: hsh.compact -> new_hsh.

      -
      - -
    • - -
    • - - - #compact! ⇒ Object - + (also: #each_pair) @@ -447,7 +438,8 @@

      -

      call-seq: hsh.compact! -> hsh.

      +
      +

      call-seq: hsh.each {| key, value | block } -> hsh hsh.each_pair {| key, value | block } -> hsh hsh.each -> an_enumerator hsh.each_pair -> an_enumerator.

    • @@ -456,7 +448,7 @@

    • - #default(key = nil) ⇒ Object + #each_key(&block) ⇒ Object @@ -470,7 +462,8 @@

      -

      Returns the default value, the value that would be returned by hsh[key] if key did not exist in hsh.

      +
      +

      call-seq: hsh.each_key {| key | block } -> hsh hsh.each_key -> an_enumerator.

    • @@ -479,7 +472,7 @@

    • - #default=(obj) ⇒ Object + #each_value(&block) ⇒ Object @@ -493,7 +486,8 @@

      -

      Sets the default value, the value returned for a key that does not exist in the hash.

      +
      +

      call-seq: hsh.each_value {| value | block } -> self hsh.each_value -> an_enumerator.

    • @@ -502,7 +496,7 @@

    • - #default_proc ⇒ Object + #eql?(hash) ⇒ Boolean @@ -516,7 +510,8 @@

      -

      If Hash::new was invoked with a block, return that block, otherwise return nil.

      +
      +

      call-seq: hash.eql? object -> true or false.

    • @@ -525,7 +520,7 @@

    • - #default_proc=(proc_obj) ⇒ Proc + #fetch(key, none = NONE, &block) ⇒ Object @@ -539,7 +534,8 @@

      -

      Sets the default proc to be executed on each key lookup.

      +
      +

      call-seq: hsh.fetch(key [, default] ) -> obj hsh.fetch(key) {| key | block } -> obj.

    • @@ -548,7 +544,7 @@

    • - #delete(key, &block) ⇒ Object + #fetch_values(*keys, &block) ⇒ Object @@ -562,7 +558,8 @@

      -

      Delete the element with the key +key+.

      +
      +

      call-seq: hsh.fetch_values(key, …) -> array hsh.fetch_values(key, …) { |key| block } -> array.

    • @@ -571,7 +568,7 @@

    • - #delete_if(&block) ⇒ Object + #flatten(level = 1) ⇒ Object @@ -585,15 +582,8 @@

      -
      - - - - - - - -
      call-seq: hsh.delete_if {key, valueblock } -> hsh hsh.delete_if -> an_enumerator.
      +
      +

      call-seq: hash.flatten -> an_array hash.flatten(level) -> an_array.

    • @@ -602,7 +592,7 @@

    • - #dig(idx, *args) ⇒ Object + #invert ⇒ Object @@ -616,7 +606,8 @@

      -

      call-seq: hsh.dig(key,…) -> object.

      +
      +

      call-seq: hsh.invert -> new_hash.

    • @@ -625,12 +616,10 @@

    • - #each(&block) ⇒ Object + #keep_if(&block) ⇒ Object - (also: #each_pair) - @@ -641,7 +630,8 @@

      -

      Calls the given block for each element of +self+ and pass the key and value of each element.

      +
      +

      call-seq: hsh.keep_if {| key, value | block } -> hsh hsh.keep_if -> an_enumerator.

    • @@ -650,7 +640,7 @@

    • - #each_key(&block) ⇒ Object + #key(val) ⇒ Object @@ -664,7 +654,8 @@

      -

      Calls the given block for each element of +self+ and pass the key of each element.

      +
      +

      call-seq: hsh.key(value) -> key.

    • @@ -673,7 +664,7 @@

    • - #each_value(&block) ⇒ Object + #merge(*others, &block) ⇒ Object @@ -687,7 +678,8 @@

      -

      Calls the given block for each element of +self+ and pass the value of each element.

      +
      +

      call-seq: hsh.merge(other_hash..) -> hsh hsh.merge(other_hash..){|key, oldval, newval| block} -> hsh.

    • @@ -696,32 +688,11 @@

    • - #empty? ⇒ Boolean + #merge!(*others, &block) ⇒ Object - - - - - - - - - - -

      Returns true if hsh contains no key-value pairs.

      -
      - -
    • - - -
    • - - - #eql?(hash) ⇒ Boolean - - + (also: #update) @@ -733,7 +704,8 @@

      -

      Returns true if hash and other are both hashes with the same content compared by eql?.

      +
      +

      call-seq: hsh.merge!(other_hash..) -> hsh hsh.merge!(other_hash..){|key, oldval, newval| block} -> hsh.

    • @@ -742,7 +714,7 @@

    • - #fetch(key, none = NONE, &block) ⇒ Object + #reject(&block) ⇒ Object @@ -756,15 +728,8 @@

      -
      - - - - - - - -
      call-seq: hsh.fetch(key [, default] ) -> obj hsh.fetch(key) {keyblock } -> obj.
      +
      +

      call-seq: hsh.reject {|key, value| block} -> a_hash hsh.reject -> an_enumerator.

    • @@ -773,7 +738,7 @@

    • - #fetch_values(*keys, &block) ⇒ Object + #reject!(&block) ⇒ Object @@ -787,15 +752,8 @@

      -
      - - - - - - - -
      call-seq: hsh.fetch_values(key, …) -> array hsh.fetch_values(key, …) {keyblock } -> array.
      +
      +

      call-seq: hsh.reject! {| key, value | block } -> hsh or nil hsh.reject! -> an_enumerator.

    • @@ -804,10 +762,12 @@

    • - #flatten(level = 1) ⇒ Object + #select(&block) ⇒ Object + (also: #filter) + @@ -818,7 +778,8 @@

      -

      call-seq: hash.flatten -> an_array hash.flatten(level) -> an_array.

      +
      +

      call-seq: hsh.select {|key, value| block} -> a_hash hsh.select -> an_enumerator.

    • @@ -827,10 +788,12 @@

    • - #has_key? ⇒ Boolean + #select!(&block) ⇒ Object + (also: #filter!) + @@ -841,7 +804,8 @@

      -

      15.2.13.4.13.

      +
      +

      call-seq: hsh.select! {| key, value | block } -> hsh or nil hsh.select! -> an_enumerator.

    • @@ -850,7 +814,7 @@

    • - #has_value? ⇒ Object + #to_h ⇒ Object @@ -864,7 +828,8 @@

      -

      Returns true if the given value is present for some key in hsh.

      +
      +

      call-seq: hsh.to_h -> hsh or new_hash.

    • @@ -873,7 +838,7 @@

    • - #include? ⇒ Boolean + #to_proc ⇒ Object @@ -887,8 +852,7 @@

      -

      15.2.13.4.15.

      -
      +

    • @@ -896,15 +860,13 @@

    • - #initialize ⇒ Object + #transform_keys(&block) ⇒ Object - constructor - @@ -912,7 +874,8 @@

      -

      Returns a new, empty hash.

      +
      +

      call-seq: hsh.transform_keys {|key| block } -> new_hash hsh.transform_keys -> an_enumerator.

    • @@ -921,12 +884,10 @@

    • - #inspect ⇒ Object + #transform_keys!(&block) ⇒ Object - (also: #to_s) - @@ -937,7 +898,8 @@

      -

      ISO 15.2.13.4.30 (x).

      +
      +

      call-seq: hsh.transform_keys! {|key| block } -> hsh hsh.transform_keys! -> an_enumerator.

    • @@ -946,7 +908,7 @@

    • - #invert ⇒ Object + #transform_values(&b) ⇒ Object @@ -960,7 +922,8 @@

      -

      call-seq: hsh.invert -> new_hash.

      +
      +

      call-seq: hsh.transform_values {|value| block } -> new_hash hsh.transform_values -> an_enumerator.

    • @@ -969,7 +932,7 @@

    • - #keep_if(&block) ⇒ Object + #transform_values!(&b) ⇒ Object @@ -983,51 +946,17 @@

      -
      - - - - - - - -
      call-seq: hsh.keep_if {key, valueblock } -> hsh hsh.keep_if -> an_enumerator.
      +
      +

      call-seq: hsh.transform_values! {|key| block } -> hsh hsh.transform_values! -> an_enumerator.

    • -
    • - - - #key(val) ⇒ Object - - - - - - - - - - - - - -

      call-seq: hsh.key(value) -> key.

      -
      +
    - - -
  • - - - #key? ⇒ Boolean - - - @@ -1035,2580 +964,145 @@

    - - -

    15.2.13.4.18.

    -
    -

  • +

    Methods included from Enumerable

    +

    #all?, #any?, #chain, #chunk, #chunk_while, #collect, #count, #cycle, #detect, #drop, #drop_while, #each_cons, #each_entry, #each_slice, #each_with_index, #each_with_object, #entries, #filter_map, #find_all, #find_index, #first, #flat_map, #grep, #grep_v, #group_by, #hash, #include?, #inject, #lazy, #max, #max_by, #min, #min_by, #minmax, #minmax_by, #none?, #one?, #partition, #reverse_each, #sort, #sort_by, #sum, #take, #take_while, #tally, #uniq, #zip

    - -
  • - - - #keys ⇒ Array - + +
    +

    Class Method Details

    - - - - - - +
    +

    + .[](*object) ⇒ Object -

    Returns a new array populated with the keys from this hash.

    -
    - -

  • - - -
  • - - - #length ⇒ Object - - - - - - - - - +
  • +
    + +

    call-seq: Hash[ key, value, … ] -> new_hash Hash[ [ [key, value], … ] ] -> new_hash Hash[ object ] -> new_hash

    - -

    Returns the number of key-value pairs in the hash.

    -
    - - +

    Creates a new hash populated with the given objects.

    - -
  • - - - #member? ⇒ Boolean - +

    Similar to the literal { key => value, ... }. In the first form, keys and values occur in pairs, so there must be an even number of arguments.

    - -
    - - - - - - - +

    The second and third form take a single argument which is either an array of key-value pairs or an object convertible to a hash.

    - -

    15.2.13.4.21.

    -
    - -
  • +
    Hash["a", 100, "b", 200] #=> {"a"=>100, "b"=>200}
    +Hash[ [ ["a", 100], ["b", 200] ] ] #=> {"a"=>100, "b"=>200}
    +Hash["a" => 100, "b" => 200] #=> {"a"=>100, "b"=>200}
    +
    - -
  • - - - #merge(other, &block) ⇒ Object - - - - - - - - - +
  • +
    +
    - -

    Return a hash which contains the content of +self+ and +other+.

    -
    - - +
    - -
  • - - - #merge!(other, &block) ⇒ Object - - - - (also: #update) - - - - - - - - - - - -
    - - - - - - -
    call-seq: hsh.merge!(other_hash) -> hsh hsh.merge!(other_hash) key, oldval, newvalblock -> hsh.
    -
    - -
  • - - -
  • - - - #rehash ⇒ Hash - - - - - - - - - - - - - -

    Rebuilds the hash based on the current hash values for each key.

    -
    - -
  • - - -
  • - - - #reject(&block) ⇒ Object - - - - - - - - - - - - - -
    - - - - - - -
    call-seq: hsh.reject key, valueblock -> a_hash hsh.reject -> an_enumerator.
    -
    - -
  • - - -
  • - - - #reject!(&block) ⇒ Object - - - - - - - - - - - - - -
    - - - - - - - -
    call-seq: hsh.reject! {key, valueblock } -> hsh or nil hsh.reject! -> an_enumerator.
    -
    - -
  • - - -
  • - - - #replace(hash) ⇒ Object - - - - (also: #initialize_copy) - - - - - - - - - - - -

    Replaces the contents of hsh with the contents of other hash.

    -
    - -
  • - - -
  • - - - #select(&block) ⇒ Object - - - - (also: #filter) - - - - - - - - - - - -
    - - - - - - -
    call-seq: hsh.select key, valueblock -> a_hash hsh.select -> an_enumerator.
    -
    - -
  • - - -
  • - - - #select!(&block) ⇒ Object - - - - (also: #filter!) - - - - - - - - - - - -
    - - - - - - - -
    call-seq: hsh.select! {key, valueblock } -> hsh or nil hsh.select! -> an_enumerator.
    -
    - -
  • - - -
  • - - - #shift ⇒ Array, Object - - - - - - - - - - - - - -

    Removes a key-value pair from hsh and returns it as the two-item array [ key, value ], or the hash’s default value if the hash is empty.

    -
    - -
  • - - -
  • - - - #size ⇒ Object - - - - - - - - - - - - - -

    Returns the number of key-value pairs in the hash.

    -
    - -
  • - - -
  • - - - #slice(*keys) ⇒ Hash - - - - - - - - - - - - - -

    Returns a hash containing only the given keys and their values.

    -
    - -
  • - - -
  • - - - #store ⇒ Object - - - - - - - - - - - - - -

    Element Assignment—Associates the value given by value with the key given by key.

    -
    - -
  • - - -
  • - - - #to_h ⇒ Object - - - - - - - - - - - - - -

    call-seq: hsh.to_h -> hsh or new_hash.

    -
    - -
  • - - -
  • - - - #to_proc ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #transform_keys(&block) ⇒ Object - - - - - - - - - - - - - -
    - - - - - - - -
    call-seq: hsh.transform_keys {keyblock } -> new_hash hsh.transform_keys -> an_enumerator.
    -
    - -
  • - - -
  • - - - #transform_keys!(&block) ⇒ Object - - - - - - - - - - - - - -
    - - - - - - - -
    call-seq: hsh.transform_keys! {keyblock } -> hsh hsh.transform_keys! -> an_enumerator.
    -
    - -
  • - - -
  • - - - #transform_values(&b) ⇒ Object - - - - - - - - - - - - - -
    - - - - - - - -
    call-seq: hsh.transform_values {valueblock } -> new_hash hsh.transform_values -> an_enumerator.
    -
    - -
  • - - -
  • - - - #transform_values!(&b) ⇒ Object - - - - - - - - - - - - - -
    - - - - - - - -
    call-seq: hsh.transform_values! {keyblock } -> hsh hsh.transform_values! -> an_enumerator.
    -
    - -
  • - - -
  • - - - #value? ⇒ Object - - - - - - - - - - - - - -

    Returns true if the given value is present for some key in hsh.

    -
    - -
  • - - -
  • - - - #values ⇒ Array - - - - - - - - - - - - - -

    Returns a new array populated with the values from hsh.

    -
    - -
  • - - -
  • - - - #values_at(key, ...) ⇒ Array - - - - - - - - - - - - - -

    Return an array containing the values associated with the given keys.

    -
    - -
  • - - - - - - - - - - - - - - -

    Methods included from Enumerable

    -

    __update_hash, #all?, #any?, #chain, #collect, #count, #cycle, #detect, #drop, #drop_while, #each_cons, #each_slice, #each_with_index, #each_with_object, #entries, #filter_map, #find_all, #find_index, #first, #flat_map, #grep, #group_by, #hash, #inject, #lazy, #max, #max_by, #min, #min_by, #minmax, #minmax_by, #none?, #one?, #partition, #reverse_each, #sort, #sort_by, #take, #take_while, #tally, #uniq, #zip

    -
    -

    Constructor Details

    - -
    -

    - - - #newObject - - #new(obj) ⇒ Object - - #new {|hash, key| ... } ⇒ Object - - - - - - -

    -
    -

    Returns a new, empty hash. If this hash is subsequently accessed by -a key that doesn’t correspond to a hash entry, the value returned -depends on the style of new used to create the hash. In -the first form, the access returns nil. If -obj is specified, this single object will be used for -all default values. If a block is specified, it will be -called with the hash object and the key, and should return the -default value. It is the block’s responsibility to store the value -in the hash if required.

    - -
    h = Hash.new("Go Fish")
    -h["a"] = 100
    -h["b"] = 200
    -h["a"]           #=> 100
    -h["c"]           #=> "Go Fish"
    -# The following alters the single default object
    -h["c"].upcase!   #=> "GO FISH"
    -h["d"]           #=> "GO FISH"
    -h.keys           #=> ["a", "b"]
    -
    -# While this creates a new default object each time
    -h = Hash.new { |hash, key| hash[key] = "Go Fish: #{key}" }
    -h["c"]           #=> "Go Fish: c"
    -h["c"].upcase!   #=> "GO FISH: C"
    -h["d"]           #=> "Go Fish: d"
    -h.keys           #=> ["c", "d"]
    -
    - - -
    -
    -
    - -

    Overloads:

    -
      - - - - -
    • - #new {|hash, key| ... } ⇒ Object -
      -
      - - - -
      -
      -
      - -

      Yields:

      - - -
      - - -
    • - -
    - - -
    - - - - - - -
    -
    -
    -
    -792
    -793
    -794
    -795
    -796
    -797
    -798
    -799
    -800
    -801
    -802
    -803
    -804
    -805
    -806
    -807
    -808
    -809
    -810
    -811
    -812
    -813
    -
    -
    # File 'src/hash.c', line 792
    -
    -static mrb_value
    -mrb_hash_init(mrb_state *mrb, mrb_value hash)
    -{
    -  mrb_value block, ifnone;
    -  mrb_bool ifnone_p;
    -
    -  ifnone = mrb_nil_value();
    -  mrb_get_args(mrb, "&|o?", &block, &ifnone, &ifnone_p);
    -  mrb_hash_modify(mrb, hash);
    -  if (!mrb_nil_p(block)) {
    -    if (ifnone_p) {
    -      mrb_raise(mrb, E_ARGUMENT_ERROR, "wrong number of arguments");
    -    }
    -    RHASH(hash)->flags |= MRB_HASH_PROC_DEFAULT;
    -    ifnone = block;
    -  }
    -  if (!mrb_nil_p(ifnone)) {
    -    RHASH(hash)->flags |= MRB_HASH_DEFAULT;
    -    mrb_iv_set(mrb, hash, mrb_intern_lit(mrb, "ifnone"), ifnone);
    -  }
    -  return hash;
    -}
    -
    -
    - -
    - - -
    -

    Class Method Details

    - - -
    -

    - - .[](*object) ⇒ Object - - - - - -

    -
    -

    call-seq: - Hash[ key, value, … ] -> new_hash - Hash[ [ [key, value], … ] ] -> new_hash - Hash[ object ] -> new_hash

    - -

    Creates a new hash populated with the given objects.

    - -

    Similar to the literal { _key_ => _value_, ... }. In the first -form, keys and values occur in pairs, so there must be an even number of -arguments.

    - -

    The second and third form take a single argument which is either an array -of key-value pairs or an object convertible to a hash.

    - -
    Hash["a", 100, "b", 200] #=> {"a"=>100, "b"=>200}
    -Hash[ [ ["a", 100], ["b", 200] ] ] #=> {"a"=>100, "b"=>200}
    -Hash["a" => 100, "b" => 200] #=> {"a"=>100, "b"=>200}
    -
    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
    -61
    -
    -
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 26
    -
    -def self.[](*object)
    -  length = object.length
    -  if length == 1
    -    o = object[0]
    -    if Hash === o
    -      h = self.new
    -      o.each { |k, v| h[k] = v }
    -      return h
    -    elsif o.respond_to?(:to_a)
    -      h = self.new
    -      o.to_a.each do |i|
    -        raise ArgumentError, "wrong element type #{i.class} (expected array)" unless i.respond_to?(:to_a)
    -        k, v = nil
    -        case i.size
    -        when 2
    -          k = i[0]
    -          v = i[1]
    -        when 1
    -          k = i[0]
    -        else
    -          raise ArgumentError, "invalid number of elements (#{i.size} for 1..2)"
    -        end
    -        h[k] = v
    -      end
    -      return h
    -    end
    -  end
    -  unless length % 2 == 0
    -    raise ArgumentError, 'odd number of arguments for Hash'
    -  end
    -  h = self.new
    -  0.step(length - 2, 2) do |i|
    -    h[object[i]] = object[i + 1]
    -  end
    -  h
    -end
    -
    -
    - -
    - -
    -

    Instance Method Details

    - - -
    -

    - - #<(hash) ⇒ Object - - - - - -

    -
    -

    call-seq: - hash < other -> true or false

    - -

    Returns true if hash is subset of - other.

    - -
    h1 = {a:1, b:2}
    -h2 = {a:1, b:2, c:3}
    -h1 < h2    #=> true
    -h2 < h1    #=> false
    -h1 < h1    #=> false
    -
    - - -
    -
    -
    - -

    Raises:

    - - -
    - - - - - - -
    -
    -
    -
    -312
    -313
    -314
    -315
    -316
    -317
    -
    -
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 312
    -
    -def <(hash)
    -  raise TypeError, "can't convert #{hash.class} to Hash" unless Hash === hash
    -  size < hash.size and all? {|key, val|
    -    hash.key?(key) and hash[key] == val
    -  }
    -end
    -
    -
    - -
    -

    - - #<=(hash) ⇒ Object - - - - - -

    -
    -

    call-seq: - hash <= other -> true or false

    - -

    Returns true if hash is subset of - other or equals to other.

    - -
    h1 = {a:1, b:2}
    -h2 = {a:1, b:2, c:3}
    -h1 <= h2   #=> true
    -h2 <= h1   #=> false
    -h1 <= h1   #=> true
    -
    - - -
    -
    -
    - -

    Raises:

    - - -
    - - - - - - -
    -
    -
    -
    -332
    -333
    -334
    -335
    -336
    -337
    -
    -
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 332
    -
    -def <=(hash)
    -  raise TypeError, "can't convert #{hash.class} to Hash" unless Hash === hash
    -  size <= hash.size and all? {|key, val|
    -    hash.key?(key) and hash[key] == val
    -  }
    -end
    -
    -
    - -
    -

    - - #==(hash) ⇒ Object - - - - - -

    -
    -

    Equality—Two hashes are equal if they each contain the same number - of keys and if each key-value pair is equal to (according to - Object#==) the corresponding elements in the other - hash.

    - -

    ISO 15.2.13.4.1

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -
    -
    # File 'mrblib/hash.rb', line 13
    -
    -def ==(hash)
    -  return true if self.equal?(hash)
    -  unless Hash === hash
    -    return false
    -  end
    -  return false if self.size != hash.size
    -  self.each do |k,v|
    -    return false unless hash.key?(k)
    -    return false unless self[k] == hash[k]
    -  end
    -  return true
    -end
    -
    -
    - -
    -

    - - #>(hash) ⇒ Object - - - - - -

    -
    -

    call-seq: - hash > other -> true or false

    - -

    Returns true if other is subset of - hash.

    - -
    h1 = {a:1, b:2}
    -h2 = {a:1, b:2, c:3}
    -h1 > h2    #=> false
    -h2 > h1    #=> true
    -h1 > h1    #=> false
    -
    - - -
    -
    -
    - -

    Raises:

    - - -
    - - - - - - -
    -
    -
    -
    -352
    -353
    -354
    -355
    -356
    -357
    -
    -
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 352
    -
    -def >(hash)
    -  raise TypeError, "can't convert #{hash.class} to Hash" unless Hash === hash
    -  size > hash.size and hash.all? {|key, val|
    -    key?(key) and self[key] == val
    -  }
    -end
    -
    -
    - -
    -

    - - #>=(hash) ⇒ Object - - - - - -

    -
    -

    call-seq: - hash >= other -> true or false

    - -

    Returns true if other is subset of - hash or equals to hash.

    - -
    h1 = {a:1, b:2}
    -h2 = {a:1, b:2, c:3}
    -h1 >= h2   #=> false
    -h2 >= h1   #=> true
    -h1 >= h1   #=> true
    -
    - - -
    -
    -
    - -

    Raises:

    - - -
    - - - - - - -
    -
    -
    -
    -372
    -373
    -374
    -375
    -376
    -377
    -
    -
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 372
    -
    -def >=(hash)
    -  raise TypeError, "can't convert #{hash.class} to Hash" unless Hash === hash
    -  size >= hash.size and hash.all? {|key, val|
    -    key?(key) and self[key] == val
    -  }
    -end
    -
    -
    - -
    -

    - - #[](key) ⇒ Object - - - - - -

    -
    -

    Element Reference—Retrieves the value object corresponding -to the key object. If not found, returns the default value (see -Hash::new for details).

    - -

    h = { “a” => 100, “b” => 200 } - h[“a”] #=> 100 - h[“c”] #=> nil

    - - -
    -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -829
    -830
    -831
    -832
    -833
    -834
    -835
    -836
    -
    -
    # File 'src/hash.c', line 829
    -
    -static mrb_value
    -mrb_hash_aget(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value key;
    -
    -  mrb_get_args(mrb, "o", &key);
    -  return mrb_hash_get(mrb, self, key);
    -}
    -
    -
    - -
    -

    - - - #[]=(key) ⇒ Object - - #store(key, value) ⇒ Object - - - - - - -

    -
    -

    Element Assignment—Associates the value given by -value with the key given by key. -key should not have its value changed while it is in -use as a key (a String passed as a key will be -duplicated and frozen).

    - -
    h = { "a" => 100, "b" => 200 }
    -h["a"] = 9
    -h["c"] = 4
    -h   #=> {"a"=>9, "b"=>200, "c"=>4}
    -
    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -1125
    -1126
    -1127
    -1128
    -1129
    -1130
    -1131
    -1132
    -1133
    -
    -
    # File 'src/hash.c', line 1125
    -
    -static mrb_value
    -mrb_hash_aset(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value key, val;
    -
    -  mrb_get_args(mrb, "oo", &key, &val);
    -  mrb_hash_set(mrb, self, key, val);
    -  return val;
    -}
    -
    -
    - -
    -

    - - #__deleteObject - - - - - -

    -
    -

    core of 15.2.13.4.8

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -1004
    -1005
    -1006
    -1007
    -1008
    -1009
    -1010
    -1011
    -1012
    -
    -
    # File 'src/hash.c', line 1004
    -
    -static mrb_value
    -mrb_hash_delete(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value key;
    -
    -  mrb_get_args(mrb, "o", &key);
    -  mrb_hash_modify(mrb, self);
    -  return mrb_hash_delete_key(mrb, self, key);
    -}
    -
    -
    - -
    -

    - - #_inspect(recur_list) ⇒ Object - - - - - -

    -
    -

    internal method for Hash inspection

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -189
    -190
    -191
    -192
    -193
    -194
    -195
    -196
    -197
    -198
    -199
    -200
    -201
    -202
    -203
    -
    -
    # File 'mrblib/hash.rb', line 189
    -
    -def _inspect(recur_list)
    -  return "{}" if self.size == 0
    -  return "{...}" if recur_list[self.object_id]
    -  recur_list[self.object_id] = true
    -  ary=[]
    -  keys=self.keys
    -  size=keys.size
    -  i=0
    -  while i<size
    -    k=keys[i]
    -    ary<<(k._inspect(recur_list) + "=>" + self[k]._inspect(recur_list))
    -    i+=1
    -  end
    -  "{"+ary.join(", ")+"}"
    -end
    -
    -
    - -
    -

    - - #clearHash - - - - - -

    -
    -

    Removes all key-value pairs from hsh.

    - -
    h = { "a" => 100, "b" => 200 }   #=> {"a"=>100, "b"=>200}
    -h.clear                          #=> {}
    -
    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Hash) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -1093
    -1094
    -1095
    -1096
    -1097
    -1098
    -1099
    -1100
    -1101
    -1102
    -1103
    -1104
    -
    -
    # File 'src/hash.c', line 1093
    -
    -MRB_API mrb_value
    -mrb_hash_clear(mrb_state *mrb, mrb_value hash)
    -{
    -  htable *t = RHASH_TBL(hash);
    -
    -  mrb_hash_modify(mrb, hash);
    -  if (t) {
    -    ht_free(mrb, t);
    -    RHASH_TBL(hash) = NULL;
    -  }
    -  return hash;
    -}
    -
    -
    - -
    -

    - - #compactObject - - - - - -

    -
    -

    call-seq: - hsh.compact -> new_hsh

    - -

    Returns a new hash with the nil values/key pairs removed

    - -

    h = { a: 1, b: false, c: nil } - h.compact #=> { a: 1, b: false } - h #=> { a: 1, b: false, c: nil }

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -133
    -134
    -135
    -136
    -137
    -138
    -139
    -140
    -141
    -
    -
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 133
    -
    -def compact
    -  h = {}
    -  self.keys.select{|k|
    -    self[k] != nil
    -  }.each {|k|
    -    h[k] = self[k]
    -  }
    -  h
    -end
    -
    -
    - -
    -

    - - #compact!Object - - - - - -

    -
    -

    call-seq: - hsh.compact! -> hsh

    - -

    Removes all nil values from the hash. Returns the hash. -Returns nil if the hash does not contain nil values.

    - -

    h = { a: 1, b: false, c: nil } - h.compact! #=> { a: 1, b: false }

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -109
    -110
    -111
    -112
    -113
    -114
    -115
    -116
    -117
    -118
    -119
    -120
    -121
    -
    -
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 109
    -
    -def compact!
    -  keys = self.keys
    -  nk = keys.select{|k|
    -    self[k] != nil
    -  }
    -  return nil if (keys.size == nk.size)
    -  h = {}
    -  nk.each {|k|
    -    h[k] = self[k]
    -  }
    -  h
    -  self.replace(h)
    -end
    -
    -
    - -
    -

    - - #default(key = nil) ⇒ Object - - - - - -

    -
    -

    Returns the default value, the value that would be returned by -hsh[key] if key did not exist in hsh. -See also Hash::new and Hash#default=.

    - -

    h = Hash.new #=> {} - h.default #=> nil - h.default(2) #=> nil

    - -

    h = Hash.new(“cat”) #=> {} - h.default #=> “cat” - h.default(2) #=> “cat”

    - -

    h = Hash.new {|h,k| h[k] = k.to_i*10} #=> {} - h.default #=> nil - h.default(2) #=> 20

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Object) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -874
    -875
    -876
    -877
    -878
    -879
    -880
    -881
    -882
    -883
    -884
    -885
    -886
    -887
    -888
    -889
    -890
    -891
    -
    -
    # File 'src/hash.c', line 874
    -
    -static mrb_value
    -mrb_hash_default(mrb_state *mrb, mrb_value hash)
    -{
    -  mrb_value key;
    -  mrb_bool given;
    -
    -  mrb_get_args(mrb, "|o?", &key, &given);
    -  if (MRB_RHASH_DEFAULT_P(hash)) {
    -    if (MRB_RHASH_PROCDEFAULT_P(hash)) {
    -      if (!given) return mrb_nil_value();
    -      return mrb_funcall(mrb, RHASH_PROCDEFAULT(hash), "call", 2, hash, key);
    -    }
    -    else {
    -      return RHASH_IFNONE(hash);
    -    }
    -  }
    -  return mrb_nil_value();
    -}
    -
    -
    - -
    -

    - - #default=(obj) ⇒ Object - - - - - -

    -
    -

    Sets the default value, the value returned for a key that does not -exist in the hash. It is not possible to set the default to a -Proc that will be executed on each key lookup.

    - -

    h = { “a” => 100, “b” => 200 } - h.default = “Go fish” - h[“a”] #=> 100 - h[“z”] #=> “Go fish” - # This doesn’t do what you might hope… - h.default = proc do |hash, key| - hash[key] = key + key - end - h[2] #=> #<Proc:0x401b3948@-:6> - h[“cat”] #=> #<Proc:0x401b3948@-:6>

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Object) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -914
    -915
    -916
    -917
    -918
    -919
    -920
    -921
    -922
    -923
    -924
    -925
    -926
    -927
    -928
    -929
    -930
    -
    -
    # File 'src/hash.c', line 914
    -
    -static mrb_value
    -mrb_hash_set_default(mrb_state *mrb, mrb_value hash)
    -{
    -  mrb_value ifnone;
    -
    -  mrb_get_args(mrb, "o", &ifnone);
    -  mrb_hash_modify(mrb, hash);
    -  mrb_iv_set(mrb, hash, mrb_intern_lit(mrb, "ifnone"), ifnone);
    -  RHASH(hash)->flags &= ~MRB_HASH_PROC_DEFAULT;
    -  if (!mrb_nil_p(ifnone)) {
    -    RHASH(hash)->flags |= MRB_HASH_DEFAULT;
    -  }
    -  else {
    -    RHASH(hash)->flags &= ~MRB_HASH_DEFAULT;
    -  }
    -  return ifnone;
    -}
    -
    -
    - -
    -

    - - #default_procObject - - - - - -

    -
    -

    If Hash::new was invoked with a block, return that -block, otherwise return nil.

    - -

    h = Hash.new {|h,k| h[k] = k*k } #=> {} - p = h.default_proc #=> #<Proc:0x401b3d08@-:1> - a = [] #=> [] - p.call(a, 2) - a #=> [nil, nil, 4]

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Object) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -948
    -949
    -950
    -951
    -952
    -953
    -954
    -955
    -
    -
    # File 'src/hash.c', line 948
    -
    -static mrb_value
    -mrb_hash_default_proc(mrb_state *mrb, mrb_value hash)
    -{
    -  if (MRB_RHASH_PROCDEFAULT_P(hash)) {
    -    return RHASH_PROCDEFAULT(hash);
    -  }
    -  return mrb_nil_value();
    -}
    -
    -
    - -
    -

    - - #default_proc=(proc_obj) ⇒ Proc - - - - - -

    -
    -

    Sets the default proc to be executed on each key lookup.

    - -

    h.default_proc = proc do |hash, key| - hash[key] = key + key - end - h[2] #=> 4 - h[“cat”] #=> “catcat”

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Proc) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -970
    -971
    -972
    -973
    -974
    -975
    -976
    -977
    -978
    -979
    -980
    -981
    -982
    -983
    -984
    -985
    -986
    -987
    -988
    -
    -
    # File 'src/hash.c', line 970
    -
    -static mrb_value
    -mrb_hash_set_default_proc(mrb_state *mrb, mrb_value hash)
    -{
    -  mrb_value ifnone;
    -
    -  mrb_get_args(mrb, "o", &ifnone);
    -  mrb_hash_modify(mrb, hash);
    -  mrb_iv_set(mrb, hash, mrb_intern_lit(mrb, "ifnone"), ifnone);
    -  if (!mrb_nil_p(ifnone)) {
    -    RHASH(hash)->flags |= MRB_HASH_PROC_DEFAULT;
    -    RHASH(hash)->flags |= MRB_HASH_DEFAULT;
    -  }
    -  else {
    -    RHASH(hash)->flags &= ~MRB_HASH_DEFAULT;
    -    RHASH(hash)->flags &= ~MRB_HASH_PROC_DEFAULT;
    -  }
    -
    -  return ifnone;
    -}
    -
    -
    - -
    -

    - - #delete(key, &block) ⇒ Object - - - - - -

    -
    -

    Delete the element with the key +key+. -Return the value of the element if +key+ -was found. Return nil if nothing was -found. If a block is given, call the -block with the value of the element.

    - -

    ISO 15.2.13.4.8

    - - -
    -
    -
    - - -
    - - - -
    -
    +
    +  
    +    
    -    
    -  
    -
    +
     
     
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
     52
    -53
    -54
    -55
    -56
    -57
    -
    -
    # File 'mrblib/hash.rb', line 52
    -
    -def delete(key, &block)
    -  if block && !self.has_key?(key)
    -    return block.call(key)
    -  end
    -  self.__delete(key)
    -end
    -
    - - -
    -

    - - #delete_if(&block) ⇒ Object - - - - - -

    -
    -

    call-seq: - hsh.delete_if {| key, value | block } -> hsh - hsh.delete_if -> an_enumerator

    - -

    Deletes every key-value pair from hsh for which block - evaluates to true.

    - -

    If no block is given, an enumerator is returned instead.

    - -
    h = { "a" => 100, "b" => 200, "c" => 300 }
    -h.delete_if {|key, value| key >= "b" }   #=> {"a"=>100}
    -
    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -199
    -200
    -201
    -202
    -203
    -204
    -205
    -206
    -
    -
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 199
    -
    -def delete_if(&block)
    -  return to_enum :delete_if unless block
    -
    -  self.each do |k, v|
    -    self.delete(k) if block.call(k, v)
    -  end
    -  self
    -end
    -
    -
    - -
    -

    - - #dig(idx, *args) ⇒ Object - - - - - -

    -
    -

    call-seq: - hsh.dig(key,…) -> object

    - -

    Extracts the nested value specified by the sequence of key -objects by calling +dig+ at each step, returning +nil+ if any -intermediate step is +nil+.

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -387
    -388
    -389
    -390
    -391
    -392
    -393
    -394
    -
    -
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 387
    -
    -def dig(idx,*args)
    -  n = self[idx]
    -  if args.size > 0
    -    n&.dig(*args)
    -  else
    -    n
    -  end
    -end
    -
    -
    - -
    -

    - - #each(&block) ⇒ Object - - - - Also known as: - each_pair - - - - -

    -
    -

    Calls the given block for each element of +self+ -and pass the key and value of each element.

    - -

    call-seq: - hsh.each {| key, value | block } -> hsh - hsh.each_pair {| key, value | block } -> hsh - hsh.each -> an_enumerator - hsh.each_pair -> an_enumerator

    - -

    If no block is given, an enumerator is returned instead.

    - -
    h = { "a" => 100, "b" => 200 }
    -h.each {|key, value| puts "#{key} is #{value}" }
    -
    - -

    produces:

    - -

    a is 100 -b is 200

    - -

    ISO 15.2.13.4.9

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -90
    -91
    -92
    -93
    -
    -
    # File 'mrblib/hash.rb', line 81
    -
    -def each(&block)
    -  return to_enum :each unless block
    -
    -  keys = self.keys
    -  vals = self.values
    -  len = self.size
    -  i = 0
    -  while i < len
    -    block.call [keys[i], vals[i]]
    -    i += 1
    -  end
    -  self
    -end
    -
    -
    - -
    -

    - - #each_key(&block) ⇒ Object - - - - - -

    -
    -

    Calls the given block for each element of +self+ -and pass the key of each element.

    - -

    call-seq: - hsh.each_key {| key | block } -> hsh - hsh.each_key -> an_enumerator

    - -

    If no block is given, an enumerator is returned instead.

    - -

    h = { “a” => 100, “b” => 200 } - h.each_key {|key| puts key }

    - -

    produces:

    - -

    a - b

    - -

    ISO 15.2.13.4.10

    - - -
    -
    -
    - - -
    - - - -
    -
    -
    -
    -114
    -115
    -116
    -117
    -118
    -119
    +53 +54 +55 +56 +57 +58 +59 +60 +61
    -
    # File 'mrblib/hash.rb', line 114
    -
    -def each_key(&block)
    -  return to_enum :each_key unless block
    +      
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 26
     
    -  self.keys.each{|k| block.call(k)}
    -  self
    +def self.[](*object)
    +  length = object.length
    +  if length == 1
    +    o = object[0]
    +    if Hash === o
    +      h = self.new
    +      o.each { |k, v| h[k] = v }
    +      return h
    +    elsif o.respond_to?(:to_a)
    +      h = self.new
    +      o.to_a.each do |i|
    +        raise ArgumentError, "wrong element type #{i.class} (expected array)" unless i.respond_to?(:to_a)
    +        k, v = nil
    +        case i.size
    +        when 2
    +          k = i[0]
    +          v = i[1]
    +        when 1
    +          k = i[0]
    +        else
    +          raise ArgumentError, "invalid number of elements (#{i.size} for 1..2)"
    +        end
    +        h[k] = v
    +      end
    +      return h
    +    end
    +  end
    +  unless length % 2 == 0
    +    raise ArgumentError, 'odd number of arguments for Hash'
    +  end
    +  h = self.new
    +  0.step(length - 2, 2) do |i|
    +    h[object[i]] = object[i + 1]
    +  end
    +  h
     end
    -
    -

    - - #each_value(&block) ⇒ Object - - - - - -

    -
    -

    Calls the given block for each element of +self+ -and pass the value of each element.

    - -

    call-seq: - hsh.each_value {| value | block } -> hsh - hsh.each_value -> an_enumerator

    - -

    If no block is given, an enumerator is returned instead.

    - -

    h = { “a” => 100, “b” => 200 } - h.each_value {|value| puts value }

    - -

    produces:

    - -

    100 - 200

    - -

    ISO 15.2.13.4.11

    - -
    -
    -
    - - -
    - - - - - - -
    -
     
    +  
    +

    Instance Method Details

    -140 -141 -142 -143 -144 -145
    -
    -
    # File 'mrblib/hash.rb', line 140
    -
    -def each_value(&block)
    -  return to_enum :each_value unless block
    -
    -  self.keys.each{|k| block.call(self[k])}
    -  self
    -end
    -
    -
    -
    -

    +
    +

    - #empty?Boolean + #<(hash) ⇒ Object @@ -3616,98 +1110,30 @@

    -

    Returns true if hsh contains no key-value pairs.

    - -

    {}.empty? #=> true

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Boolean) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -1184
    -1185
    -1186
    -1187
    -1188
    -
    -
    # File 'src/hash.c', line 1184
    -
    -static mrb_value
    -mrb_hash_empty_m(mrb_state *mrb, mrb_value self)
    -{
    -  return mrb_bool_value(mrb_hash_empty_p(mrb, self));
    -}
    -
    -
    -
    -

    - - #eql?(hash) ⇒ Boolean - +

    call-seq: hash < other -> true or false

    - - - -

    -
    -

    Returns true if hash and other are -both hashes with the same content compared by eql?.

    +

    Returns true if hash is subset of other.

    -

    ISO 15.2.13.4.32 (x)

    +
    h1 = {a:1, b:2}
    +h2 = {a:1, b:2, c:3}
    +h1 < h2    #=> true
    +h2 < h1    #=> false
    +h1 < h1    #=> false
    +
    -

    Returns:

    -
      +

      Raises:

      +
      • - (Boolean) + (TypeError) @@ -3715,130 +1141,29 @@

      -
    - - - - - - -
    -
    -
    -
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -
    -
    # File 'mrblib/hash.rb', line 31
    -
    -def eql?(hash)
    -  return true if self.equal?(hash)
    -  unless Hash === hash
    -    return false
    -  end
    -  return false if self.size != hash.size
    -  self.each do |k,v|
    -    return false unless hash.key?(k)
    -    return false unless self[k].eql?(hash[k])
    -  end
    -  return true
    -end
    -
    -
    - -
    -

    - - #fetch(key, none = NONE, &block) ⇒ Object - - - - - -

    -
    -

    call-seq: - hsh.fetch(key [, default] ) -> obj - hsh.fetch(key) {| key | block } -> obj

    - -

    Returns a value from the hash for the given key. If the key can’t be - found, there are several options: With no other arguments, it will - raise an KeyError exception; if default is - given, then that will be returned; if the optional code block is - specified, then that will be run and its result returned.

    - -
    h = { "a" => 100, "b" => 200 }
    -h.fetch("a")                            #=> 100
    -h.fetch("z", "go fish")                 #=> "go fish"
    -h.fetch("z") { |el| "go fish, #{el}"}   #=> "go fish, z"
    -
    - -

    The following example shows that an exception is raised if the key - is not found and a default value is not supplied.

    - -
    h = { "a" => 100, "b" => 200 }
    -h.fetch("z")
    -
    - -

    produces:

    - -
    prog.rb:2:in 'fetch': key not found (KeyError)
    - from prog.rb:2
    -
    - - -
    -
    - -
    - - + @@ -3846,9 +1171,9 @@

    -

    +

    - #fetch_values(*keys, &block) ⇒ Object + #<=(hash) ⇒ Object @@ -3856,47 +1181,60 @@

    -

    call-seq: - hsh.fetch_values(key, …) -> array - hsh.fetch_values(key, …) { |key| block } -> array

    - -

    Returns an array containing the values associated with the given keys -but also raises KeyError when one of keys can’t be found. -Also see Hash#values_at and Hash#fetch.

    + +

    call-seq: hash <= other -> true or false

    -

    h = { “cat” => “feline”, “dog” => “canine”, “cow” => “bovine” }

    +

    Returns true if hash is subset of other or equals to other.

    -

    h.fetch_values(“cow”, “cat”) #=> [“bovine”, “feline”] - h.fetch_values(“cow”, “bird”) # raises KeyError - h.fetch_values(“cow”, “bird”) { |k| k.upcase } #=> [“bovine”, “BIRD”]

    +
    h1 = {a:1, b:2}
    +h2 = {a:1, b:2, c:3}
    +h1 <= h2   #=> true
    +h2 <= h1   #=> false
    +h1 <= h1   #=> true
    +
    +

    Raises:

    + + +
    -
    -

    -
    -
    -171
    -172
    -173
    -174
    -175
    -176
    -177
    -178
    -179
    -180
    -181
    -182
    -183
    -
    -
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 171
    -
    -def fetch(key, none=NONE, &block)
    -  unless self.key?(key)
    -    if block
    -      block.call(key)
    -    elsif none != NONE
    -      none
    -    else
    -      raise KeyError, "Key not found: #{key.inspect}"
    -    end
    -  else
    -    self[key]
    -  end
    +
    +
    +303
    +304
    +305
    +306
    +307
    +308
    +
    +
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 303
    +
    +def <(hash)
    +  raise TypeError, "can't convert #{hash.class} to Hash" unless Hash === hash
    +  size < hash.size and all? {|key, val|
    +    hash.key?(key) and hash[key] == val
    +  }
     end
    @@ -3904,9 +1242,9 @@

    -

    +

    - #flatten(level = 1) ⇒ Object + #==(hash) ⇒ Object @@ -3914,20 +1252,12 @@

    -

    call-seq: - hash.flatten -> an_array - hash.flatten(level) -> an_array

    + +

    call-seq: hash == object -> true or false

    -

    Returns a new array that is a one-dimensional flattening of this - hash. That is, for every key or value that is an array, extract - its elements into the new array. Unlike Array#flatten, this - method does not flatten recursively by default. The optional - level argument determines the level of recursion to flatten.

    +

    Equality—Two hashes are equal if they each contain the same number of keys and if each key-value pair is equal to (according to Object#==) the corresponding elements in the other hash.

    -
    a =  {1=> "one", 2 => [2,"two"], 3 => "three"}
    -a.flatten    # => [1, "one", 2, [2, "two"], 3, "three"]
    -a.flatten(2) # => [1, "one", 2, 2, "two", 3, "three"]
    -
    +

    ISO 15.2.13.4.1

    @@ -3935,23 +1265,41 @@

    -
    - +

    +

     
     
    -492
    -493
    -494
    -495
    -496
    +323 +324 +325 +326 +327 +328
    -
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 492
    +      
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 323
     
    -def fetch_values(*keys, &block)
    -  keys.map do |k|
    -    self.fetch(k, &block)
    -  end
    +def <=(hash)
    +  raise TypeError, "can't convert #{hash.class} to Hash" unless Hash === hash
    +  size <= hash.size and all? {|key, val|
    +    hash.key?(key) and hash[key] == val
    +  }
     end
    @@ -3959,9 +1307,9 @@

    -

    +

    - #has_key?Boolean + #>(hash) ⇒ Object @@ -3969,20 +1317,30 @@

    -

    15.2.13.4.13

    + +

    call-seq: hash > other -> true or false

    + +

    Returns true if other is subset of hash.

    + +
    h1 = {a:1, b:2}
    +h2 = {a:1, b:2, c:3}
    +h1 > h2    #=> false
    +h2 > h1    #=> true
    +h1 > h1    #=> false
    +
    -

    Returns:

    -
      +

      Raises:

      +
      • - (Boolean) + (TypeError) @@ -3990,51 +1348,39 @@

      -
    - +
    +

     
     
    -224
    -225
    -226
    +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33
    -
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 224
    +      
    # File 'mrblib/hash.rb', line 22
     
    -def flatten(level=1)
    -  self.to_a.flatten(level)
    +def ==(hash)
    +  return true if self.equal?(hash)
    +  unless Hash === hash
    +    return false
    +  end
    +  return false if self.size != hash.size
    +  self.each do |k,v|
    +    return false unless hash.key?(k)
    +    return false unless self[k] == hash[k]
    +  end
    +  return true
     end
     
     
    -1289
    -1290
    -1291
    -1292
    -1293
    -1294
    -1295
    -1296
    -1297
    -1298
    +343 +344 +345 +346 +347 +348
    -
    # File 'src/hash.c', line 1289
    -
    -static mrb_value
    -mrb_hash_has_key(mrb_state *mrb, mrb_value hash)
    -{
    -  mrb_value key;
    -  mrb_bool key_p;
    -
    -  mrb_get_args(mrb, "o", &key);
    -  key_p = mrb_hash_key_p(mrb, hash, key);
    -  return mrb_bool_value(key_p);
    -}
    +
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 343
    +
    +def >(hash)
    +  raise TypeError, "can't convert #{hash.class} to Hash" unless Hash === hash
    +  size > hash.size and hash.all? {|key, val|
    +    key?(key) and self[key] == val
    +  }
    +end
    -

    +

    - - #has_value?(value) ⇒ Boolean - - #value?(value) ⇒ Boolean - + #>=(hash) ⇒ Object @@ -4042,71 +1388,30 @@

    -

    Returns true if the given value is present for some key -in hsh.

    - -

    h = { “a” => 100, “b” => 200 } - h.has_value?(100) #=> true - h.has_value?(999) #=> false

    - - -
    -
    -
    - -

    Overloads:

    -
      - - -
    • - #has_value?(value) ⇒ Boolean -
      -
      +

      call-seq: hash >= other -> true or false

      +

      Returns true if other is subset of hash or equals to hash.

      -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Boolean) - - - -
      • - -
      - -
      - - -
    • - - -
    • - #value?(value) ⇒ Boolean -
      -
      - +
      h1 = {a:1, b:2}
      +h2 = {a:1, b:2, c:3}
      +h1 >= h2   #=> false
      +h2 >= h1   #=> true
      +h1 >= h1   #=> true
      +
      -

      Returns:

      -
        +

        Raises:

        +
        • - (Boolean) + (TypeError) @@ -4114,59 +1419,39 @@

        -
      - - -
    • - -
    - +
    -
    -
     
     
    -1332
    -1333
    -1334
    -1335
    -1336
    -1337
    -1338
    -1339
    -1340
    -1341
    -1342
    -1343
    +363 +364 +365 +366 +367 +368
    -
    # File 'src/hash.c', line 1332
    -
    -static mrb_value
    -mrb_hash_has_value(mrb_state *mrb, mrb_value hash)
    -{
    -  mrb_value val;
    -  struct has_v_arg arg;
    -  
    -  mrb_get_args(mrb, "o", &val);
    -  arg.found = FALSE;
    -  arg.val = val;
    -  ht_foreach(mrb, RHASH_TBL(hash), hash_has_value_i, &arg);
    -  return mrb_bool_value(arg.found);
    -}
    +
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 363
    +
    +def >=(hash)
    +  raise TypeError, "can't convert #{hash.class} to Hash" unless Hash === hash
    +  size >= hash.size and hash.all? {|key, val|
    +    key?(key) and self[key] == val
    +  }
    +end

    -

    +

    - #include?Boolean + #compactObject @@ -4174,80 +1459,63 @@

    -

    15.2.13.4.15

    + +

    call-seq: hsh.compact -> new_hsh

    + +

    Returns a new hash with the nil values/key pairs removed

    + +

    h = { a: 1, b: false, c: nil } h.compact #=> { a: 1, b: false } h #=> { a: 1, b: false, c: nil }

    -

    Returns:

    -
      - -
    • - - - (Boolean) - - - -
    • - -
    -
    - +
    +
     
     
    -1289
    -1290
    -1291
    -1292
    -1293
    -1294
    -1295
    -1296
    -1297
    -1298
    +129 +130 +131 +132 +133
    -
    # File 'src/hash.c', line 1289
    -
    -static mrb_value
    -mrb_hash_has_key(mrb_state *mrb, mrb_value hash)
    -{
    -  mrb_value key;
    -  mrb_bool key_p;
    -
    -  mrb_get_args(mrb, "o", &key);
    -  key_p = mrb_hash_key_p(mrb, hash, key);
    -  return mrb_bool_value(key_p);
    -}
    +
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 129
    +
    +def compact
    +  h=self.dup
    +  h.__compact
    +  h
    +end
    -

    +

    - #inspectObject + #compact!Object - Also known as: - to_s - -

    -

    ISO 15.2.13.4.30 (x)

    + +

    call-seq: hsh.compact! -> hsh

    + +

    Removes all nil values from the hash. Returns the hash. Returns nil if the hash does not contain nil values.

    + +

    h = { a: 1, b: false, c: nil } h.compact! #=> { a: 1, b: false }

    @@ -4255,23 +1523,23 @@

    -
    - +

    + @@ -4279,9 +1547,9 @@

    -

    +

    - #invertObject + #delete(key, &block) ⇒ Object @@ -4289,15 +1557,12 @@

    -

    call-seq: - hsh.invert -> new_hash

    + +

    call-seq: hash.delete(key) -> value or nil hash.delete(key) {|key| … } -> object

    -

    Returns a new hash created by using hsh’s values as keys, and - the keys as values.

    +

    Delete the element with the key key. Return the value of the element if key was found. Return nil if nothing was found. If a block is given, call the block with the value of the element.

    -
    h = { "n" => 100, "m" => 100, "y" => 300, "d" => 200, "a" => 0 }
    -h.invert   #=> {0=>"a", 100=>"m", 200=>"d", 300=>"y"}
    -
    +

    ISO 15.2.13.4.8

    @@ -4305,27 +1570,29 @@

    -
    - +

    +

     
     
    -208
    -209
    -210
    +115 +116 +117
    -
    # File 'mrblib/hash.rb', line 208
    +      
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 115
     
    -def inspect
    -  self._inspect({})
    +def compact!
    +  self.__compact
     end
    @@ -4333,9 +1600,9 @@

    -

    +

    - #keep_if(&block) ⇒ Object + #delete_if(&block) ⇒ Object @@ -4343,52 +1610,48 @@

    -

    call-seq: - hsh.keep_if {| key, value | block } -> hsh - hsh.keep_if -> an_enumerator

    + +

    call-seq: hsh.delete_if {| key, value | block } -> hsh hsh.delete_if -> an_enumerator

    -

    Deletes every key-value pair from hsh for which block - evaluates to false.

    +

    Deletes every key-value pair from hsh for which block evaluates to true.

    If no block is given, an enumerator is returned instead.

    +
    h = { "a" => 100, "b" => 200, "c" => 300 }
    +h.delete_if {|key, value| key >= "b" }   #=> {"a"=>100}
    +
    +
    -
    - +
    +

     
     
    -239
    -240
    -241
    -242
    -243
    +67 +68 +69 +70 +71 +72
    -
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 239
    +      
    # File 'mrblib/hash.rb', line 67
     
    -def invert
    -  h = self.class.new
    -  self.each {|k, v| h[v] = k }
    -  h
    +def delete(key, &block)
    +  if block && !self.has_key?(key)
    +    return block.call(key)
    +  end
    +  self.__delete(key)
     end
     
    -
    -256
    -257
    -258
    -259
    -260
    -261
    -262
    -263
    -264
    -265
    -266
    + +191 +192 +193 +194 +195 +196 +197 +198
    -
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 256
    +      
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 191
     
    -def keep_if(&block)
    -  return to_enum :keep_if unless block
    +def delete_if(&block)
    +  return to_enum :delete_if unless block
     
    -  keys = []
       self.each do |k, v|
    -    unless block.call([k, v])
    -      self.delete(k)
    -    end
    +    self.delete(k) if block.call(k, v)
       end
       self
     end
    @@ -4398,9 +1661,9 @@

    -

    +

    - #key(val) ⇒ Object + #dig(idx, *args) ⇒ Object @@ -4408,17 +1671,10 @@

    -

    call-seq: - hsh.key(value) -> key

    - -

    Returns the key of an occurrence of a given value. If the value is - not found, returns nil.

    + +

    call-seq: hsh.dig(key,…) -> object

    -
    h = { "a" => 100, "b" => 200, "c" => 300, "d" => 300 }
    -h.key(200)   #=> "b"
    -h.key(300)   #=> "c"
    -h.key(999)   #=> nil
    -
    +

    Extracts the nested value specified by the sequence of key objects by calling dig at each step, returning nil if any intermediate step is nil.

    @@ -4426,29 +1682,33 @@

    -
    - +

    + @@ -4456,78 +1716,90 @@

    -

    +

    - #key?Boolean + #each(&block) ⇒ Object + Also known as: + each_pair + +

    -

    15.2.13.4.18

    + +

    call-seq: hsh.each {| key, value | block } -> hsh hsh.each_pair {| key, value | block } -> hsh hsh.each -> an_enumerator hsh.each_pair -> an_enumerator

    + +

    Calls the given block for each element of self and pass the key and value of each element.

    + +

    If no block is given, an enumerator is returned instead.

    + +
    h = { "a" => 100, "b" => 200 }
    +h.each {|key, value| puts "#{key} is #{value}" }
    +
    + +

    produces:

    + +

    a is 100 b is 200

    + +

    ISO 15.2.13.4.9

    -

    Returns:

    -
      - -
    • - - - (Boolean) - - - -
    • - -
    -
    - +
    +

     
     
    -281
    -282
    -283
    -284
    -285
    -286
    +378 +379 +380 +381 +382 +383 +384 +385
    -
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 281
    +      
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 378
     
    -def key(val)
    -  self.each do |k, v|
    -    return k if v == val
    +def dig(idx,*args)
    +  n = self[idx]
    +  if args.size > 0
    +    n&.dig(*args)
    +  else
    +    n
       end
    -  nil
     end
     
     
    -1289
    -1290
    -1291
    -1292
    -1293
    -1294
    -1295
    -1296
    -1297
    -1298
    +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107
    -
    # File 'src/hash.c', line 1289
    -
    -static mrb_value
    -mrb_hash_has_key(mrb_state *mrb, mrb_value hash)
    -{
    -  mrb_value key;
    -  mrb_bool key_p;
    -
    -  mrb_get_args(mrb, "o", &key);
    -  key_p = mrb_hash_key_p(mrb, hash, key);
    -  return mrb_bool_value(key_p);
    -}
    +
    # File 'mrblib/hash.rb', line 95
    +
    +def each(&block)
    +  return to_enum :each unless block
    +
    +  keys = self.keys
    +  vals = self.values
    +  len = self.size
    +  i = 0
    +  while i < len
    +    block.call [keys[i], vals[i]]
    +    i += 1
    +  end
    +  self
    +end
    -

    +

    - #keysArray + #each_key(&block) ⇒ Object @@ -4535,96 +1807,60 @@

    -

    Returns a new array populated with the keys from this hash. See also -Hash#values.

    + +

    call-seq: hsh.each_key {| key | block } -> hsh hsh.each_key -> an_enumerator

    -

    h = { “a” => 100, “b” => 200, “c” => 300, “d” => 400 } - h.keys #=> [“a”, “b”, “c”, “d”]

    +

    Calls the given block for each element of self and pass the key of each element.

    +

    If no block is given, an enumerator is returned instead.

    -
    -
    -
    - -
    -
    - +

    h = { “a” => 100, “b” => 200 } h.each_key {|key| puts key }

    + +

    produces:

    + +

    a b

    + +

    ISO 15.2.13.4.10

    -

    Returns:

    -
      - -
    • - - - (Array) - - - -
    • - -
    - -
    - - +
    -
    -
     
     
    -1210
    -1211
    -1212
    -1213
    -1214
    -1215
    -1216
    -1217
    -1218
    -1219
    -1220
    -1221
    -1222
    +128 +129 +130 +131 +132 +133
    -
    # File 'src/hash.c', line 1210
    -
    -MRB_API mrb_value
    -mrb_hash_keys(mrb_state *mrb, mrb_value hash)
    -{
    -  htable *t = RHASH_TBL(hash);
    -  mrb_int size;
    -  mrb_value ary;
    -
    -  if (!t || (size = t->size) == 0)
    -    return mrb_ary_new(mrb);
    -  ary = mrb_ary_new_capa(mrb, size);
    -  ht_foreach(mrb, t, hash_keys_i, (void*)&ary);
    -  return ary;
    -}
    +
    # File 'mrblib/hash.rb', line 128
    +
    +def each_key(&block)
    +  return to_enum :each_key unless block
    +
    +  self.keys.each{|k| block.call(k)}
    +  self
    +end
    -

    +

    - - #lengthFixnum - - #sizeFixnum - + #each_value(&block) ⇒ Object @@ -4632,119 +1868,60 @@

    -

    Returns the number of key-value pairs in the hash.

    - -

    h = { “d” => 100, “a” => 200, “v” => 300, “e” => 400 } - h.length #=> 4 - h.delete(“a”) #=> 200 - h.length #=> 3

    + +

    call-seq: hsh.each_value {| value | block } -> self hsh.each_value -> an_enumerator

    +

    Calls the given block with each value; returns self:

    -
    -
    -
    - -

    Overloads:

    -
      - - -
    • - #lengthFixnum -
      -
      - +

      If no block is given, an enumerator is returned instead.

      +

      h = { “a” => 100, “b” => 200 } h.each_value {|value| puts value }

      -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Fixnum) - - - -
      • - -
      +

      produces:

      -
      - +

      100 200

      -
    • - - -
    • - #sizeFixnum -
      -
      - +

      ISO 15.2.13.4.11

      -

      Returns:

      -
        - -
      • - - - (Fixnum) - - - -
      • - -
      - -
      - - -
    • - -
    +
    -
    -
     
     
    -1158
    -1159
    -1160
    -1161
    -1162
    -1163
    +153 +154 +155 +156 +157 +158
    -
    # File 'src/hash.c', line 1158
    -
    -static mrb_value
    -mrb_hash_size_m(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_int size = mrb_hash_size(mrb, self);
    -  return mrb_fixnum_value(size);
    -}
    +
    # File 'mrblib/hash.rb', line 153
    +
    +def each_value(&block)
    +  return to_enum :each_value unless block
    +
    +  self.values.each{|v| block.call(v)}
    +  self
    +end
    -

    +

    - #member?Boolean + #eql?(hash) ⇒ Boolean @@ -4752,7 +1929,10 @@

    -

    15.2.13.4.21

    + +

    call-seq: hash.eql? object -> true or false

    + +

    Returns true if hash and other are both hashes with the same content compared by eql?.

    @@ -4773,47 +1953,51 @@

    -

    - +
    +
     
     
    -1289
    -1290
    -1291
    -1292
    -1293
    -1294
    -1295
    -1296
    -1297
    -1298
    +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53
    -
    # File 'src/hash.c', line 1289
    -
    -static mrb_value
    -mrb_hash_has_key(mrb_state *mrb, mrb_value hash)
    -{
    -  mrb_value key;
    -  mrb_bool key_p;
    -
    -  mrb_get_args(mrb, "o", &key);
    -  key_p = mrb_hash_key_p(mrb, hash, key);
    -  return mrb_bool_value(key_p);
    -}
    +
    # File 'mrblib/hash.rb', line 42
    +
    +def eql?(hash)
    +  return true if self.equal?(hash)
    +  unless Hash === hash
    +    return false
    +  end
    +  return false if self.size != hash.size
    +  self.each do |k,v|
    +    return false unless hash.key?(k)
    +    return false unless self[k].eql?(hash[k])
    +  end
    +  return true
    +end
    -

    +

    - #merge(other, &block) ⇒ Object + #fetch(key, none = NONE, &block) ⇒ Object @@ -4821,68 +2005,72 @@

    -

    Return a hash which contains the content of -+self+ and +other+. If a block is given -it will be called for each element with -a duplicate key. The value of the block -will be the final value of this element.

    + +

    call-seq: hsh.fetch(key [, default] ) -> obj hsh.fetch(key) {| key | block } -> obj

    -

    ISO 15.2.13.4.22

    +

    Returns a value from the hash for the given key. If the key can’t be found, there are several options: With no other arguments, it will raise an KeyError exception; if default is given, then that will be returned; if the optional code block is specified, then that will be run and its result returned.

    + +
    h = { "a" => 100, "b" => 200 }
    +h.fetch("a")                            #=> 100
    +h.fetch("z", "go fish")                 #=> "go fish"
    +h.fetch("z") { |el| "go fish, #{el}"}   #=> "go fish, z"
    +
    + +

    The following example shows that an exception is raised if the key is not found and a default value is not supplied.

    + +
    h = { "a" => 100, "b" => 200 }
    +h.fetch("z")
    +
    + +

    produces:

    + +
    prog.rb:2:in 'fetch': key not found (KeyError)
    + from prog.rb:2
    +
    -
    -
    - -

    Raises:

    -
    +
    - -
    - +
    + @@ -4890,92 +2078,52 @@

    -

    +

    - #merge!(other, &block) ⇒ Object + #fetch_values(*keys, &block) ⇒ Object - Also known as: - update - -

    -

    call-seq: - hsh.merge!(other_hash) -> hsh - hsh.merge!(other_hash){|key, oldval, newval| block} -> hsh

    + +

    call-seq: hsh.fetch_values(key, …) -> array hsh.fetch_values(key, …) { |key| block } -> array

    -

    Adds the contents of other_hash to hsh. If no block is specified, - entries with duplicate keys are overwritten with the values from - other_hash, otherwise the value of each duplicate key is determined by - calling the block with the key, its value in hsh and its value in - other_hash.

    +

    Returns an array containing the values associated with the given keys but also raises KeyError when one of keys can’t be found. Also see Hash#values_at and Hash#fetch.

    -
    h1 = { "a" => 100, "b" => 200 }
    -h2 = { "b" => 254, "c" => 300 }
    -h1.merge!(h2)   #=> {"a"=>100, "b"=>254, "c"=>300}
    +

    h = { “cat” => “feline”, “dog” => “canine”, “cow” => “bovine” }

    -h1 = { "a" => 100, "b" => 200 } -h2 = { "b" => 254, "c" => 300 } -h1.merge!(h2) { |key, v1, v2| v1 } - #=> {"a"=>100, "b"=>200, "c"=>300} -
    +

    h.fetch_values(“cow”, “cat”) #=> [“bovine”, “feline”] h.fetch_values(“cow”, “bird”) # raises KeyError h.fetch_values(“cow”, “bird”) { |k| k.upcase } #=> [“bovine”, “BIRD”]

    -

    Raises:

    - -
    - +
    +

     
     
    -175
    -176
    -177
    -178
    -179
    -180
    -181
    -182
    -183
    -184
    -185
    -186
    +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175
    -
    # File 'mrblib/hash.rb', line 175
    +      
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 163
     
    -def merge(other, &block)
    -  raise TypeError, "Hash required (#{other.class} given)" unless Hash === other
    -  h = self.dup
    -  if block
    -    other.each_key{|k|
    -      h[k] = (self.has_key?(k))? block.call(k, self[k], other[k]): other[k]
    -    }
    +def fetch(key, none=NONE, &block)
    +  unless self.key?(key)
    +    if block
    +      block.call(key)
    +    elsif !NONE.equal?(none)
    +      none
    +    else
    +      raise KeyError, "Key not found: #{key.inspect}"
    +    end
       else
    -    other.each_key{|k| h[k] = other[k]}
    +    self[key]
       end
    -  h
     end
    @@ -4983,9 +2131,9 @@

    -

    +

    - #rehashHash + #flatten(level = 1) ⇒ Object @@ -4993,92 +2141,49 @@

    -

    Rebuilds the hash based on the current hash values for each key. If -values of key objects have changed since they were inserted, this -method will reindex hsh.

    - -

    keys = (1..17).map{|n| [n]} - k = keys[0] - h = {} - keys.each{|key| h[key] = key[0]} - h #=> { [1]=> 1, [2]=> 2, [3]=> 3, [4]=> 4, [5]=> 5, [6]=> 6, [7]=> 7, - [8]=> 8, [9]=> 9,[10]=>10,[11]=>11,[12]=>12,[13]=>13,[14]=>14, - [15]=>15,[16]=>16,[17]=>17} - h[k] #=> 1 - k[0] = keys.size + 1 - h #=> 1, [2]=> 2, [3]=> 3, [4]=> 4, [5]=> 5, [6]=> 6, [7]=> 7, - [8]=> 8, [9]=> 9,[10]=>10,[11]=>11,[12]=>12,[13]=>13,[14]=>14, - [15]=>15,[16]=>16,[17]=>17 - h[k] #=> nil - h.rehash - h[k] #=> 1

    + +

    call-seq: hash.flatten -> an_array hash.flatten(level) -> an_array

    +

    Returns a new array that is a one-dimensional flattening of this hash. That is, for every key or value that is an array, extract its elements into the new array. Unlike Array#flatten, this method does not flatten recursively by default. The optional level argument determines the level of recursion to flatten.

    -
    -
    -
    - -
    -
    - +
    a =  {1=> "one", 2 => [2,"two"], 3 => "three"}
    +a.flatten    # => [1, "one", 2, [2, "two"], 3, "three"]
    +a.flatten(2) # => [1, "one", 2, 2, "two", 3, "three"]
    +
    -

    Returns:

    -
      - -
    • - - - (Hash) - - - -
    • - -
    - -
    - - +
    -
    -

     
     
    -84
    -85
    -86
    -87
    -88
    -89
    -90
    -91
    -92
    -93
    -94
    +479 +480 +481 +482 +483
    -
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 84
    +      
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 479
     
    -def merge!(other, &block)
    -  raise TypeError, "Hash required (#{other.class} given)" unless Hash === other
    -  if block
    -    other.each_key{|k|
    -      self[k] = (self.has_key?(k))? block.call(k, self[k], other[k]): other[k]
    -    }
    -  else
    -    other.each_key{|k| self[k] = other[k]}
    +def fetch_values(*keys, &block)
    +  keys.map do |k|
    +    self.fetch(k, &block)
       end
    -  self
     end
     
     
    -1398
    -1399
    -1400
    -1401
    -1402
    -1403
    +216 +217 +218
    -
    # File 'src/hash.c', line 1398
    -
    -static mrb_value
    -mrb_hash_rehash(mrb_state *mrb, mrb_value self)
    -{
    -  ht_compact(mrb, RHASH_TBL(self));
    -  return self;
    -}
    +
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 216
    +
    +def flatten(level=1)
    +  self.to_a.flatten(level)
    +end
    -

    +

    - #reject(&block) ⇒ Object + #invertObject @@ -5086,59 +2191,41 @@

    -

    call-seq: - hsh.reject {|key, value| block} -> a_hash - hsh.reject -> an_enumerator

    - -

    Returns a new hash consisting of entries for which the block returns false.

    + +

    call-seq: hsh.invert -> new_hash

    -

    If no block is given, an enumerator is returned instead.

    +

    Returns a new hash created by using hsh’s values as keys, and the keys as values.

    -
    h = { "a" => 100, "b" => 200, "c" => 300 }
    -h.reject {|k,v| k < "b"}  #=> {"b" => 200, "c" => 300}
    -h.reject {|k,v| v > 100}  #=> {"a" => 100}
    +
    h = { "n" => 100, "m" => 100, "y" => 300, "d" => 200, "a" => 0 }
    +h.invert   #=> {0=>"a", 100=>"m", 200=>"d", 300=>"y"}
     
    -

    1.8/1.9 Hash#reject returns Hash; ISO says nothing.

    -
    -
    - +
    + @@ -5147,9 +2234,9 @@

    -

    +

    - #reject!(&block) ⇒ Object + #keep_if(&block) ⇒ Object @@ -5157,14 +2244,12 @@

    -

    call-seq: - hsh.reject! {| key, value | block } -> hsh or nil - hsh.reject! -> an_enumerator

    + +

    call-seq: hsh.keep_if {| key, value | block } -> hsh hsh.keep_if -> an_enumerator

    -

    Equivalent to Hash#delete_if, but returns - nil if no changes were made.

    +

    Deletes every key-value pair from hsh for which block evaluates to false.

    -

    1.8/1.9 Hash#reject! returns Hash; ISO says nothing.

    +

    If no block is given, an enumerator is returned instead.

    @@ -5172,46 +2257,36 @@

    -
    - +

    +

     
     
    -255
    -256
    -257
    -258
    -259
    -260
    -261
    -262
    -263
    -264
    -265
    +231 +232 +233 +234 +235
    -
    # File 'mrblib/hash.rb', line 255
    -
    -def reject(&block)
    -  return to_enum :reject unless block
    +      
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 231
     
    -  h = {}
    -  self.each{|k,v|
    -    unless block.call([k, v])
    -      h[k] = v
    -    end
    -  }
    +def invert
    +  h = self.class.new
    +  self.each {|k, v| h[v] = k }
       h
     end
    @@ -5220,80 +2295,56 @@

    -

    +

    - #replace(hash) ⇒ Object + #key(val) ⇒ Object - Also known as: - initialize_copy - -

    -

    Replaces the contents of hsh with the contents of other hash

    + +

    call-seq: hsh.key(value) -> key

    + +

    Returns the key of an occurrence of a given value. If the value is not found, returns nil.

    -

    ISO 15.2.13.4.23

    +
    h = { "a" => 100, "b" => 200, "c" => 300, "d" => 300 }
    +h.key(200)   #=> "b"
    +h.key(300)   #=> "c"
    +h.key(999)   #=> nil
    +
    -

    Raises:

    - -
    - +
    +

     
     
    -224
    -225
    -226
    -227
    -228
    -229
    -230
    -231
    -232
    -233
    -234
    -235
    -236
    -237
    -238
    +248 +249 +250 +251 +252 +253 +254 +255 +256 +257
    -
    # File 'mrblib/hash.rb', line 224
    +      
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 248
     
    -def reject!(&block)
    -  return to_enum :reject! unless block
    +def keep_if(&block)
    +  return to_enum :keep_if unless block
     
    -  keys = []
    -  self.each{|k,v|
    -    if block.call([k, v])
    -      keys.push(k)
    +  self.each do |k, v|
    +    unless block.call([k, v])
    +      self.delete(k)
         end
    -  }
    -  return nil if keys.size == 0
    -  keys.each{|k|
    -    self.delete(k)
    -  }
    +  end
       self
     end
    @@ -5301,34 +2352,26 @@

    -

    +

    - #select(&block) ⇒ Object + #merge(*others, &block) ⇒ Object - Also known as: - filter - -

    -

    call-seq: - hsh.select {|key, value| block} -> a_hash - hsh.select -> an_enumerator

    + +

    call-seq: hsh.merge(other_hash..) -> hsh hsh.merge(other_hash..){|key, oldval, newval| block} -> hsh

    -

    Returns a new hash consisting of entries for which the block returns true.

    +

    Returns the new Hash formed by merging each of other_hashes into a copy of self.

    -

    If no block is given, an enumerator is returned instead.

    +

    Each argument in other_hashes must be a Hash. Adds the contents of other_hash to hsh. If no block is specified, entries with duplicate keys are overwritten with the values from other_hash, otherwise the value of each duplicate key is determined by calling the block with the key, its value in hsh and its value in other_hash.

    -
    h = { "a" => 100, "b" => 200, "c" => 300 }
    -h.select {|k,v| k > "a"}  #=> {"b" => 200, "c" => 300}
    -h.select {|k,v| v < 200}  #=> {"a" => 100}
    -
    +

    Example: h = 0, bar: 1, baz: 2 h1 = 3, bar: 4 h2 = 5, bat:6 h3 = h.merge(h1, h2) { |key, old_value, new_value| old_value + new_value } h3 # => :bar=>5, :baz=>2, :bat=>9, :bam=>5

    -

    1.9 Hash#select returns Hash; ISO says nothing

    +

    ISO 15.2.13.4.22

    @@ -5336,38 +2379,44 @@

    -
    - +

    +

     
     
    -151
    -152
    -153
    -154
    -155
    -156
    -157
    -158
    -159
    -160
    -161
    -162
    -163
    +272 +273 +274 +275 +276 +277
    -
    # File 'mrblib/hash.rb', line 151
    +      
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 272
     
    -def replace(hash)
    -  raise TypeError, "Hash required (#{hash.class} given)" unless Hash === hash
    -  self.clear
    -  hash.each_key{|k|
    -    self[k] = hash[k]
    -  }
    -  if hash.default_proc
    -    self.default_proc = hash.default_proc
    -  else
    -    self.default = hash.default
    +def key(val)
    +  self.each do |k, v|
    +    return k if v == val
       end
    -  self
    +  nil
     end
    - + @@ -5376,28 +2425,34 @@

    -

    +

    - #select!(&block) ⇒ Object + #merge!(*others, &block) ⇒ Object Also known as: - filter! + update

    -

    call-seq: - hsh.select! {| key, value | block } -> hsh or nil - hsh.select! -> an_enumerator

    + +

    call-seq: hsh.merge!(other_hash..) -> hsh hsh.merge!(other_hash..){|key, oldval, newval| block} -> hsh

    -

    Equivalent to Hash#keep_if, but returns - nil if no changes were made.

    +

    Adds the contents of other_hash to hsh. If no block is specified, entries with duplicate keys are overwritten with the values from other_hash, otherwise the value of each duplicate key is determined by calling the block with the key, its value in hsh and its value in other_hash.

    -

    1.9 Hash#select! returns Hash; ISO says nothing.

    +
    h1 = { "a" => 100, "b" => 200 }
    +h2 = { "b" => 254, "c" => 300 }
    +h1.merge!(h2)   #=> {"a"=>100, "b"=>254, "c"=>300}
    +
    +h1 = { "a" => 100, "b" => 200 }
    +h2 = { "b" => 254, "c" => 300 }
    +h1.merge!(h2) { |key, v1, v2| v1 }
    +                #=> {"a"=>100, "b"=>200, "c"=>300}
    +
    @@ -5405,46 +2460,50 @@

    -
    - +

    +

     
     
    -308
    -309
    -310
    -311
    -312
    -313
    -314
    -315
    -316
    -317
    -318
    -
    -
    # File 'mrblib/hash.rb', line 308
    -
    -def select(&block)
    -  return to_enum :select unless block
    -
    -  h = {}
    -  self.each{|k,v|
    -    if block.call([k, v])
    -      h[k] = v
    -    end
    -  }
    +183
    +184
    +185
    +186
    +187
    +188
    +189
    +190
    +191
    +192
    +193
    +194
    +195
    +196
    +
    +
    # File 'mrblib/hash.rb', line 183
    +
    +def merge(*others, &block)
    +  h = self.dup
    +  return h.__merge(*others) unless block
    +  i=0; len=others.size
    +  while i<len
    +    other = others[i]
    +    i += 1
    +    raise TypeError, "Hash required (#{other.class} given)" unless Hash === other
    +    other.each_key{|k|
    +      h[k] = (self.has_key?(k))? block.call(k, self[k], other[k]): other[k]
    +    }
    +  end
       h
     end
    @@ -5453,9 +2512,9 @@

    -

    +

    - #shiftArray, Object + #reject(&block) ⇒ Object @@ -5463,123 +2522,69 @@

    -

    Removes a key-value pair from hsh and returns it as the -two-item array [ key, value ], or -the hash’s default value if the hash is empty.

    + +

    call-seq: hsh.reject {|key, value| block} -> a_hash hsh.reject -> an_enumerator

    -
    h = { 1 => "a", 2 => "b", 3 => "c" }
    -h.shift   #=> [1, "a"]
    -h         #=> {2=>"b", 3=>"c"}
    -
    +

    Returns a new hash consisting of entries for which the block returns false.

    + +

    If no block is given, an enumerator is returned instead.

    +
    h = { "a" => 100, "b" => 200, "c" => 300 }
    +h.reject {|k,v| k < "b"}  #=> {"b" => 200, "c" => 300}
    +h.reject {|k,v| v > 100}  #=> {"a" => 100}
    +
    -
    -
    -
    - -
    -
    - +

    1.8/1.9 Hash#reject returns Hash; ISO says nothing.

    -

    Returns:

    -
      - -
    • - - - (Array, Object) - - - -
    • - -
    - -
    - - +
    -
    -

     
     
    -277
    -278
    -279
    -280
    -281
    -282
    -283
    -284
    -285
    -286
    -287
    -288
    -289
    -290
    -291
    +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100
    -
    # File 'mrblib/hash.rb', line 277
    -
    -def select!(&block)
    -  return to_enum :select! unless block
    +      
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 84
     
    -  keys = []
    -  self.each{|k,v|
    -    unless block.call([k, v])
    -      keys.push(k)
    +def merge!(*others, &block)
    +  i = 0; len=others.size
    +  return self.__merge(*others) unless block
    +  while i<len
    +    other = others[i]
    +    i += 1
    +    raise TypeError, "Hash required (#{other.class} given)" unless Hash === other
    +    if block
    +      other.each_key{|k|
    +        self[k] = (self.has_key?(k))? block.call(k, self[k], other[k]): other[k]
    +      }
    +    else
    +      other.each_key{|k| self[k] = other[k]}
         end
    -  }
    -  return nil if keys.size == 0
    -  keys.each{|k|
    -    self.delete(k)
    -  }
    +  end
       self
     end
     
     
    -1055
    -1056
    -1057
    -1058
    -1059
    -1060
    -1061
    -1062
    -1063
    -1064
    -1065
    -1066
    -1067
    -1068
    -1069
    -1070
    -1071
    -1072
    -1073
    -1074
    -1075
    -1076
    -1077
    -1078
    -1079
    +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249
    -
    # File 'src/hash.c', line 1055
    -
    -static mrb_value
    -mrb_hash_shift(mrb_state *mrb, mrb_value hash)
    -{
    -  htable *t = RHASH_TBL(hash);
    +      
    # File 'mrblib/hash.rb', line 239
     
    -  mrb_hash_modify(mrb, hash);
    -  if (t && t->size > 0) {
    -    mrb_value del_key, del_val;
    -
    -    ht_shift(mrb, t, &del_key, &del_val);
    -    mrb_gc_protect(mrb, del_key);
    -    mrb_gc_protect(mrb, del_val);
    -    return mrb_assoc_new(mrb, del_key, del_val);
    -  }
    +def reject(&block)
    +  return to_enum :reject unless block
     
    -  if (MRB_RHASH_DEFAULT_P(hash)) {
    -    if (MRB_RHASH_PROCDEFAULT_P(hash)) {
    -      return mrb_funcall(mrb, RHASH_PROCDEFAULT(hash), "call", 2, hash, mrb_nil_value());
    -    }
    -    else {
    -      return RHASH_IFNONE(hash);
    -    }
    +  h = {}
    +  self.each{|k,v|
    +    unless block.call([k, v])
    +      h[k] = v
    +    end
       }
    -  return mrb_nil_value();
    -}
    + h +end
    -

    +

    - - #lengthFixnum - - #sizeFixnum - + #reject!(&block) ⇒ Object @@ -5587,252 +2592,161 @@

    -

    Returns the number of key-value pairs in the hash.

    - -

    h = { “d” => 100, “a” => 200, “v” => 300, “e” => 400 } - h.length #=> 4 - h.delete(“a”) #=> 200 - h.length #=> 3

    - - -
    -
    -
    - -

    Overloads:

    -
      - - -
    • - #lengthFixnum -
      -
      +

      call-seq: hsh.reject! {| key, value | block } -> hsh or nil hsh.reject! -> an_enumerator

      +

      Equivalent to Hash#delete_if, but returns nil if no changes were made.

      -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Fixnum) - - - -
      • - -
      - -
      - - -
    • - - -
    • - #sizeFixnum -
      -
      - +

      1.8/1.9 Hash#reject! returns Hash; ISO says nothing.

      -

      Returns:

      -
        - -
      • - - - (Fixnum) - - - -
      • - -
      - -
      - - -
    • - -
    +
    -
    -
     
     
    -1158
    -1159
    -1160
    -1161
    -1162
    -1163
    +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222
    -
    # File 'src/hash.c', line 1158
    -
    -static mrb_value
    -mrb_hash_size_m(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_int size = mrb_hash_size(mrb, self);
    -  return mrb_fixnum_value(size);
    -}
    +
    # File 'mrblib/hash.rb', line 208
    +
    +def reject!(&block)
    +  return to_enum :reject! unless block
    +
    +  keys = []
    +  self.each{|k,v|
    +    if block.call([k, v])
    +      keys.push(k)
    +    end
    +  }
    +  return nil if keys.size == 0
    +  keys.each{|k|
    +    self.delete(k)
    +  }
    +  self
    +end
    -

    +

    - #slice(*keys) ⇒ Hash + #select(&block) ⇒ Object + Also known as: + filter + +

    -

    Returns a hash containing only the given keys and their values.

    + +

    call-seq: hsh.select {|key, value| block} -> a_hash hsh.select -> an_enumerator

    -

    h = { a: 100, b: 200, c: 300 } - h.slice(:a) #=> :a=>100 - h.slice(:b, :c, :d) #=> :c=>300

    +

    Returns a new hash consisting of entries for which the block returns true.

    +

    If no block is given, an enumerator is returned instead.

    -
    -
    -
    - -
    -
    - +
    h = { "a" => 100, "b" => 200, "c" => 300 }
    +h.select {|k,v| k > "a"}  #=> {"b" => 200, "c" => 300}
    +h.select {|k,v| v < 200}  #=> {"a" => 100}
    +
    + +

    1.9 Hash#select returns Hash; ISO says nothing

    -

    Returns:

    -
      - -
    • - - - (Hash) - - - -
    • - -
    - -
    - - +
    -
    -
     
     
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
    -61
    -62
    -63
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302
    -
    # File 'mrbgems/mruby-hash-ext/src/hash-ext.c', line 49
    +      
    # File 'mrblib/hash.rb', line 292
     
    -static mrb_value
    -hash_slice(mrb_state *mrb, mrb_value hash)
    -{
    -  mrb_value *argv, result;
    -  mrb_int argc, i;
    +def select(&block)
    +  return to_enum :select unless block
     
    -  mrb_get_args(mrb, "*", &argv, &argc);
    -  if (argc == 0) {
    -    return mrb_hash_new_capa(mrb, argc);
    -  }
    -  result = mrb_hash_new_capa(mrb, argc);
    -  for (i = 0; i < argc; i++) {
    -    mrb_value key = argv[i];
    -    mrb_value val;
    -
    -    val = mrb_hash_fetch(mrb, hash, key, mrb_undef_value());
    -    if (!mrb_undef_p(val)) {
    -      mrb_hash_set(mrb, result, key, val);
    -    }
    +  h = {}
    +  self.each{|k,v|
    +    if block.call([k, v])
    +      h[k] = v
    +    end
       }
    -  return result;
    -}
    + h +end
    -

    +

    - - #[]=(key) ⇒ Object - - #store(key, value) ⇒ Object - + #select!(&block) ⇒ Object + Also known as: + filter! + +

    -

    Element Assignment—Associates the value given by -value with the key given by key. -key should not have its value changed while it is in -use as a key (a String passed as a key will be -duplicated and frozen).

    - -
    h = { "a" => 100, "b" => 200 }
    -h["a"] = 9
    -h["c"] = 4
    -h   #=> {"a"=>9, "b"=>200, "c"=>4}
    -
    + +

    call-seq: hsh.select! {| key, value | block } -> hsh or nil hsh.select! -> an_enumerator

    + +

    Equivalent to Hash#keep_if, but returns nil if no changes were made.

    + +

    1.9 Hash#select! returns Hash; ISO says nothing.

    @@ -5840,36 +2754,48 @@

    -
    - +

    +
     
     
    -1125
    -1126
    -1127
    -1128
    -1129
    -1130
    -1131
    -1132
    -1133
    +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275
    -
    # File 'src/hash.c', line 1125
    +      
    # File 'mrblib/hash.rb', line 261
     
    -static mrb_value
    -mrb_hash_aset(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value key, val;
    +def select!(&block)
    +  return to_enum :select! unless block
     
    -  mrb_get_args(mrb, "oo", &key, &val);
    -  mrb_hash_set(mrb, self, key, val);
    -  return val;
    -}
    + keys = [] + self.each{|k,v| + unless block.call([k, v]) + keys.push(k) + end + } + return nil if keys.size == 0 + keys.each{|k| + self.delete(k) + } + self +end
    @@ -5886,11 +2812,10 @@

    -

    call-seq: - hsh.to_h -> hsh or new_hash

    + +

    call-seq: hsh.to_h -> hsh or new_hash

    -

    Returns +self+. If called on a subclass of Hash, converts - the receiver to a Hash object.

    +

    Returns self. If called on a subclass of Hash, converts the receiver to a Hash object.

    @@ -5898,20 +2823,20 @@

    -
    - +

    +
     
     
    -295
    -296
    -297
    +286 +287 +288
    -
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 295
    +      
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 286
     
     def to_h
       self
    @@ -5936,12 +2861,12 @@ 

     
     
    -473
    -474
    -475
    +460 +461 +462

    -
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 473
    +      
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 460
     
     def to_proc
       ->x{self[x]}
    @@ -5962,12 +2887,10 @@ 

    -

    call-seq: - hsh.transform_keys {|key| block } -> new_hash - hsh.transform_keys -> an_enumerator

    + +

    call-seq: hsh.transform_keys {|key| block } -> new_hash hsh.transform_keys -> an_enumerator

    -

    Returns a new hash, with the keys computed from running the block -once for each key in the hash, and the values unchanged.

    +

    Returns a new hash, with the keys computed from running the block once for each key in the hash, and the values unchanged.

    If no block is given, an enumerator is returned instead.

    @@ -5977,26 +2900,26 @@

    -
    - +

    + @@ -3041,117 +741,56 @@

    -

    +

    - #readline(arg = "\n", limit = nil) ⇒ Object + #each(&block) ⇒ Object + Also known as: + each_line + + -

     
     
    -406
    -407
    -408
    -409
    -410
    -411
    -412
    -413
    -414
    +397 +398 +399 +400 +401 +402 +403 +404 +405
    -
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 406
    +      
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 397
     
     def transform_keys(&block)
       return to_enum :transform_keys unless block
    @@ -6023,12 +2946,10 @@ 

    -

    call-seq: - hsh.transform_keys! {|key| block } -> hsh - hsh.transform_keys! -> an_enumerator

    + +

    call-seq: hsh.transform_keys! {|key| block } -> hsh hsh.transform_keys! -> an_enumerator

    -

    Invokes the given block once for each key in hsh, replacing it -with the new key returned by the block, and then returns hsh.

    +

    Invokes the given block once for each key in hsh, replacing it with the new key returned by the block, and then returns hsh.

    If no block is given, an enumerator is returned instead.

    @@ -6038,36 +2959,28 @@

    -
    - +

    + @@ -6086,13 +2999,10 @@

    -

    call-seq: - hsh.transform_values {|value| block } -> new_hash - hsh.transform_values -> an_enumerator

    + +

    call-seq: hsh.transform_values {|value| block } -> new_hash hsh.transform_values -> an_enumerator

    -

    Returns a new hash with the results of running the block once for -every value. -This method does not change the keys.

    +

    Returns a new hash with the results of running the block once for every value. This method does not change the keys.

    If no block is given, an enumerator is returned instead.

    @@ -6102,25 +3012,25 @@

    -
    - +

    +
     
     
    -425
    -426
    -427
    -428
    -429
    -430
    -431
    -432
    -433
    -434
    +416 +417 +418 +419 +420 +421
    -
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 425
    +      
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 416
     
     def transform_keys!(&block)
       return to_enum :transform_keys! unless block
    -  self.keys.each do |k|
    -    value = self[k]
    -    self.__delete(k)
    -    k = block.call(k) if block
    -    self[k] = value
    -  end
    +  hash = self.transform_keys(&block)
    +  self.replace(hash)
       self
     end
    -
     
     
    -446
    -447
    -448
    -449
    -450
    -451
    -452
    -453
    +433 +434 +435 +436 +437 +438 +439 +440
    -
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 446
    +      
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 433
     
     def transform_values(&b)
       return to_enum :transform_values unless block_given?
    @@ -6146,12 +3056,10 @@ 

    -

    call-seq: - hsh.transform_values! {|key| block } -> hsh - hsh.transform_values! -> an_enumerator

    + +

    call-seq: hsh.transform_values! {|key| block } -> hsh hsh.transform_values! -> an_enumerator

    -

    Invokes the given block once for each value in the hash, replacing -with the new value returned by the block, and then returns hsh.

    +

    Invokes the given block once for each value in the hash, replacing with the new value returned by the block, and then returns hsh.

    If no block is given, an enumerator is returned instead.

    @@ -6161,24 +3069,24 @@

    -
    - +

    +
     
     
    -465
    -466
    -467
    -468
    -469
    -470
    -471
    +452 +453 +454 +455 +456 +457 +458
    -
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 465
    +      
    # File 'mrbgems/mruby-hash-ext/mrblib/hash.rb', line 452
     
     def transform_values!(&b)
       return to_enum :transform_values! unless block_given?
    @@ -6192,344 +3100,16 @@ 

    -
    -

    - - - #has_value?(value) ⇒ Boolean - - #value?(value) ⇒ Boolean - - - - - - -

    -
    -

    Returns true if the given value is present for some key -in hsh.

    - -

    h = { “a” => 100, “b” => 200 } - h.has_value?(100) #=> true - h.has_value?(999) #=> false

    - - -
    -
    -
    - -

    Overloads:

    -
      - - -
    • - #has_value?(value) ⇒ Boolean -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Boolean) - - - -
      • - -
      - -
      - - -
    • - - -
    • - #value?(value) ⇒ Boolean -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Boolean) - - - -
      • - -
      - -
      - - -
    • - -
    - - -
    - - - - - - -
    -
    -
    -
    -1332
    -1333
    -1334
    -1335
    -1336
    -1337
    -1338
    -1339
    -1340
    -1341
    -1342
    -1343
    -
    -
    # File 'src/hash.c', line 1332
    -
    -static mrb_value
    -mrb_hash_has_value(mrb_state *mrb, mrb_value hash)
    -{
    -  mrb_value val;
    -  struct has_v_arg arg;
    -  
    -  mrb_get_args(mrb, "o", &val);
    -  arg.found = FALSE;
    -  arg.val = val;
    -  ht_foreach(mrb, RHASH_TBL(hash), hash_has_value_i, &arg);
    -  return mrb_bool_value(arg.found);
    -}
    -
    -
    - -
    -

    - - #valuesArray - - - - - -

    -
    -

    Returns a new array populated with the values from hsh. See -also Hash#keys.

    - -

    h = { “a” => 100, “b” => 200, “c” => 300 } - h.values #=> [100, 200, 300]

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Array) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -1244
    -1245
    -1246
    -1247
    -1248
    -1249
    -1250
    -1251
    -1252
    -1253
    -1254
    -1255
    -1256
    -
    -
    # File 'src/hash.c', line 1244
    -
    -MRB_API mrb_value
    -mrb_hash_values(mrb_state *mrb, mrb_value hash)
    -{
    -  htable *t = RHASH_TBL(hash);
    -  mrb_int size;
    -  mrb_value ary;
    -
    -  if (!t || (size = t->size) == 0)
    -    return mrb_ary_new(mrb);
    -  ary = mrb_ary_new_capa(mrb, size);
    -  ht_foreach(mrb, t, hash_vals_i, (void*)&ary);
    -  return ary;
    -}
    -
    -
    - -
    -

    - - #values_at(key, ...) ⇒ Array - - - - - -

    -
    -

    Return an array containing the values associated with the given keys. -Also see Hash.select.

    - -

    h = { “cat” => “feline”, “dog” => “canine”, “cow” => “bovine” } - h.values_at(“cow”, “cat”) #=> [“bovine”, “feline”]

    - - -
    -
    -
    - -
    -
    - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Array) - - - -
    • - -
    - -
    - - - -
    - - - - - - -
    -
    -
    -
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -
    -
    # File 'mrbgems/mruby-hash-ext/src/hash-ext.c', line 22
    -
    -static mrb_value
    -hash_values_at(mrb_state *mrb, mrb_value hash)
    -{
    -  mrb_value *argv, result;
    -  mrb_int argc, i;
    -  int ai;
    -
    -  mrb_get_args(mrb, "*", &argv, &argc);
    -  result = mrb_ary_new_capa(mrb, argc);
    -  ai = mrb_gc_arena_save(mrb);
    -  for (i = 0; i < argc; i++) {
    -    mrb_ary_push(mrb, result, mrb_hash_get(mrb, hash, argv[i]));
    -    mrb_gc_arena_restore(mrb, ai);
    -  }
    -  return result;
    -}
    -
    - - + - - \ No newline at end of file diff --git a/docs/api/IO.html b/docs/api/IO.html index e51fbe7..5f7eb57 100644 --- a/docs/api/IO.html +++ b/docs/api/IO.html @@ -6,17 +6,17 @@ Class: IO - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -98,9 +98,7 @@
    Defined in:
    -
    mrbgems/mruby-io/src/io.c,
    - mrbgems/mruby-io/mrblib/io.rb
    -
    +
    mrbgems/mruby-io/mrblib/io.rb
    @@ -110,37 +108,6 @@

    Direct Known Subclasses

    BasicSocket, File

    - -

    - Constant Summary - collapse -

    - -
    - -
    SEEK_SET = - -
    -
    0
    - -
    SEEK_CUR = - -
    -
    1
    - -
    SEEK_END = - -
    -
    2
    - -
    BUF_SIZE = - -
    -
    4096
    - -
    - - @@ -172,8 +139,7 @@

    -
    -
    +
    @@ -195,8 +161,7 @@

    -
    -
    +
    @@ -204,7 +169,7 @@

  • - .popen(command, mode = 'r', opts = {}, &block) ⇒ Object + .popen(command, mode = 'r', **opts, &block) ⇒ Object @@ -218,8 +183,7 @@

    -
    -
    +

  • @@ -227,7 +191,7 @@

  • - .read(path, length = nil, offset = nil, opt = nil) ⇒ Object + .read(path, length = nil, offset = 0, mode: "r") ⇒ Object @@ -241,8 +205,7 @@

    -
    -
    +

  • @@ -273,8 +236,7 @@

    -
    -
    +
    @@ -282,10 +244,12 @@

  • - #_check_readable ⇒ Object + #each(&block) ⇒ Object + (also: #each_line) + @@ -297,6 +261,7 @@

    +

    15.2.20.5.3.

  • @@ -305,7 +270,7 @@

  • - #_read_buf ⇒ Object + #each_byte(&block) ⇒ Object @@ -320,6 +285,7 @@

    +

    15.2.20.5.4.

  • @@ -328,7 +294,7 @@

  • - #close ⇒ Object + #each_char(&block) ⇒ Object @@ -342,8 +308,7 @@

    -

    15.2.20.5.1.

    -
    +

  • @@ -351,7 +316,7 @@

  • - #close_on_exec= ⇒ Object + #hash ⇒ Object @@ -365,8 +330,7 @@

    -
    -
    +

  • @@ -374,7 +338,7 @@

  • - #close_on_exec? ⇒ Boolean + #pos=(i) ⇒ Object @@ -388,8 +352,7 @@

    -
    -
    +

  • @@ -397,7 +360,7 @@

  • - #close_write ⇒ Object + #print(*args) ⇒ Object @@ -411,8 +374,7 @@

    -

    15.2.20.5.1.

    -
    +

  • @@ -420,7 +382,7 @@

  • - #closed? ⇒ Boolean + #printf(*args) ⇒ Object @@ -434,8 +396,7 @@

    -

    15.2.20.5.2.

    -
    +

  • @@ -443,12 +404,10 @@

  • - #each(&block) ⇒ Object + #puts(*args) ⇒ Object - (also: #each_line) - @@ -459,8 +418,7 @@

    -

    15.2.20.5.3.

    -
    +

  • @@ -468,12 +426,10 @@

  • - #each_byte(&block) ⇒ Object + #rewind ⇒ Object - (also: #each_char) - @@ -484,8 +440,7 @@

    -

    15.2.20.5.4.

    -
    +

  • @@ -493,12 +448,10 @@

  • - #eof? ⇒ Boolean + #ungetbyte(c) ⇒ Object - (also: #eof) - @@ -509,2403 +462,192 @@

    -
    -
    +

  • -
  • - - - #fileno ⇒ Object - - - - (also: #to_i) - - - - - - - - + - -

    15.2.20.5.2.

    -
    - -
  • - -
  • - - - #flush ⇒ Object - + +
    +

    Class Method Details

    - - - - - - +
    +

    + .open(*args, &block) ⇒ Object -
    -
    + -

  • +

    + + + + +
    +
     
    -      
    -        
  • - - - #getc ⇒ Object - +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23
  • +
    +
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 10
    +
    +def self.open(*args, &block)
    +  io = self.new(*args)
    +
    +  return io unless block
    +
    +  begin
    +    yield io
    +  ensure
    +    begin
    +      io.close unless io.closed?
    +    rescue StandardError
    +    end
    +  end
    +end
    +
    + - - - - - - +
    +

    + .pipe(&block) ⇒ Object -
    -
    + - +

    + + + + +
    +
     
    -      
    -        
  • - - - #gets(*args) ⇒ Object - +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58
  • +
    +
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 43
    +
    +def self.pipe(&block)
    +  if !self.respond_to?(:_pipe)
    +    raise NotImplementedError, "pipe is not supported on this platform"
    +  end
    +  if block
    +    begin
    +      r, w = IO._pipe
    +      yield r, w
    +    ensure
    +      r.close unless r.closed?
    +      w.close unless w.closed?
    +    end
    +  else
    +    IO._pipe
    +  end
    +end
    +
    +
    - - - - - - +
    +

    + .popen(command, mode = 'r', **opts, &block) ⇒ Object -
    -
    + - +

    + + + + +
    +
     
    -      
    -        
  • - - - #hash ⇒ Object - +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41
  • +
    +
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 25
    +
    +def self.popen(command, mode = 'r', **opts, &block)
    +  if !self.respond_to?(:_popen)
    +    raise NotImplementedError, "popen is not supported on this platform"
    +  end
    +  io = self._popen(command, mode, **opts)
    +  return io unless block
    +
    +  begin
    +    yield io
    +  ensure
    +    begin
    +      io.close unless io.closed?
    +    rescue IOError
    +      # nothing
    +    end
    +  end
    +end
    +
    +
    - - - - - +
    +

    + .read(path, length = nil, offset = 0, mode: "r") ⇒ Object - - - -
    -
    - - - - -
  • - - - #initialize ⇒ Object - - - - - - - constructor - - - - - - - - -

    15.2.20.5.21 (x).

    -
    - -
  • - - -
  • - - - #initialize_copy ⇒ Object - - - - - - - - - - - - - -

    15.2.20.5.21 (x).

    -
    - -
  • - - -
  • - - - #isatty ⇒ Object - - - - (also: #tty?) - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #pid ⇒ Object - - - - - - - - - - - - - -

    15.2.20.5.2.

    -
    - -
  • - - -
  • - - - #pos ⇒ Object - - - - (also: #tell) - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #pos=(i) ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #print(*args) ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #printf(*args) ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #puts(*args) ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #read(length = nil, outbuf = "") ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #readchar ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #readline(arg = "\n", limit = nil) ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #readlines ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #rewind ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #seek(i, whence = SEEK_SET) ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #sync ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #sync= ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #sysread ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #sysseek ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #syswrite ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #ungetc(substr) ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - -
  • - - - #write(string) ⇒ Object - - - - - - - - - - - - - -
    -
    - -
  • - - - - - -
    -

    Constructor Details

    - -
    -

    - - #initializeObject - - - - - -

    -
    -

    15.2.20.5.21 (x)

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -612
    -613
    -614
    -615
    -616
    -617
    -618
    -619
    -620
    -621
    -622
    -623
    -624
    -625
    -626
    -627
    -628
    -629
    -630
    -631
    -632
    -633
    -634
    -635
    -636
    -637
    -638
    -639
    -640
    -641
    -642
    -643
    -644
    -645
    -646
    -647
    -648
    -649
    -
    -
    # File 'mrbgems/mruby-io/src/io.c', line 612
    -
    -mrb_value
    -mrb_io_initialize(mrb_state *mrb, mrb_value io)
    -{
    -  struct mrb_io *fptr;
    -  mrb_int fd;
    -  mrb_value mode, opt;
    -  int flags;
    -
    -  mode = opt = mrb_nil_value();
    -
    -  mrb_get_args(mrb, "i|So", &fd, &mode, &opt);
    -  if (mrb_nil_p(mode)) {
    -    mode = mrb_str_new_cstr(mrb, "r");
    -  }
    -  if (mrb_nil_p(opt)) {
    -    opt = mrb_hash_new(mrb);
    -  }
    -
    -  flags = mrb_io_modestr_to_flags(mrb, RSTRING_CSTR(mrb, mode));
    -
    -  mrb_iv_set(mrb, io, mrb_intern_cstr(mrb, "@buf"), mrb_str_new_cstr(mrb, ""));
    -
    -  fptr = (struct mrb_io *)DATA_PTR(io);
    -  if (fptr != NULL) {
    -    fptr_finalize(mrb, fptr, TRUE);
    -    mrb_free(mrb, fptr);
    -  }
    -  fptr = mrb_io_alloc(mrb);
    -
    -  DATA_TYPE(io) = &mrb_io_type;
    -  DATA_PTR(io) = fptr;
    -
    -  fptr->fd = (int)fd;
    -  fptr->readable = ((flags & FMODE_READABLE) != 0);
    -  fptr->writable = ((flags & FMODE_WRITABLE) != 0);
    -  fptr->sync = 0;
    -  return io;
    -}
    -
    -
    - -
    - - -
    -

    Class Method Details

    - - -
    -

    - - .open(*args, &block) ⇒ Object - - - - - -

    - - - - -
    -
    -
    -
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -
    -
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 14
    -
    -def self.open(*args, &block)
    -  io = self.new(*args)
    -
    -  return io unless block
    -
    -  begin
    -    yield io
    -  ensure
    -    begin
    -      io.close unless io.closed?
    -    rescue StandardError
    -    end
    -  end
    -end
    -
    -
    - -
    -

    - - .pipe(&block) ⇒ Object - - - - - -

    - - - - -
    -
    -
    -
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
    -61
    -62
    -
    -
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 47
    -
    -def self.pipe(&block)
    -  if !self.respond_to?(:_pipe)
    -    raise NotImplementedError, "pipe is not supported on this platform"
    -  end
    -  if block
    -    begin
    -      r, w = IO._pipe
    -      yield r, w
    -    ensure
    -      r.close unless r.closed?
    -      w.close unless w.closed?
    -    end
    -  else
    -    IO._pipe
    -  end
    -end
    -
    -
    - -
    -

    - - .popen(command, mode = 'r', opts = {}, &block) ⇒ Object - - - - - -

    - - - - -
    -
    -
    -
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -
    -
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 29
    -
    -def self.popen(command, mode = 'r', opts={}, &block)
    -  if !self.respond_to?(:_popen)
    -    raise NotImplementedError, "popen is not supported on this platform"
    -  end
    -  io = self._popen(command, mode, opts)
    -  return io unless block
    -
    -  begin
    -    yield io
    -  ensure
    -    begin
    -      io.close unless io.closed?
    -    rescue IOError
    -      # nothing
    -    end
    -  end
    -end
    -
    -
    - -
    -

    - - .read(path, length = nil, offset = nil, opt = nil) ⇒ Object - - - - - -

    - - - - -
    -
    -
    -
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -90
    -91
    -92
    -93
    -94
    -95
    -96
    -97
    -98
    -99
    -100
    -101
    -102
    -103
    -104
    -105
    -106
    -107
    -108
    -109
    -110
    -
    -
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 64
    -
    -def self.read(path, length=nil, offset=nil, opt=nil)
    -  if not opt.nil?        # 4 arguments
    -    offset ||= 0
    -  elsif not offset.nil?  # 3 arguments
    -    if offset.is_a? Hash
    -      opt = offset
    -      offset = 0
    -    else
    -      opt = {}
    -    end
    -  elsif not length.nil?  # 2 arguments
    -    if length.is_a? Hash
    -      opt = length
    -      offset = 0
    -      length = nil
    -    else
    -      offset = 0
    -      opt = {}
    -    end
    -  else                   # only 1 argument
    -    opt = {}
    -    offset = 0
    -    length = nil
    -  end
    -
    -  str = ""
    -  fd = -1
    -  io = nil
    -  begin
    -    if path[0] == "|"
    -      io = IO.popen(path[1..-1], (opt[:mode] || "r"))
    -    else
    -      mode = opt[:mode] || "r"
    -      fd = IO.sysopen(path, mode)
    -      io = IO.open(fd, mode)
    -    end
    -    io.seek(offset) if offset > 0
    -    str = io.read(length)
    -  ensure
    -    if io
    -      io.close
    -    elsif fd != -1
    -      IO._sysclose(fd)
    -    end
    -  end
    -  str
    -end
    -
    -
    - -
    - -
    -

    Instance Method Details

    - - -
    -

    - - #<<(str) ⇒ Object - - - - - -

    - - - - -
    -
    -
    -
    -135
    -136
    -137
    -138
    -
    -
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 135
    -
    -def <<(str)
    -  write(str)
    -  self
    -end
    -
    -
    - -
    -

    - - #_check_readableObject - - - - - -

    - - - - -
    -
    -
    -
    -714
    -715
    -716
    -717
    -718
    -719
    -720
    -721
    -722
    -
    -
    # File 'mrbgems/mruby-io/src/io.c', line 714
    -
    -mrb_value
    -mrb_io_check_readable(mrb_state *mrb, mrb_value self)
    -{
    -  struct mrb_io *fptr = io_get_open_fptr(mrb, self);
    -  if (! fptr->readable) {
    -    mrb_raise(mrb, E_IO_ERROR, "not opened for reading");
    -  }
    -  return mrb_nil_value();
    -}
    -
    -
    - -
    -

    - - #_read_bufObject - - - - - -

    - - - - -
    -
    -
    -
    -172
    -173
    -174
    -175
    -176
    -177
    -178
    -179
    -180
    -
    -
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 172
    -
    -def _read_buf
    -  return @buf if @buf && @buf.bytesize >= 4 # maximum UTF-8 character is 4 bytes
    -  @buf ||= ""
    -  begin
    -    @buf += sysread(BUF_SIZE)
    -  rescue EOFError => e
    -    raise e if @buf.empty?
    -  end
    -end
    -
    -
    - -
    -

    - - #closeObject - - - - - -

    -
    -

    15.2.20.5.1

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -926
    -927
    -928
    -929
    -930
    -931
    -932
    -933
    -
    -
    # File 'mrbgems/mruby-io/src/io.c', line 926
    -
    -mrb_value
    -mrb_io_close(mrb_state *mrb, mrb_value self)
    -{
    -  struct mrb_io *fptr;
    -  fptr = io_get_open_fptr(mrb, self);
    -  fptr_finalize(mrb, fptr, FALSE);
    -  return mrb_nil_value();
    -}
    -
    -
    - -
    -

    - - #close_on_exec=Object - - - - - -

    - - - - -
    -
    -
    -
    -1238
    -1239
    -1240
    -1241
    -1242
    -1243
    -1244
    -1245
    -1246
    -1247
    -1248
    -1249
    -1250
    -1251
    -1252
    -1253
    -1254
    -1255
    -1256
    -1257
    -1258
    -1259
    -1260
    -1261
    -1262
    -1263
    -1264
    -1265
    -1266
    -1267
    -1268
    -1269
    -1270
    -1271
    -1272
    -
    -
    # File 'mrbgems/mruby-io/src/io.c', line 1238
    -
    -mrb_value
    -mrb_io_set_close_on_exec(mrb_state *mrb, mrb_value self)
    -{
    -#if defined(F_GETFD) && defined(F_SETFD) && defined(FD_CLOEXEC)
    -  struct mrb_io *fptr;
    -  int flag, ret;
    -  mrb_bool b;
    -
    -  fptr = io_get_open_fptr(mrb, self);
    -  mrb_get_args(mrb, "b", &b);
    -  flag = b ? FD_CLOEXEC : 0;
    -
    -  if (fptr->fd2 >= 0) {
    -    if ((ret = fcntl(fptr->fd2, F_GETFD)) == -1) mrb_sys_fail(mrb, "F_GETFD failed");
    -    if ((ret & FD_CLOEXEC) != flag) {
    -      ret = (ret & ~FD_CLOEXEC) | flag;
    -      ret = fcntl(fptr->fd2, F_SETFD, ret);
    -
    -      if (ret == -1) mrb_sys_fail(mrb, "F_SETFD failed");
    -    }
    -  }
    -
    -  if ((ret = fcntl(fptr->fd, F_GETFD)) == -1) mrb_sys_fail(mrb, "F_GETFD failed");
    -  if ((ret & FD_CLOEXEC) != flag) {
    -    ret = (ret & ~FD_CLOEXEC) | flag;
    -    ret = fcntl(fptr->fd, F_SETFD, ret);
    -    if (ret == -1) mrb_sys_fail(mrb, "F_SETFD failed");
    -  }
    -
    -  return mrb_bool_value(b);
    -#else
    -  mrb_raise(mrb, E_NOTIMP_ERROR, "IO#close_on_exec= is not supported on the platform");
    -  return mrb_nil_value();
    -#endif
    -}
    -
    -
    - -
    -

    - - #close_on_exec?Boolean - - - - - -

    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Boolean) - - - -
    • - -
    - -
    - - - - - - -
    -
    -
    -
    -1214
    -1215
    -1216
    -1217
    -1218
    -1219
    -1220
    -1221
    -1222
    -1223
    -1224
    -1225
    -1226
    -1227
    -1228
    -1229
    -1230
    -1231
    -1232
    -1233
    -1234
    -1235
    -1236
    -
    -
    # File 'mrbgems/mruby-io/src/io.c', line 1214
    -
    -mrb_value
    -mrb_io_close_on_exec_p(mrb_state *mrb, mrb_value self)
    -{
    -#if defined(F_GETFD) && defined(F_SETFD) && defined(FD_CLOEXEC)
    -  struct mrb_io *fptr;
    -  int ret;
    -
    -  fptr = io_get_open_fptr(mrb, self);
    -
    -  if (fptr->fd2 >= 0) {
    -    if ((ret = fcntl(fptr->fd2, F_GETFD)) == -1) mrb_sys_fail(mrb, "F_GETFD failed");
    -    if (!(ret & FD_CLOEXEC)) return mrb_false_value();
    -  }
    -
    -  if ((ret = fcntl(fptr->fd, F_GETFD)) == -1) mrb_sys_fail(mrb, "F_GETFD failed");
    -  if (!(ret & FD_CLOEXEC)) return mrb_false_value();
    -  return mrb_true_value();
    -
    -#else
    -  mrb_raise(mrb, E_NOTIMP_ERROR, "IO#close_on_exec? is not supported on the platform");
    -  return mrb_false_value();
    -#endif
    -}
    -
    -
    - -
    -

    - - #close_writeObject - - - - - -

    -
    -

    15.2.20.5.1

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -935
    -936
    -937
    -938
    -939
    -940
    -941
    -942
    -943
    -944
    -
    -
    # File 'mrbgems/mruby-io/src/io.c', line 935
    -
    -mrb_value
    -mrb_io_close_write(mrb_state *mrb, mrb_value self)
    -{
    -  struct mrb_io *fptr;
    -  fptr = io_get_open_fptr(mrb, self);
    -  if (close((int)fptr->fd2) == -1) {
    -    mrb_sys_fail(mrb, "close");
    -  }
    -  return mrb_nil_value();
    -}
    -
    -
    - -
    -

    - - #closed?Boolean - - - - - -

    -
    -

    15.2.20.5.2

    - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Boolean) - - - -
    • - -
    - -
    - - - - - - -
    -
    -
    -
    -946
    -947
    -948
    -949
    -950
    -951
    -952
    -953
    -954
    -955
    -956
    -
    -
    # File 'mrbgems/mruby-io/src/io.c', line 946
    -
    -mrb_value
    -mrb_io_closed(mrb_state *mrb, mrb_value io)
    -{
    -  struct mrb_io *fptr;
    -  fptr = (struct mrb_io *)mrb_data_get_ptr(mrb, io, &mrb_io_type);
    -  if (fptr == NULL || fptr->fd >= 0) {
    -    return mrb_false_value();
    -  }
    -
    -  return mrb_true_value();
    -}
    -
    -
    - -
    -

    - - #each(&block) ⇒ Object - - - - Also known as: - each_line - - - - -

    -
    -

    15.2.20.5.3

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -305
    -306
    -307
    -308
    -309
    -310
    -311
    -312
    -
    -
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 305
    -
    -def each(&block)
    -  return to_enum unless block
    -
    -  while line = self.gets
    -    block.call(line)
    -  end
    -  self
    -end
    -
    -
    - -
    -

    - - #each_byte(&block) ⇒ Object - - - - Also known as: - each_char - - - - -

    -
    -

    15.2.20.5.4

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -315
    -316
    -317
    -318
    -319
    -320
    -321
    -322
    -
    -
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 315
    -
    -def each_byte(&block)
    -  return to_enum(:each_byte) unless block
    -
    -  while char = self.getc
    -    block.call(char)
    -  end
    -  self
    -end
    -
    -
    - -
    -

    - - #eof?Boolean - - - - Also known as: - eof - - - - -

    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Boolean) - - - -
    • - -
    - -
    - - - - - - -
    -
    -
    -
    -140
    -141
    -142
    -143
    -144
    -145
    -146
    -147
    -148
    -
    -
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 140
    -
    -def eof?
    -  _check_readable
    -  begin
    -    _read_buf
    -    return @buf.empty?
    -  rescue EOFError
    -    return true
    -  end
    -end
    -
    -
    - -
    -

    - - #filenoObject - - - - Also known as: - to_i - - - - -

    -
    -

    15.2.20.5.2

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -1206
    -1207
    -1208
    -1209
    -1210
    -1211
    -1212
    -
    -
    # File 'mrbgems/mruby-io/src/io.c', line 1206
    -
    -mrb_value
    -mrb_io_fileno(mrb_state *mrb, mrb_value io)
    -{
    -  struct mrb_io *fptr;
    -  fptr = io_get_open_fptr(mrb, io);
    -  return mrb_fixnum_value(fptr->fd);
    -}
    -
    -
    - -
    -

    - - #flushObject - - - - - -

    -
    - - - -
    -
    -
    - -

    Raises:

    - - -
    - - - - - - -
    -
    -
    -
    -112
    -113
    -114
    -115
    -116
    -
    -
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 112
    -
    -def flush
    -  # mruby-io always writes immediately (no output buffer).
    -  raise IOError, "closed stream" if self.closed?
    -  self
    -end
    -
    -
    - -
    -

    - - #getcObject - - - - - -

    - - - - -
    -
    -
    -
    -296
    -297
    -298
    -299
    -300
    -301
    -302
    -
    -
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 296
    -
    -def getc
    -  begin
    -    readchar
    -  rescue EOFError
    -    nil
    -  end
    -end
    -
    -
    - -
    -

    - - #gets(*args) ⇒ Object - - - - - -

    - - - - -
    -
    -
    -
    -281
    -282
    -283
    -284
    -285
    -286
    -287
    -
    -
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 281
    -
    -def gets(*args)
    -  begin
    -    readline(*args)
    -  rescue EOFError
    -    nil
    -  end
    -end
    -
    -
    - -
    -

    - - #hashObject - - - - - -

    - - - - -
    -
    -
    -
    -118
    -119
    -120
    -121
    -122
    -
    -
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 118
    -
    -def hash
    -  # We must define IO#hash here because IO includes Enumerable and
    -  # Enumerable#hash will call IO#read...
    -  self.__id__
    -end
    -
    -
    - -
    -

    - - #initialize_copyObject - - - - - -

    -
    -

    15.2.20.5.21 (x)

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -563
    -564
    -565
    -566
    -567
    -568
    -569
    -570
    -571
    -572
    -573
    -574
    -575
    -576
    -577
    -578
    -579
    -580
    -581
    -582
    -583
    -584
    -585
    -586
    -587
    -588
    -589
    -590
    -591
    -592
    -593
    -594
    -595
    -596
    -597
    -598
    -599
    -600
    -601
    -602
    -603
    -604
    -605
    -606
    -607
    -608
    -609
    -610
    -
    -
    # File 'mrbgems/mruby-io/src/io.c', line 563
    -
    -mrb_value
    -mrb_io_initialize_copy(mrb_state *mrb, mrb_value copy)
    -{
    -  mrb_value orig;
    -  mrb_value buf;
    -  struct mrb_io *fptr_copy;
    -  struct mrb_io *fptr_orig;
    -  mrb_bool failed = TRUE;
    -
    -  mrb_get_args(mrb, "o", &orig);
    -  fptr_orig = io_get_open_fptr(mrb, orig);
    -  fptr_copy = (struct mrb_io *)DATA_PTR(copy);
    -  if (fptr_orig == fptr_copy) return copy;
    -  if (fptr_copy != NULL) {
    -    fptr_finalize(mrb, fptr_copy, FALSE);
    -    mrb_free(mrb, fptr_copy);
    -  }
    -  fptr_copy = (struct mrb_io *)mrb_io_alloc(mrb);
    -
    -  DATA_TYPE(copy) = &mrb_io_type;
    -  DATA_PTR(copy) = fptr_copy;
    -
    -  buf = mrb_iv_get(mrb, orig, mrb_intern_cstr(mrb, "@buf"));
    -  mrb_iv_set(mrb, copy, mrb_intern_cstr(mrb, "@buf"), buf);
    -
    -  fptr_copy->fd = mrb_dup(mrb, fptr_orig->fd, &failed);
    -  if (failed) {
    -    mrb_sys_fail(mrb, 0);
    -  }
    -  mrb_fd_cloexec(mrb, fptr_copy->fd);
    -
    -  if (fptr_orig->fd2 != -1) {
    -    fptr_copy->fd2 = mrb_dup(mrb, fptr_orig->fd2, &failed);
    -    if (failed) {
    -      close(fptr_copy->fd);
    -      mrb_sys_fail(mrb, 0);
    -    }
    -    mrb_fd_cloexec(mrb, fptr_copy->fd2);
    -  }
    -
    -  fptr_copy->pid = fptr_orig->pid;
    -  fptr_copy->readable = fptr_orig->readable;
    -  fptr_copy->writable = fptr_orig->writable;
    -  fptr_copy->sync = fptr_orig->sync;
    -  fptr_copy->is_socket = fptr_orig->is_socket;
    -
    -  return copy;
    -}
    -
    -
    - -
    -

    - - #isattyObject - - - - Also known as: - tty? - - - - -

    - - - - -
    -
    -
    -
    -724
    -725
    -726
    -727
    -728
    -729
    -730
    -731
    -732
    -733
    -
    -
    # File 'mrbgems/mruby-io/src/io.c', line 724
    -
    -mrb_value
    -mrb_io_isatty(mrb_state *mrb, mrb_value self)
    -{
    -  struct mrb_io *fptr;
    -
    -  fptr = io_get_open_fptr(mrb, self);
    -  if (isatty(fptr->fd) == 0)
    -    return mrb_false_value();
    -  return mrb_true_value();
    -}
    -
    -
    - -
    -

    - - #pidObject - - - - - -

    -
    -

    15.2.20.5.2

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -958
    -959
    -960
    -961
    -962
    -963
    -964
    -965
    -966
    -967
    -968
    -969
    -
    -
    # File 'mrbgems/mruby-io/src/io.c', line 958
    -
    -mrb_value
    -mrb_io_pid(mrb_state *mrb, mrb_value io)
    -{
    -  struct mrb_io *fptr;
    -  fptr = io_get_open_fptr(mrb, io);
    -
    -  if (fptr->pid > 0) {
    -    return mrb_fixnum_value(fptr->pid);
    -  }
    -
    -  return mrb_nil_value();
    -}
    -
    -
    - -
    -

    - - #posObject - - - - Also known as: - tell - - - - -

    -
    - - - -
    -
    -
    - -

    Raises:

    - - -
    - - - - - - -
    -
    -
    -
    -151
    -152
    -153
    -154
    -
    -
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 151
    -
    -def pos
    -  raise IOError if closed?
    -  sysseek(0, SEEK_CUR) - @buf.bytesize
    -end
    -
    -
    - -
    -

    - - #pos=(i) ⇒ Object - - - - - -

    - - - - -
    -
    -
    -
    -157
    -158
    -159
    -
    -
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 157
    -
    -def pos=(i)
    -  seek(i, SEEK_SET)
    -end
    -
    -
    - -
    - - - - - -
    -
    -
    -
    -350
    -351
    -352
    -353
    -354
    -355
    -356
    -357
    -
    -
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 350
    -
    -def print(*args)
    -  i = 0
    -  len = args.size
    -  while i < len
    -    write args[i].to_s
    -    i += 1
    -  end
    -end
    -
    -
    - -
    -

    - - #printf(*args) ⇒ Object - - - - - -

    - - - - -
    -
    -
    -
    -359
    -360
    -361
    -362
    -
    -
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 359
    -
    -def printf(*args)
    -  write sprintf(*args)
    -  nil
    -end
    -
    -
    - -
    -

    - - #puts(*args) ⇒ Object - - - - - -

    - - - - -
    -
    -
    -
    -337
    -338
    -339
    -340
    -341
    -342
    -343
    -344
    -345
    -346
    -347
    -348
    -
    -
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 337
    -
    -def puts(*args)
    -  i = 0
    -  len = args.size
    -  while i < len
    -    s = args[i].to_s
    -    write s
    -    write "\n" if (s[-1] != "\n")
    -    i += 1
    -  end
    -  write "\n" if len == 0
    -  nil
    -end
    -
    -
    - -
    -

    - - #read(length = nil, outbuf = "") ⇒ Object - - + @@ -2915,99 +657,61 @@

     
     
    -192
    -193
    -194
    -195
    -196
    -197
    -198
    -199
    -200
    -201
    -202
    -203
    -204
    -205
    -206
    -207
    -208
    -209
    -210
    -211
    -212
    -213
    -214
    -215
    -216
    -217
    -218
    -219
    -220
    -221
    -222
    -223
    -224
    -225
    -226
    -227
    -228
    -229
    -230
    -231
    +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77

    -
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 192
    -
    -def read(length = nil, outbuf = "")
    -  unless length.nil?
    -    unless length.is_a? Fixnum
    -      raise TypeError.new "can't convert #{length.class} into Integer"
    -    end
    -    if length < 0
    -      raise ArgumentError.new "negative length: #{length} given"
    -    end
    -    if length == 0
    -      return ""   # easy case
    -    end
    -  end
    -
    -  array = []
    -  while 1
    -    begin
    -      _read_buf
    -    rescue EOFError
    -      array = nil if array.empty? and (not length.nil?) and length != 0
    -      break
    -    end
    +    
    +
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 60
     
    -    if length
    -      consume = (length <= @buf.bytesize) ? length : @buf.bytesize
    -      array.push IO._bufread(@buf, consume)
    -      length -= consume
    -      break if length == 0
    -    else
    -      array.push @buf
    -      @buf = ''
    +def self.read(path, length=nil, offset=0, mode: "r")
    +  str = ""
    +  fd = -1
    +  io = nil
    +  begin
    +    fd = IO.sysopen(path, mode)
    +    io = IO.open(fd, mode)
    +    io.seek(offset) if offset > 0
    +    str = io.read(length)
    +  ensure
    +    if io
    +      io.close
    +    elsif fd != -1
    +      IO._sysclose(fd)
         end
       end
    -
    -  if array.nil?
    -    outbuf.replace("")
    -    nil
    -  else
    -    outbuf.replace(array.join)
    -  end
    +  str
     end
    -
    -

    +

    + +
    +

    Instance Method Details

    + + +
    +

    - #readcharObject + #<<(str) ⇒ Object @@ -3019,21 +723,17 @@

     
     
    -289
    -290
    -291
    -292
    -293
    -294
    +85 +86 +87 +88

    -
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 289
    +      
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 85
     
    -def readchar
    -  _read_buf
    -  c = @buf[0]
    -  @buf[0] = ""
    -  c
    +def <<(str)
    +  write(str)
    +  self
     end
    +
    +
    + +

    15.2.20.5.3

    + + +
    +
    +
    + + +
    + +
    @@ -3159,67 +798,52 @@

    -

    +

    - #readlinesObject + #each_byte(&block) ⇒ Object -

     
     
    -233
    -234
    -235
    -236
    -237
    -238
    -239
    -240
    -241
    -242
    -243
    -244
    -245
    -246
    -247
    -248
    -249
    -250
    -251
    -252
    -253
    -254
    -255
    -256
    -257
    -258
    -259
    -260
    -261
    -262
    -263
    -264
    -265
    -266
    -267
    -268
    -269
    -270
    -271
    -272
    -273
    -274
    -275
    -276
    -277
    -278
    -279
    +113 +114 +115 +116 +117 +118 +119 +120
    -
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 233
    -
    -def readline(arg = "\n", limit = nil)
    -  case arg
    -  when String
    -    rs = arg
    -  when Fixnum
    -    rs = "\n"
    -    limit = arg
    -  else
    -    raise ArgumentError
    -  end
    -
    -  if rs.nil?
    -    return read
    -  end
    -
    -  if rs == ""
    -    rs = "\n\n"
    -  end
    +      
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 113
     
    -  array = []
    -  while 1
    -    begin
    -      _read_buf
    -    rescue EOFError
    -      array = nil if array.empty?
    -      break
    -    end
    +def each(&block)
    +  return to_enum unless block
     
    -    if limit && limit <= @buf.size
    -      array.push @buf[0, limit]
    -      @buf[0, limit] = ""
    -      break
    -    elsif idx = @buf.index(rs)
    -      len = idx + rs.size
    -      array.push @buf[0, len]
    -      @buf[0, len] = ""
    -      break
    -    else
    -      array.push @buf
    -      @buf = ''
    -    end
    +  while line = self.gets
    +    block.call(line)
       end
    -
    -  raise EOFError.new "end of file reached" if array.nil?
    -
    -  array.join
    +  self
     end
    - - - - -
    -
    -
    +
    +
    + +

    15.2.20.5.4

    -329 -330 -331 -332 -333 -334 -335
    -
    -
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 329
     
    -def readlines
    -  ary = []
    -  while (line = gets)
    -    ary << line
    -  end
    -  ary
    -end
    -
    +
    - -
    -

    - - #rewindObject +
    - +
    - -

    +
    @@ -3227,60 +851,39 @@

    -

    +

    - #seek(i, whence = SEEK_SET) ⇒ Object + #each_char(&block) ⇒ Object -

    -
    - - - -
    -
    -
    - -

    Raises:

    - - -
    - -

     
     
    -161
    -162
    -163
    +123 +124 +125 +126 +127 +128 +129 +130
    -
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 161
    +      
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 123
     
    -def rewind
    -  seek(0, SEEK_SET)
    +def each_byte(&block)
    +  return to_enum(:each_byte) unless block
    +
    +  while byte = self.getbyte
    +    block.call(byte)
    +  end
    +  self
     end
    +
    @@ -3288,9 +891,9 @@

    -

    +

    - #syncObject + #hashObject @@ -3302,33 +905,29 @@

     
     
    -1286
    -1287
    -1288
    -1289
    -1290
    -1291
    -1292
    +79 +80 +81 +82 +83

     
     
    -165
    -166
    -167
    -168
    -169
    -170
    +135 +136 +137 +138 +139 +140 +141 +142
    -
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 165
    +      
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 135
    +
    +def each_char(&block)
    +  return to_enum(:each_char) unless block
     
    -def seek(i, whence = SEEK_SET)
    -  raise IOError if closed?
    -  sysseek(i, whence)
    -  @buf = ''
    -  0
    +  while char = self.getc
    +    block.call(char)
    +  end
    +  self
     end
    -
    # File 'mrbgems/mruby-io/src/io.c', line 1286
    -
    -mrb_value
    -mrb_io_sync(mrb_state *mrb, mrb_value self)
    -{
    -  struct mrb_io *fptr;
    -  fptr = io_get_open_fptr(mrb, self);
    -  return mrb_bool_value(fptr->sync);
    -}
    +
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 79
    +
    +def hash
    +  # We must define IO#hash here because IO includes Enumerable and
    +  # Enumerable#hash will call IO#read() otherwise
    +  self.__id__
    +end
    -

    +

    - #sync=Object + #pos=(i) ⇒ Object @@ -3340,41 +939,25 @@

     
     
    -1274
    -1275
    -1276
    -1277
    -1278
    -1279
    -1280
    -1281
    -1282
    -1283
    -1284
    +93 +94 +95

    -
    # File 'mrbgems/mruby-io/src/io.c', line 1274
    -
    -mrb_value
    -mrb_io_set_sync(mrb_state *mrb, mrb_value self)
    -{
    -  struct mrb_io *fptr;
    -  mrb_bool b;
    -
    -  fptr = io_get_open_fptr(mrb, self);
    -  mrb_get_args(mrb, "b", &b);
    -  fptr->sync = b;
    -  return mrb_bool_value(b);
    -}
    +
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 93
    +
    +def pos=(i)
    +  seek(i, SEEK_SET)
    +end
    -

    +

     
     
    -818
    -819
    -820
    -821
    -822
    -823
    -824
    -825
    -826
    -827
    -828
    -829
    -830
    -831
    -832
    -833
    -834
    -835
    -836
    -837
    -838
    -839
    -840
    -841
    -842
    -843
    -844
    -845
    -846
    -847
    -848
    -849
    -850
    -851
    -852
    -853
    -854
    -855
    -856
    -857
    -858
    -859
    -860
    -861
    -862
    -863
    -864
    -865
    -866
    -867
    -868
    +165 +166 +167 +168 +169 +170 +171 +172

    -
    # File 'mrbgems/mruby-io/src/io.c', line 818
    -
    -mrb_value
    -mrb_io_sysread(mrb_state *mrb, mrb_value io)
    -{
    -  struct mrb_io *fptr;
    -  mrb_value buf = mrb_nil_value();
    -  mrb_int maxlen;
    -  int ret;
    -
    -  mrb_get_args(mrb, "i|S", &maxlen, &buf);
    -  if (maxlen < 0) {
    -    mrb_raise(mrb, E_ARGUMENT_ERROR, "negative expanding string size");
    -  }
    -  else if (maxlen == 0) {
    -    return mrb_str_new(mrb, NULL, maxlen);
    -  }
    -
    -  if (mrb_nil_p(buf)) {
    -    buf = mrb_str_new(mrb, NULL, maxlen);
    -  }
    -
    -  if (RSTRING_LEN(buf) != maxlen) {
    -    buf = mrb_str_resize(mrb, buf, maxlen);
    -  } else {
    -    mrb_str_modify(mrb, RSTRING(buf));
    -  }
    -
    -  fptr = (struct mrb_io *)io_get_open_fptr(mrb, io);
    -  if (!fptr->readable) {
    -    mrb_raise(mrb, E_IO_ERROR, "not opened for reading");
    -  }
    -  ret = read(fptr->fd, RSTRING_PTR(buf), (fsize_t)maxlen);
    -  switch (ret) {
    -    case 0: /* EOF */
    -      if (maxlen == 0) {
    -        buf = mrb_str_new_cstr(mrb, "");
    -      } else {
    -        mrb_raise(mrb, E_EOF_ERROR, "sysread failed: End of File");
    -      }
    -      break;
    -    case -1: /* Error */
    -      mrb_sys_fail(mrb, "sysread failed");
    -      break;
    -    default:
    -      if (RSTRING_LEN(buf) != ret) {
    -        buf = mrb_str_resize(mrb, buf, ret);
    -      }
    -      break;
    -  }
    -
    -  return buf;
    -}
    +
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 165
    +
    +def print(*args)
    +  i = 0
    +  len = args.size
    +  while i < len
    +    write args[i].to_s
    +    i += 1
    +  end
    +end
    -

    +

    - #sysseekObject + #printf(*args) ⇒ Object @@ -3512,73 +1009,27 @@

     
     
    -870
    -871
    -872
    -873
    -874
    -875
    -876
    -877
    -878
    -879
    -880
    -881
    -882
    -883
    -884
    -885
    -886
    -887
    -888
    -889
    -890
    -891
    -892
    -893
    -894
    -895
    -896
    +174 +175 +176 +177

    -
    # File 'mrbgems/mruby-io/src/io.c', line 870
    -
    -mrb_value
    -mrb_io_sysseek(mrb_state *mrb, mrb_value io)
    -{
    -  struct mrb_io *fptr;
    -  off_t pos;
    -  mrb_int offset, whence = -1;
    -
    -  mrb_get_args(mrb, "i|i", &offset, &whence);
    -  if (whence < 0) {
    -    whence = 0;
    -  }
    -
    -  fptr = io_get_open_fptr(mrb, io);
    -  pos = lseek(fptr->fd, (off_t)offset, (int)whence);
    -  if (pos == -1) {
    -    mrb_sys_fail(mrb, "sysseek");
    -  }
    -  if (pos > MRB_INT_MAX) {
    -#ifndef MRB_WITHOUT_FLOAT
    -    return mrb_float_value(mrb, (mrb_float)pos);
    -#else
    -    mrb_raise(mrb, E_IO_ERROR, "sysseek reached too far for MRB_WITHOUT_FLOAT");
    -#endif
    -  } else {
    -    return mrb_fixnum_value(pos);
    -  }
    -}
    +
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 174
    +
    +def printf(*args)
    +  write sprintf(*args)
    +  nil
    +end
    -

    +

    - #syswriteObject + #puts(*args) ⇒ Object @@ -3590,73 +1041,59 @@

     
     
    -898
    -899
    -900
    -901
    -902
    -903
    -904
    -905
    -906
    -907
    -908
    -909
    -910
    -911
    -912
    -913
    -914
    -915
    -916
    -917
    -918
    -919
    -920
    -921
    -922
    -923
    -924
    +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163

    -
    # File 'mrbgems/mruby-io/src/io.c', line 898
    -
    -mrb_value
    -mrb_io_syswrite(mrb_state *mrb, mrb_value io)
    -{
    -  struct mrb_io *fptr;
    -  mrb_value str, buf;
    -  int fd, length;
    -
    -  fptr = io_get_open_fptr(mrb, io);
    -  if (! fptr->writable) {
    -    mrb_raise(mrb, E_IO_ERROR, "not opened for writing");
    -  }
    -
    -  mrb_get_args(mrb, "S", &str);
    -  buf = str;
    -
    -  if (fptr->fd2 == -1) {
    -    fd = fptr->fd;
    -  } else {
    -    fd = fptr->fd2;
    -  }
    -  length = write(fd, RSTRING_PTR(buf), (fsize_t)RSTRING_LEN(buf));
    -  if (length == -1) {
    -    mrb_sys_fail(mrb, 0);
    -  }
    -
    -  return mrb_fixnum_value(length);
    -}
    +
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 144
    +
    +def puts(*args)
    +  i = 0
    +  len = args.size
    +  if len == 0
    +    write "\n"
    +    return
    +  end
    +  while i < len
    +    s = args[i]
    +    if s.kind_of?(Array)
    +      puts(*s) if s.size > 0
    +    else
    +      s = s.to_s
    +      write s
    +      write "\n" if (s[-1] != "\n")
    +    end
    +    i += 1
    +  end
    +  nil
    +end
    -

    +

    - #ungetc(substr) ⇒ Object + #rewindObject @@ -3668,27 +1105,15 @@

     
     
    -182
    -183
    -184
    -185
    -186
    -187
    -188
    -189
    -190
    +97 +98 +99

    -
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 182
    +      
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 97
     
    -def ungetc(substr)
    -  raise TypeError.new "expect String, got #{substr.class}" unless substr.is_a?(String)
    -  if @buf.empty?
    -    @buf = substr.dup
    -  else
    -    @buf = substr + @buf
    -  end
    -  nil
    +def rewind
    +  seek(0, SEEK_SET)
     end
    -
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 124
    -
    -def write(string)
    -  str = string.is_a?(String) ? string : string.to_s
    -  return 0 if str.empty?
    -  unless @buf.empty?
    -    # reset real pos ignore buf
    -    seek(pos, SEEK_SET)
    +      
    # File 'mrbgems/mruby-io/mrblib/io.rb', line 101
    +
    +def ungetbyte(c)
    +  if c.is_a? String
    +    c = c.getbyte(0)
    +  else
    +    c &= 0xff
       end
    -  len = syswrite(str)
    -  len
    +  s = " "
    +  s.setbyte(0,c)
    +  ungetc s
     end
    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 212
    +      
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 209
     
     def self.getaddress(host)
       Addrinfo.ip(host).ip_address
    @@ -328,12 +316,12 @@ 

     
     
    -216
    -217
    -218
    +213 +214 +215

    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 216
    +      
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 213
     
     def addr
       Addrinfo.new(self.getsockname)._to_array
    @@ -358,12 +346,12 @@ 

     
     
    -220
    -221
    -222
    +217 +218 +219

    -
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 220
    +      
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 217
     
     def peeraddr
       Addrinfo.new(self.getpeername)._to_array
    @@ -382,82 +370,24 @@ 

    -

    -
    -

    dummy

    - - -
    -
    -
    - - -
    - - +
     
     
    -558
    -559
    -560
    -561
    -562
    -563
    -564
    -565
    -566
    -567
    -568
    -569
    -570
    -571
    -572
    -573
    -574
    -575
    -576
    -577
    -578
    -579
    -580
    -581
    -582
    -583
    -584
    +221 +222 +223 +224
    -
    # File 'mrbgems/mruby-socket/src/socket.c', line 558
    -
    -static mrb_value
    -mrb_ipsocket_recvfrom(mrb_state *mrb, mrb_value self)
    -{
    -  struct sockaddr_storage ss;
    -  socklen_t socklen;
    -  mrb_value a, buf, pair;
    -  mrb_int flags, maxlen;
    -  ssize_t n;
    -  int fd;
    -
    -  fd = socket_fd(mrb, self);
    -  flags = 0;
    -  mrb_get_args(mrb, "i|i", &maxlen, &flags);
    -  buf = mrb_str_buf_new(mrb, maxlen);
    -  socklen = sizeof(ss);
    -  n = recvfrom(fd, RSTRING_PTR(buf), (fsize_t)maxlen, (int)flags,
    -                 (struct sockaddr *)&ss, &socklen);
    -  if (n == -1) {
    -    mrb_sys_fail(mrb, "recvfrom");
    -  }
    -  mrb_str_resize(mrb, buf, (mrb_int)n);
    -  a = sa2addrlist(mrb, (struct sockaddr *)&ss, socklen);
    -  pair = mrb_ary_new_capa(mrb, 2);
    -  mrb_ary_push(mrb, pair, buf);
    -  mrb_ary_push(mrb, pair, a);
    -  return pair;
    -}
    +
    # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 221
    +
    +def recvfrom(maxlen, flags=0)
    +  msg, sa = _recvfrom(maxlen, flags)
    +  [ msg, Addrinfo.new(sa)._to_array ]
    +end
    @@ -467,11 +397,11 @@

    - + diff --git a/docs/api/IndexError.html b/docs/api/IndexError.html index b9c9847..3b900b4 100644 --- a/docs/api/IndexError.html +++ b/docs/api/IndexError.html @@ -6,17 +6,17 @@ Exception: IndexError - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -73,14 +73,12 @@
    Inherits:
    - StandardError + StandardError
    • Object
    • - - - + @@ -109,7 +107,8 @@

      Overview

      -

      ISO 15.2.33

      + +

      ISO 15.2.33

      @@ -117,8 +116,8 @@

      Overview

      -
      - +
      +

      Direct Known Subclasses

      KeyError, StopIteration

      @@ -132,36 +131,14 @@

      Direct Known Subclasses

      - - - - - - - - - - - -

      Method Summary

      - -

      Methods inherited from Exception

      -

      #backtrace, #exception, #initialize, #inspect, #message, #set_backtrace, #to_s

      -
      -

      Constructor Details

      - -

      This class inherits a constructor from Exception

      - -
      -
      - +
      diff --git a/docs/api/Integer.html b/docs/api/Integer.html index a510cf1..1997b01 100644 --- a/docs/api/Integer.html +++ b/docs/api/Integer.html @@ -6,17 +6,17 @@ Class: Integer - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -73,13 +73,11 @@
      Inherits:
      - Numeric + Object @@ -93,11 +91,6 @@ -
      -
      Includes:
      -
      Integral
      -
      - @@ -106,7 +99,7 @@
      Defined in:
      mrblib/numeric.rb,
      - src/numeric.c
      + mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb
      @@ -114,7 +107,8 @@

      Overview

      -

      Integer

      + +

      Integer

      ISO 15.2.8

      @@ -124,11 +118,6 @@

      Overview

      -
      - -
      -

      Direct Known Subclasses

      -

      Fixnum

      @@ -137,6 +126,7 @@

      Direct Known Subclasses

      +

      Instance Method Summary @@ -148,7 +138,7 @@

    • - #ceil ⇒ Object + #allbits?(mask) ⇒ Boolean @@ -162,7 +152,8 @@

      -

      Returns the receiver simply.

      +
      +

      call-seq: int.allbits?(mask) -> true or false.

    • @@ -171,11 +162,33 @@

    • - #floor ⇒ Object + #anybits?(mask) ⇒ Boolean - (also: #round, #truncate) + + + + + + + + + + +
      +

      call-seq: int.anybits?(mask) -> true or false.

      +
      + +
    • + + +
    • + + + #ceildiv(other) ⇒ Object + + @@ -187,7 +200,8 @@

      -

      Returns the receiver simply.

      +
      +

      call-seq: ceildiv(other) -> integer.

    • @@ -196,7 +210,7 @@

    • - #to_i ⇒ Integer + #downto(num, &block) ⇒ Object @@ -210,7 +224,8 @@

      -

      As int is already an Integer, all these methods simply return the receiver.

      +
      +

      Calls the given block once for each Integer from self downto num.

    • @@ -219,10 +234,34 @@

    • - #to_i ⇒ Integer + #integer? ⇒ Boolean + + + + + + + + + + + + + +
      + +
    • + + +
    • + + + #next ⇒ Object + (also: #succ) + @@ -233,16 +272,45 @@

      -

      As int is already an Integer, all these methods simply return the receiver.

      +
      +

      Returns self + 1.

    • -

    +
  • + + + #nobits?(mask) ⇒ Boolean + + + + + + + + + + + +
    +

    call-seq: int.nobits?(mask) -> true or false.

    +
    + +
  • + +
  • + + + #step(num = nil, step = 1, &block) ⇒ Object + + + + @@ -250,21 +318,47 @@

    + + +
    +

    Calls the given block from self to num incremented by step (default 1).

    +
    -

    Methods included from Integral

    -

    #**, #/, #<, #<=, #<=>, #>, #>=, #__coerce_step_counter, #div, #downto, #next, #quo, #step, #times, #upto

    +
  • + + +
  • + + + #times(&block) ⇒ Object + + + + + +
    +

    Calls the given block self times.

    +
    -

    Methods inherited from Numeric

    -

    #+@, #-@, #abs, #finite?, #infinite?, #negative?, #nonzero?, #positive?, #to_r, #zero?

    +
  • + +
  • + + + #upto(num, &block) ⇒ Object + + + + @@ -272,9 +366,18 @@

    Methods inherited from
    +

    Calls the given block once for each Integer from self upto num.

    +
    -

    Methods included from Comparable

    -

    #<, #<=, #==, #>, #>=, #between?, #clamp

    +

  • + + + + +
    @@ -282,9 +385,9 @@

    Instance Method Details

    -

    +

    - #ceilObject + #allbits?(mask) ⇒ Boolean @@ -292,99 +395,115 @@

    -

    Returns the receiver simply.

    + +

    call-seq: int.allbits?(mask) -> true or false

    -

    ISO 15.2.8.3.14

    +

    Returns true if all bits of int & mask are 1.

    +

    Returns:

    +
      + +
    • + + + (Boolean) + + + +
    • + +
    + +
    -
    -
     
     
    -783
    -784
    -785
    -786
    -787
    +71 +72 +73
    -
    # File 'src/numeric.c', line 783
    +      
    # File 'mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb', line 71
     
    -static mrb_value
    -int_to_i(mrb_state *mrb, mrb_value num)
    -{
    -  return num;
    -}
    +def allbits?(mask) + (self & mask) == mask +end
    -

    +

    - #floorObject + #anybits?(mask) ⇒ Boolean - Also known as: - round, truncate - -

    -

    Returns the receiver simply.

    + +

    call-seq: int.anybits?(mask) -> true or false

    -

    ISO 15.2.8.3.17

    +

    Returns true if any bits of int & mask are 1.

    +

    Returns:

    +
      + +
    • + + + (Boolean) + + + +
    • + +
    + +
    -
    -
     
     
    -783
    -784
    -785
    -786
    -787
    +81 +82 +83
    -
    # File 'src/numeric.c', line 783
    +      
    # File 'mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb', line 81
     
    -static mrb_value
    -int_to_i(mrb_state *mrb, mrb_value num)
    -{
    -  return num;
    -}
    +def anybits?(mask) + (self & mask) != 0 +end
    -

    +

    - #to_iInteger + #ceildiv(other) ⇒ Object @@ -392,30 +511,129 @@

    -

    As int is already an Integer, all these -methods simply return the receiver.

    + +

    call-seq: ceildiv(other) -> integer

    + +

    Returns the result of division self by other. The result is rounded up to the nearest integer.

    + +

    3.ceildiv(3) # => 1 4.ceildiv(3) # => 2

    + +

    4.ceildiv(-3) # => -1 -4.ceildiv(3) # => -1 -4.ceildiv(-3) # => 2

    + +

    3.ceildiv(1.2) # => 3

    -
    + +
    + + + + + + +
    +
    +
    +
    +109
    +110
    +111
    +
    +
    # File 'mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb', line 109
    +
    +def ceildiv(other)
    +  -div(-other)
    +end
    +
    +
    + +
    +

    + + #downto(num, &block) ⇒ Object + + + + + +

    +

    Calls the given block once for each Integer from self downto num.

    + +

    ISO 15.2.8.3.15

    + +
    + + + + + + +
    +
    +
    +
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +
    +
    # File 'mrblib/numeric.rb', line 47
    +
    +def downto(num, &block)
    +  return to_enum(:downto, num) unless block
    +
    +  i = self.to_i
    +  while i >= num
    +    block.call(i)
    +    i -= 1
    +  end
    +  self
    +end
    +
    +
    + +
    +

    + + #integer?Boolean + + + + + +

    +
    + + +
    +
    +
    +

    Returns:

    • - (Integer) + (Boolean) @@ -423,60 +641,93 @@

    -
    - - - +
    -
    -
     
     
    -783
    -784
    -785
    -786
    -787
    +113 +114 +115
    -
    # File 'src/numeric.c', line 783
    +      
    # File 'mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb', line 113
     
    -static mrb_value
    -int_to_i(mrb_state *mrb, mrb_value num)
    -{
    -  return num;
    -}
    +def integer? + true +end
    -

    +

    - #to_iInteger + #nextObject + Also known as: + succ + +

    -

    As int is already an Integer, all these -methods simply return the receiver.

    + +

    Returns self + 1

    + +

    ISO 15.2.8.3.19

    -
    + +
    + + + + + + +
    +
    +
    +
    +62
    +63
    +64
    +
    +
    # File 'mrblib/numeric.rb', line 62
    +
    +def next
    +  self + 1
    +end
    +
    +
    + +
    +

    + + #nobits?(mask) ⇒ Boolean + + + + + +

    +

    call-seq: int.nobits?(mask) -> true or false

    + +

    Returns true if no bits of int & mask are 1.

    @@ -489,7 +740,7 @@

  • - (Integer) + (Boolean) @@ -497,33 +748,242 @@

    -

  • - +
    + + + + + +
    +
     
     
    -
    -
    +91
    +92
    +93
    +
    +
    # File 'mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb', line 91
    +
    +def nobits?(mask)
    +  (self & mask) == 0
    +end
    +
    +
    + +
    +

    + + #step(num = nil, step = 1, &block) ⇒ Object + + + + + +

    +
    + +

    Calls the given block from self to num incremented by step (default 1).

    + + +
    +
    +
    + +

    Raises:

    + + +
    + + +
     
     
    -783
    -784
    -785
    -786
    -787
    +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127
    -
    # File 'src/numeric.c', line 783
    +      
    # File 'mrblib/numeric.rb', line 103
    +
    +def step(num=nil, step=1, &block)
    +  raise ArgumentError, "step can't be 0" if step == 0
    +  return to_enum(:step, num, step) unless block
    +
    +  i = __coerce_step_counter(step)
    +  if num == self || step.infinite?
    +    block.call(i) if step > 0 && i <= (num||i) || step < 0 && i >= (num||-i)
    +  elsif num == nil
    +    while true
    +      block.call(i)
    +      i += step
    +    end
    +  elsif step > 0
    +    while i <= num
    +      block.call(i)
    +      i += step
    +    end
    +  else
    +    while i >= num
    +      block.call(i)
    +      i += step
    +    end
    +  end
    +  self
    +end
    +
    +
    + +
    +

    + + #times(&block) ⇒ Object + + + + + +

    +
    + +

    Calls the given block self times.

    + +

    ISO 15.2.8.3.22

    + + +
    +
    +
    + + +
    -static mrb_value -int_to_i(mrb_state *mrb, mrb_value num) -{ - return num; -}

    + + + + + +
    +
    +
    +
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +
    +
    # File 'mrblib/numeric.rb', line 72
    +
    +def times(&block)
    +  return to_enum :times unless block
    +
    +  i = 0
    +  while i < self
    +    block.call i
    +    i += 1
    +  end
    +  self
    +end
    +
    + + +
    +

    + + #upto(num, &block) ⇒ Object + + + + + +

    +
    + +

    Calls the given block once for each Integer from self upto num.

    + +

    ISO 15.2.8.3.27

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +95
    +96
    +97
    +
    +
    # File 'mrblib/numeric.rb', line 88
    +
    +def upto(num, &block)
    +  return to_enum(:upto, num) unless block
    +
    +  i = self.to_i
    +  while i <= num
    +    block.call(i)
    +    i += 1
    +  end
    +  self
    +end
    @@ -533,11 +993,11 @@

    - + diff --git a/docs/api/Integral.html b/docs/api/Integral.html deleted file mode 100644 index 1890d87..0000000 --- a/docs/api/Integral.html +++ /dev/null @@ -1,1592 +0,0 @@ - - - - - - - Module: Integral - - — Documentation by YARD 0.9.20 - - - - - - - - - - - - - - - - - - - - - - - -
    - - -

    Module: Integral - - - -

    -
    - - - - - - - - - -
    -
    Included in:
    -
    Integer
    -
    - - - -
    -
    Defined in:
    -
    mrblib/numeric.rb,
    - src/numeric.c
    -
    -
    - -
    - -

    Overview

    -
    -

    Integral

    - -

    mruby special - module to share methods between Floats and Integers - to make them compatible

    - - -
    -
    -
    - - -
    - - - - - - - - - -

    - Instance Method Summary - collapse -

    - - - - - - -
    -

    Instance Method Details

    - - -
    -

    - - #**(other) ⇒ Numeric - - - - - -

    -
    -

    Raises num the other power.

    - -

    2.0**3 #=> 8.0

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    - - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -90
    -91
    -92
    -93
    -94
    -95
    -96
    -97
    -98
    -99
    -100
    -101
    -102
    -103
    -104
    -105
    -106
    -107
    -108
    -109
    -110
    -111
    -112
    -113
    -
    -
    # File 'src/numeric.c', line 67
    -
    -static mrb_value
    -integral_pow(mrb_state *mrb, mrb_value x)
    -{
    -  mrb_value y;
    -#ifndef MRB_WITHOUT_FLOAT
    -  mrb_float d;
    -#endif
    -
    -  mrb_get_args(mrb, "o", &y);
    -  if (mrb_fixnum_p(x) && mrb_fixnum_p(y)) {
    -    /* try ipow() */
    -    mrb_int base = mrb_fixnum(x);
    -    mrb_int exp = mrb_fixnum(y);
    -    mrb_int result = 1;
    -
    -    if (exp < 0)
    -#ifdef MRB_WITHOUT_FLOAT
    -      return mrb_fixnum_value(0);
    -#else
    -      goto float_pow;
    -#endif
    -    for (;;) {
    -      if (exp & 1) {
    -        if (mrb_int_mul_overflow(result, base, &result)) {
    -#ifndef MRB_WITHOUT_FLOAT
    -          goto float_pow;
    -#endif
    -        }
    -      }
    -      exp >>= 1;
    -      if (exp == 0) break;
    -      if (mrb_int_mul_overflow(base, base, &base)) {
    -#ifndef MRB_WITHOUT_FLOAT
    -        goto float_pow;
    -#endif
    -      }
    -    }
    -    return mrb_fixnum_value(result);
    -  }
    -#ifdef MRB_WITHOUT_FLOAT
    -  mrb_raise(mrb, E_TYPE_ERROR, "non fixnum value");
    -#else
    - float_pow:
    -  d = pow(mrb_to_flo(mrb, x), mrb_to_flo(mrb, y));
    -  return mrb_float_value(mrb, d);
    -#endif
    -}
    -
    -
    - -
    -

    - - #quo(numeric) ⇒ Object - - - - - -

    -
    -

    Returns most exact division.

    - - -
    -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -153
    -154
    -155
    -156
    -157
    -158
    -159
    -160
    -161
    -162
    -163
    -164
    -165
    -166
    -167
    -168
    -169
    -170
    -
    -
    # File 'src/numeric.c', line 153
    -
    -static mrb_value
    -integral_div(mrb_state *mrb, mrb_value x)
    -{
    -#ifdef MRB_WITHOUT_FLOAT
    -  mrb_value y;
    -
    -  mrb_get_args(mrb, "o", &y);
    -  if (!mrb_fixnum_p(y)) {
    -    mrb_raise(mrb, E_TYPE_ERROR, "non fixnum value");
    -  }
    -  return mrb_fixnum_value(mrb_fixnum(x) / mrb_fixnum(y));
    -#else
    -  mrb_float y;
    -
    -  mrb_get_args(mrb, "f", &y);
    -  return mrb_float_value(mrb, mrb_to_flo(mrb, x) / y);
    -#endif
    -}
    -
    -
    - -
    -

    - - #<Object - - - - - -

    -
    -

    15.2.8,9.3.1

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -1503
    -1504
    -1505
    -1506
    -1507
    -1508
    -1509
    -1510
    -1511
    -1512
    -1513
    -1514
    -
    -
    # File 'src/numeric.c', line 1503
    -
    -static mrb_value
    -integral_lt(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value other;
    -  mrb_int n;
    -
    -  mrb_get_args(mrb, "o", &other);
    -  n = cmpnum(mrb, self, other);
    -  if (n == -2) cmperr(mrb, self, other);
    -  if (n < 0) return mrb_true_value();
    -  return mrb_false_value();
    -}
    -
    -
    - -
    -

    - - #<=Object - - - - - -

    - - - - -
    -
    -
    -
    -1516
    -1517
    -1518
    -1519
    -1520
    -1521
    -1522
    -1523
    -1524
    -1525
    -1526
    -1527
    -
    -
    # File 'src/numeric.c', line 1516
    -
    -static mrb_value
    -integral_le(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value other;
    -  mrb_int n;
    -
    -  mrb_get_args(mrb, "o", &other);
    -  n = cmpnum(mrb, self, other);
    -  if (n == -2) cmperr(mrb, self, other);
    -  if (n <= 0) return mrb_true_value();
    -  return mrb_false_value();
    -}
    -
    -
    - -
    -

    - - - #<=>(other.f) ⇒ -1, ... - - #<-1 - - - - - - -

    -
    -
    -

    => +1 - Comparison—Returns -1, 0, or +1 depending on whether fix is - less than, equal to, or greater than numeric. This is the - basis for the tests in Comparable.

    -
    - - -
    -
    -
    - -

    Overloads:

    -
      - - -
    • - #<=>(other.f) ⇒ -1, ... -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (-1, 0, +1) - - - -
      • - -
      - -
      - - -
    • - - -
    • - #<-1 -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (-1) - - - -
      • - -
      - -
      - - -
    • - -
    - - -
    - - - - - - -
    -
    -
    -
    -1485
    -1486
    -1487
    -1488
    -1489
    -1490
    -1491
    -1492
    -1493
    -1494
    -1495
    -
    -
    # File 'src/numeric.c', line 1485
    -
    -static mrb_value
    -integral_cmp(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value other;
    -  mrb_int n;
    -
    -  mrb_get_args(mrb, "o", &other);
    -  n = cmpnum(mrb, self, other);
    -  if (n == -2) return mrb_nil_value();
    -  return mrb_fixnum_value(n);
    -}
    -
    -
    - -
    -

    - - #>Object - - - - - -

    - - - - -
    -
    -
    -
    -1529
    -1530
    -1531
    -1532
    -1533
    -1534
    -1535
    -1536
    -1537
    -1538
    -1539
    -1540
    -
    -
    # File 'src/numeric.c', line 1529
    -
    -static mrb_value
    -integral_gt(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value other;
    -  mrb_int n;
    -
    -  mrb_get_args(mrb, "o", &other);
    -  n = cmpnum(mrb, self, other);
    -  if (n == -2) cmperr(mrb, self, other);
    -  if (n > 0) return mrb_true_value();
    -  return mrb_false_value();
    -}
    -
    -
    - -
    -

    - - #>=Object - - - - - -

    - - - - -
    -
    -
    -
    -1542
    -1543
    -1544
    -1545
    -1546
    -1547
    -1548
    -1549
    -1550
    -1551
    -1552
    -1553
    -
    -
    # File 'src/numeric.c', line 1542
    -
    -static mrb_value
    -integral_ge(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value other;
    -  mrb_int n;
    -
    -  mrb_get_args(mrb, "o", &other);
    -  n = cmpnum(mrb, self, other);
    -  if (n == -2) cmperr(mrb, self, other);
    -  if (n >= 0) return mrb_true_value();
    -  return mrb_false_value();
    -}
    -
    -
    - -
    -

    - - #__coerce_step_counterObject - - - - - -

    - - - - -
    -
    -
    -
    -172
    -173
    -174
    -175
    -176
    -177
    -178
    -179
    -180
    -181
    -182
    -183
    -184
    -185
    -186
    -
    -
    # File 'src/numeric.c', line 172
    -
    -static mrb_value
    -integral_coerce_step_counter(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value num, step;
    -
    -  mrb_get_args(mrb, "oo", &num, &step);
    -
    -#ifndef MRB_WITHOUT_FLOAT
    -  if (mrb_float_p(self) || mrb_float_p(num) || mrb_float_p(step)) {
    -    return mrb_Float(mrb, self);
    -  }
    -#endif
    -
    -  return self;
    -}
    -
    -
    - -
    -

    - - #divObject - - - - - -

    -
    -

    15.2.7.4.5 (x)

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -115
    -116
    -117
    -118
    -119
    -120
    -121
    -122
    -123
    -124
    -125
    -126
    -127
    -128
    -129
    -130
    -131
    -132
    -
    -
    # File 'src/numeric.c', line 115
    -
    -static mrb_value
    -integral_idiv(mrb_state *mrb, mrb_value x)
    -{
    -#ifdef MRB_WITHOUT_FLOAT
    -  mrb_value y;
    -
    -  mrb_get_args(mrb, "o", &y);
    -  if (!mrb_fixnum_p(y)) {
    -    mrb_raise(mrb, E_TYPE_ERROR, "non fixnum value");
    -  }
    -  return mrb_fixnum_value(mrb_fixnum(x) / mrb_fixnum(y));
    -#else
    -  mrb_float y;
    -
    -  mrb_get_args(mrb, "f", &y);
    -  return mrb_int_value(mrb, mrb_to_flo(mrb, x) / y);
    -#endif
    -}
    -
    -
    - -
    -

    - - #downto(num, &block) ⇒ Object - - - - - -

    -
    -

    Calls the given block once for each Integer -from +self+ downto +num+.

    - -

    ISO 15.2.8.3.15

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -
    -
    # File 'mrblib/numeric.rb', line 47
    -
    -def downto(num, &block)
    -  return to_enum(:downto, num) unless block
    -
    -  i = self.to_i
    -  while i >= num
    -    block.call(i)
    -    i -= 1
    -  end
    -  self
    -end
    -
    -
    - -
    -

    - - #nextObject - - - - Also known as: - succ - - - - -

    -
    -

    Returns self + 1

    - -

    ISO 15.2.8.3.19

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -62
    -63
    -64
    -
    -
    # File 'mrblib/numeric.rb', line 62
    -
    -def next
    -  self + 1
    -end
    -
    -
    - -
    -

    - - #quo(numeric) ⇒ Object - - - - - -

    -
    -

    Returns most exact division.

    - - -
    -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -153
    -154
    -155
    -156
    -157
    -158
    -159
    -160
    -161
    -162
    -163
    -164
    -165
    -166
    -167
    -168
    -169
    -170
    -
    -
    # File 'src/numeric.c', line 153
    -
    -static mrb_value
    -integral_div(mrb_state *mrb, mrb_value x)
    -{
    -#ifdef MRB_WITHOUT_FLOAT
    -  mrb_value y;
    -
    -  mrb_get_args(mrb, "o", &y);
    -  if (!mrb_fixnum_p(y)) {
    -    mrb_raise(mrb, E_TYPE_ERROR, "non fixnum value");
    -  }
    -  return mrb_fixnum_value(mrb_fixnum(x) / mrb_fixnum(y));
    -#else
    -  mrb_float y;
    -
    -  mrb_get_args(mrb, "f", &y);
    -  return mrb_float_value(mrb, mrb_to_flo(mrb, x) / y);
    -#endif
    -}
    -
    -
    - -
    -

    - - #step(num = nil, step = 1, &block) ⇒ Object - - - - - -

    -
    -

    Calls the given block from +self+ to +num+ -incremented by +step+ (default 1).

    - - -
    -
    -
    - -

    Raises:

    - - -
    - - - - - - -
    -
    -
    -
    -103
    -104
    -105
    -106
    -107
    -108
    -109
    -110
    -111
    -112
    -113
    -114
    -115
    -116
    -117
    -118
    -119
    -120
    -121
    -122
    -123
    -124
    -125
    -126
    -127
    -
    -
    # File 'mrblib/numeric.rb', line 103
    -
    -def step(num=nil, step=1, &block)
    -  raise ArgumentError, "step can't be 0" if step == 0
    -  return to_enum(:step, num, step) unless block
    -
    -  i = __coerce_step_counter(num, step)
    -  if num == self || step.infinite?
    -    block.call(i) if step > 0 && i <= (num||i) || step < 0 && i >= (num||-i)
    -  elsif num == nil
    -    while true
    -      block.call(i)
    -      i += step
    -    end
    -  elsif step > 0
    -    while i <= num
    -      block.call(i)
    -      i += step
    -    end
    -  else
    -    while i >= num
    -      block.call(i)
    -      i += step
    -    end
    -  end
    -  self
    -end
    -
    -
    - -
    -

    - - #times(&block) ⇒ Object - - - - - -

    -
    -

    Calls the given block +self+ times.

    - -

    ISO 15.2.8.3.22

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -
    -
    # File 'mrblib/numeric.rb', line 72
    -
    -def times &block
    -  return to_enum :times unless block
    -
    -  i = 0
    -  while i < self
    -    block.call i
    -    i += 1
    -  end
    -  self
    -end
    -
    -
    - -
    -

    - - #upto(num, &block) ⇒ Object - - - - - -

    -
    -

    Calls the given block once for each Integer -from +self+ upto +num+.

    - -

    ISO 15.2.8.3.27

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -88
    -89
    -90
    -91
    -92
    -93
    -94
    -95
    -96
    -97
    -
    -
    # File 'mrblib/numeric.rb', line 88
    -
    -def upto(num, &block)
    -  return to_enum(:upto, num) unless block
    -
    -  i = self.to_i
    -  while i <= num
    -    block.call(i)
    -    i += 1
    -  end
    -  self
    -end
    -
    -
    - -
    - -
    - - - -
    - - \ No newline at end of file diff --git a/docs/api/Kernel.html b/docs/api/Kernel.html index 385885d..e4c774f 100644 --- a/docs/api/Kernel.html +++ b/docs/api/Kernel.html @@ -6,17 +6,17 @@ Module: Kernel - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -83,7 +83,7 @@
    Defined in:
    mrblib/kernel.rb,
    - src/kernel.c,
    mrbgems/mruby-sprintf/src/kernel.c,
    mrbgems/mruby-io/mrblib/kernel.rb,
    mrbgems/mruby-print/mrblib/print.rb,
    mrbgems/mruby-method/mrblib/kernel.rb,
    mrbgems/mruby-object-ext/mrblib/object.rb,
    mrbgems/mruby-rational/mrblib/rational.rb,
    mrbgems/mruby-enumerator/mrblib/enumerator.rb
    + mrblib/00kernel.rb,
    mrbgems/mruby-io/mrblib/kernel.rb,
    mrbgems/mruby-object-ext/mrblib/object.rb,
    mrbgems/mruby-enumerator/mrblib/enumerator.rb
    @@ -91,6875 +91,214 @@

    Overview

    -

    Kernel

    - -

    ISO 15.3.1

    - - -
    -
    -
    - - -
    - - - - - - - - - -

    - Class Method Summary - collapse -

    - - - -

    - Instance Method Summary - collapse -

    - - - - -
    -

    Dynamic Method Handling

    -

    - This class handles dynamic methods through the method_missing method - -

    - -
    -

    - - #method_missingObject - - - - - -

    -
    -

    15.3.1.3.30

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -689
    -690
    -691
    -692
    -693
    -694
    -695
    -696
    -697
    -698
    -699
    -700
    -
    -
    # File 'src/kernel.c', line 689
    -
    -static mrb_value
    -mrb_obj_missing(mrb_state *mrb, mrb_value mod)
    -{
    -  mrb_sym name;
    -  mrb_value *a;
    -  mrb_int alen;
    -
    -  mrb_get_args(mrb, "n*!", &name, &a, &alen);
    -  mrb_method_missing(mrb, name, mod, mrb_ary_new_from_values(mrb, alen, a));
    -  /* not reached */
    -  return mrb_nil_value();
    -}
    -
    -
    - -
    - - -
    -

    Class Method Details

    - - -
    -

    - - .Array(arg) ⇒ Array - - - - - -

    -
    -

    Returns +arg+ as an Array using to_a method.

    - -

    Array(1..5) #=> [1, 2, 3, 4, 5]

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Array) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -168
    -169
    -170
    -171
    -172
    -173
    -174
    -175
    -176
    -177
    -178
    -179
    -180
    -
    -
    # File 'mrbgems/mruby-kernel-ext/src/kernel.c', line 168
    -
    -static mrb_value
    -mrb_f_array(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value arg, tmp;
    -
    -  mrb_get_args(mrb, "o", &arg);
    -  tmp = mrb_check_convert_type(mrb, arg, MRB_TT_ARRAY, "Array", "to_a");
    -  if (mrb_nil_p(tmp)) {
    -    return mrb_ary_new_from_values(mrb, 1, &arg);
    -  }
    -
    -  return tmp;
    -}
    -
    -
    - -
    -

    - - .callerObject - - - - - -

    - - - - -
    -
    -
    -
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
    -61
    -
    -
    # File 'mrbgems/mruby-kernel-ext/src/kernel.c', line 7
    -
    -static mrb_value
    -mrb_f_caller(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value bt, v, length;
    -  mrb_int bt_len, argc, lev, n;
    -
    -  bt = mrb_get_backtrace(mrb);
    -  bt_len = RARRAY_LEN(bt);
    -  argc = mrb_get_args(mrb, "|oo", &v, &length);
    -
    -  switch (argc) {
    -    case 0:
    -      lev = 1;
    -      n = bt_len - lev;
    -      break;
    -    case 1:
    -      if (mrb_range_p(v)) {
    -        mrb_int beg, len;
    -        if (mrb_range_beg_len(mrb, v, &beg, &len, bt_len, TRUE) == MRB_RANGE_OK) {
    -          lev = beg;
    -          n = len;
    -        }
    -        else {
    -          return mrb_nil_value();
    -        }
    -      }
    -      else {
    -        lev = mrb_int(mrb, v);
    -        if (lev < 0) {
    -          mrb_raisef(mrb, E_ARGUMENT_ERROR, "negative level (%v)", v);
    -        }
    -        n = bt_len - lev;
    -      }
    -      break;
    -    case 2:
    -      lev = mrb_int(mrb, v);
    -      n = mrb_int(mrb, length);
    -      if (lev < 0) {
    -        mrb_raisef(mrb, E_ARGUMENT_ERROR, "negative level (%v)", v);
    -      }
    -      if (n < 0) {
    -        mrb_raisef(mrb, E_ARGUMENT_ERROR, "negative size (%v)", length);
    -      }
    -      break;
    -    default:
    -      lev = n = 0;
    -      break;
    -  }
    -
    -  if (n == 0) {
    -    return mrb_ary_new(mrb);
    -  }
    -
    -  return mrb_funcall(mrb, bt, "[]", 2, mrb_fixnum_value(lev), mrb_fixnum_value(n));
    -}
    -
    -
    - -
    -

    - - - .raiseObject - - .raise(string) ⇒ Object - - .raise(exception[, string]) ⇒ Object - - - - - - -

    -
    -

    With no arguments, raises a RuntimeError -With a single +String+ argument, raises a -+RuntimeError+ with the string as a message. Otherwise, -the first parameter should be the name of an +Exception+ -class (or an object that returns an +Exception+ object when sent -an +exception+ message). The optional second parameter sets the -message associated with the exception, and the third parameter is an -array of callback information. Exceptions are caught by the -+rescue+ clause of begin...end blocks.

    - -

    raise “Failed to create socket” - raise ArgumentError, “No parameters”, caller

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -585
    -586
    -587
    -588
    -589
    -590
    -591
    -592
    -593
    -594
    -595
    -596
    -597
    -598
    -599
    -600
    -601
    -602
    -603
    -604
    -605
    -606
    -607
    -608
    -609
    -610
    -
    -
    # File 'src/kernel.c', line 585
    -
    -MRB_API mrb_value
    -mrb_f_raise(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value a[2], exc;
    -  mrb_int argc;
    -
    -
    -  argc = mrb_get_args(mrb, "|oo", &a[0], &a[1]);
    -  switch (argc) {
    -  case 0:
    -    mrb_raise(mrb, E_RUNTIME_ERROR, "");
    -    break;
    -  case 1:
    -    if (mrb_string_p(a[0])) {
    -      a[1] = a[0];
    -      argc = 2;
    -      a[0] = mrb_obj_value(E_RUNTIME_ERROR);
    -    }
    -    /* fall through */
    -  default:
    -    exc = mrb_make_exception(mrb, argc, a);
    -    mrb_exc_raise(mrb, exc);
    -    break;
    -  }
    -  return mrb_nil_value();            /* not reached */
    -}
    -
    -
    - -
    -

    - - .Float(arg) ⇒ Float - - - - - -

    -
    -

    Returns arg converted to a float. Numeric types are converted -directly, the rest are converted using arg.to_f.

    - -

    Float(1) #=> 1.0 - Float(123.456) #=> 123.456 - Float(“123.456”) #=> 123.456 - Float(nil) #=> TypeError

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Float) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -128
    -129
    -130
    -131
    -132
    -133
    -134
    -135
    -
    -
    # File 'mrbgems/mruby-kernel-ext/src/kernel.c', line 128
    -
    -static mrb_value
    -mrb_f_float(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value arg;
    -
    -  mrb_get_args(mrb, "o", &arg);
    -  return mrb_Float(mrb, arg);
    -}
    -
    -
    - -
    -

    - - .Hash(arg) ⇒ Hash - - - - - -

    -
    -

    Returns a Hash if arg is a Hash. -Returns an empty Hash when arg is nil -or [].

    - -
    Hash([])          #=> {}
    -Hash(nil)         #=> {}
    -Hash(key: :value) #=> {:key => :value}
    -Hash([1, 2, 3])   #=> TypeError
    -
    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Hash) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -196
    -197
    -198
    -199
    -200
    -201
    -202
    -203
    -204
    -205
    -206
    -
    -
    # File 'mrbgems/mruby-kernel-ext/src/kernel.c', line 196
    -
    -static mrb_value
    -mrb_f_hash(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value arg;
    -
    -  mrb_get_args(mrb, "o", &arg);
    -  if (mrb_nil_p(arg) || (mrb_array_p(arg) && RARRAY_LEN(arg) == 0)) {
    -    return mrb_hash_new(mrb);
    -  }
    -  return mrb_ensure_hash_type(mrb, arg);
    -}
    -
    -
    - -
    -

    - - .Integer(arg, base = 0) ⇒ Integer - - - - - -

    -
    -

    Converts arg to a Fixnum. -Numeric types are converted directly (with floating point numbers -being truncated). base (0, or between 2 and 36) is a base for -integer string representation. If arg is a String, -when base is omitted or equals to zero, radix indicators -(0, 0b, and 0x) are honored. -In any case, strings should be strictly conformed to numeric -representation. This behavior is different from that of -String#to_i. Non string values will be treated as integers. -Passing nil raises a TypeError.

    - -

    Integer(123.999) #=> 123 - Integer(“0x1a”) #=> 26 - Integer(Time.new) #=> 1204973019 - Integer(“0930”, 10) #=> 930 - Integer(“111”, 2) #=> 7 - Integer(nil) #=> TypeError

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    - - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -105
    -106
    -107
    -108
    -109
    -110
    -111
    -112
    -113
    -
    -
    # File 'mrbgems/mruby-kernel-ext/src/kernel.c', line 105
    -
    -static mrb_value
    -mrb_f_integer(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value arg;
    -  mrb_int base = 0;
    -
    -  mrb_get_args(mrb, "o|i", &arg, &base);
    -  return mrb_convert_to_integer(mrb, arg, base);
    -}
    -
    -
    - -
    -

    - - .String(arg) ⇒ String - - - - - -

    -
    -

    Returns arg as an String. -converted using to_s method.

    - -

    String(self) #=> “main” - String(self.class) #=> “Object” - String(123456) #=> “123456”

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (String) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -149
    -150
    -151
    -152
    -153
    -154
    -155
    -156
    -157
    -
    -
    # File 'mrbgems/mruby-kernel-ext/src/kernel.c', line 149
    -
    -static mrb_value
    -mrb_f_string(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value arg, tmp;
    -
    -  mrb_get_args(mrb, "o", &arg);
    -  tmp = mrb_convert_type(mrb, arg, MRB_TT_STRING, "String", "to_s");
    -  return tmp;
    -}
    -
    -
    - -
    - -
    -

    Instance Method Details

    - - -
    -

    - - #!~(y) ⇒ Object - - - - - -

    -
    -

    11.4.4 Step c)

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -38
    -39
    -40
    -
    -
    # File 'mrblib/kernel.rb', line 38
    -
    -def !~(y)
    -  !(self =~ y)
    -end
    -
    -
    - -
    -

    - - #===(other) ⇒ Boolean - - - - - -

    -
    -

    Case Equality—For class Object, effectively the same -as calling #==, but typically overridden by descendants -to provide meaningful semantics in case statements.

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Boolean) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -
    -
    # File 'src/kernel.c', line 71
    -
    -static mrb_value
    -mrb_equal_m(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value arg;
    -
    -  mrb_get_args(mrb, "o", &arg);
    -  return mrb_bool_value(mrb_equal(mrb, self, arg));
    -}
    -
    -
    - -
    -

    - - #__case_eqqObject - - - - - -

    -
    -

    internal

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -746
    -747
    -748
    -749
    -750
    -751
    -752
    -753
    -754
    -755
    -756
    -757
    -758
    -759
    -760
    -761
    -
    -
    # File 'src/kernel.c', line 746
    -
    -static mrb_value
    -mrb_obj_ceqq(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value v;
    -  mrb_int i, len;
    -  mrb_sym eqq = mrb_intern_lit(mrb, "===");
    -  mrb_value ary = mrb_ary_splat(mrb, self);
    -
    -  mrb_get_args(mrb, "o", &v);
    -  len = RARRAY_LEN(ary);
    -  for (i=0; i<len; i++) {
    -    mrb_value c = mrb_funcall_argv(mrb, mrb_ary_entry(ary, i), eqq, 1, &v);
    -    if (mrb_test(c)) return mrb_true_value();
    -  }
    -  return mrb_false_value();
    -}
    -
    -
    - -
    -

    - - #__method__Object - - - - - -

    -
    -

    Returns the name at the definition of the current method as a -Symbol. -If called outside of a method, it returns nil.

    - - -
    -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -
    -
    # File 'mrbgems/mruby-kernel-ext/src/kernel.c', line 72
    -
    -static mrb_value
    -mrb_f_method(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_callinfo *ci = mrb->c->ci;
    -  ci--;
    -  if (ci->mid)
    -    return mrb_symbol_value(ci->mid);
    -  else
    -    return mrb_nil_value();
    -}
    -
    -
    - -
    -

    - - #__printstr__Object - - - - - -

    -
    -

    15.3.1.3.34

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -
    -
    # File 'mrbgems/mruby-print/src/print.c', line 41
    -
    -mrb_value
    -mrb_printstr(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value argv;
    -
    -  mrb_get_args(mrb, "o", &argv);
    -  printstr(mrb, argv);
    -
    -  return argv;
    -}
    -
    -
    - -
    -

    - - #__to_intObject - - - - - -

    -
    -

    internal

    - - -
    -
    -
    - - -
    - - -
    - -
    -

    - - #__to_strObject - - - - - -

    -
    -

    internal

    - - -
    -
    -
    - - -
    - - -
    - -
    -

    - - #_inspect(_recur_list) ⇒ Object - - - - - -

    -
    -

    internal method for inspect

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -43
    -44
    -45
    -
    -
    # File 'mrblib/kernel.rb', line 43
    -
    -def _inspect(_recur_list)
    -  self.inspect
    -end
    -
    -
    - -
    -

    - - #`(cmd) ⇒ Object - - - - - -

    -
    -

    15.3.1.2.1 Kernel. -provided by Kernel# -15.3.1.3.3

    - - -
    -
    -
    - -

    Raises:

    - - -
    - - - - - - -
    -
    -
    -
    -10
    -11
    -12
    -
    -
    # File 'mrblib/kernel.rb', line 10
    -
    -def `(s)
    -  raise NotImplementedError.new("backquotes not implemented")
    -end
    -
    -
    - -
    -

    - - - #block_given?Boolean - - #iterator?Boolean - - - - - - -

    -
    -

    Returns true if yield would execute a -block in the current context. The iterator? form -is mildly deprecated.

    - -

    def try - if block_given? - yield - else - “no block” - end - end - try #=> “no block” - try { “hello” } #=> “hello” - try do “hello” end #=> “hello”

    - - -
    -
    -
    - -

    Overloads:

    -
      - - -
    • - #block_given?Boolean -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Boolean) - - - -
      • - -
      - -
      - - -
    • - - -
    • - #iterator?Boolean -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Boolean) - - - -
      • - -
      - -
      - - -
    • - -
    - - -
    - - - - - - -
    -
    -
    -
    -127
    -128
    -129
    -130
    -131
    -132
    -133
    -134
    -135
    -136
    -137
    -138
    -139
    -140
    -141
    -142
    -143
    -144
    -145
    -146
    -147
    -148
    -149
    -150
    -151
    -152
    -153
    -154
    -155
    -156
    -157
    -158
    -159
    -160
    -161
    -162
    -163
    -164
    -165
    -166
    -167
    -168
    -169
    -170
    -171
    -172
    -173
    -174
    -175
    -176
    -177
    -178
    -179
    -180
    -
    -
    # File 'src/kernel.c', line 127
    -
    -static mrb_value
    -mrb_f_block_given_p_m(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_callinfo *ci = &mrb->c->ci[-1];
    -  mrb_callinfo *cibase = mrb->c->cibase;
    -  mrb_value *bp;
    -  struct RProc *p;
    -
    -  if (ci <= cibase) {
    -    /* toplevel does not have block */
    -    return mrb_false_value();
    -  }
    -  p = ci->proc;
    -  /* search method/class/module proc */
    -  while (p) {
    -    if (MRB_PROC_SCOPE_P(p)) break;
    -    p = p->upper;
    -  }
    -  if (p == NULL) return mrb_false_value();
    -  /* search ci corresponding to proc */
    -  while (cibase < ci) {
    -    if (ci->proc == p) break;
    -    ci--;
    -  }
    -  if (ci == cibase) {
    -    return mrb_false_value();
    -  }
    -  else if (ci->env) {
    -    struct REnv *e = ci->env;
    -    int bidx;
    -
    -    /* top-level does not have block slot (always false) */
    -    if (e->stack == mrb->c->stbase)
    -      return mrb_false_value();
    -    /* use saved block arg position */
    -    bidx = MRB_ENV_BIDX(e);
    -    /* bidx may be useless (e.g. define_method) */
    -    if (bidx >= MRB_ENV_STACK_LEN(e))
    -      return mrb_false_value();
    -    bp = &e->stack[bidx];
    -  }
    -  else {
    -    bp = ci[1].stackent+1;
    -    if (ci->argc >= 0) {
    -      bp += ci->argc;
    -    }
    -    else {
    -      bp++;
    -    }
    -  }
    -  if (mrb_nil_p(*bp))
    -    return mrb_false_value();
    -  return mrb_true_value();
    -}
    -
    -
    - -
    -

    - - #classClass - - - - - -

    -
    -

    Returns the class of obj. This method must always be -called with an explicit receiver, as class is also a -reserved word in Ruby.

    - -

    1.class #=> Fixnum - self.class #=> Object

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Class) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -194
    -195
    -196
    -197
    -198
    -
    -
    # File 'src/kernel.c', line 194
    -
    -static mrb_value
    -mrb_obj_class_m(mrb_state *mrb, mrb_value self)
    -{
    -  return mrb_obj_value(mrb_obj_class(mrb, self));
    -}
    -
    -
    - -
    -

    - - #cloneObject - - - - - -

    -
    -

    Produces a shallow copy of obj—the instance variables of -obj are copied, but not the objects they reference. Copies -the frozen state of obj. See also the discussion -under Object#dup.

    - -

    class Klass - attr_accessor :str - end - s1 = Klass.new #=> # - s1.str = "Hello" #=> "Hello" - s2 = s1.clone #=> #<Klass:0x401b3998 @str="Hello"> - s2.str[1,4] = "i" #=> "i" - s1.inspect #=> "#<Klass:0x401b3a38 @str=\"Hi\">" - s2.inspect #=> "#<Klass:0x401b3998 @str=\"Hi\">"

    - -

    This method may have class-specific behavior. If so, that -behavior will be documented under the #+initialize_copy+ method of -the class.

    - -

    Some Class(True False Nil Symbol Fixnum Float) Object cannot clone.

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Object) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -321
    -322
    -323
    -324
    -325
    -326
    -327
    -328
    -329
    -330
    -331
    -332
    -333
    -334
    -335
    -336
    -337
    -338
    -339
    -340
    -341
    -
    -
    # File 'src/kernel.c', line 321
    -
    -MRB_API mrb_value
    -mrb_obj_clone(mrb_state *mrb, mrb_value self)
    -{
    -  struct RObject *p;
    -  mrb_value clone;
    -
    -  if (mrb_immediate_p(self)) {
    -    mrb_raisef(mrb, E_TYPE_ERROR, "can't clone %v", self);
    -  }
    -  if (mrb_sclass_p(self)) {
    -    mrb_raise(mrb, E_TYPE_ERROR, "can't clone singleton class");
    -  }
    -  p = (struct RObject*)mrb_obj_alloc(mrb, mrb_type(self), mrb_obj_class(mrb, self));
    -  p->c = mrb_singleton_class_clone(mrb, self);
    -  mrb_field_write_barrier(mrb, (struct RBasic*)p, (struct RBasic*)p->c);
    -  clone = mrb_obj_value(p);
    -  init_copy(mrb, clone, self);
    -  p->flags |= mrb_obj_ptr(self)->flags & MRB_FL_OBJ_IS_FROZEN;
    -
    -  return clone;
    -}
    -
    -
    - -
    -

    - - #define_singleton_methodObject - - - - - -

    -
    -

    15.3.1.3.45

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -384
    -385
    -386
    -387
    -388
    -389
    -390
    -391
    -392
    -393
    -394
    -395
    -396
    -397
    -398
    -399
    -
    -
    # File 'mrbgems/mruby-metaprog/src/metaprog.c', line 384
    -
    -static mrb_value
    -mod_define_singleton_method(mrb_state *mrb, mrb_value self)
    -{
    -  struct RProc *p;
    -  mrb_method_t m;
    -  mrb_sym mid;
    -  mrb_value blk = mrb_nil_value();
    -
    -  mrb_get_args(mrb, "n&!", &mid, &blk);
    -  p = (struct RProc*)mrb_obj_alloc(mrb, MRB_TT_PROC, mrb->proc_class);
    -  mrb_proc_copy(p, mrb_proc_ptr(blk));
    -  p->flags |= MRB_PROC_STRICT;
    -  MRB_METHOD_FROM_PROC(m, p);
    -  mrb_define_method_raw(mrb, mrb_class_ptr(mrb_singleton_class(mrb, self)), mid, m);
    -  return mrb_symbol_value(mid);
    -}
    -
    -
    - -
    -

    - - #dupObject - - - - - -

    -
    -

    Produces a shallow copy of obj—the instance variables of -obj are copied, but not the objects they reference. -dup copies the frozen state of obj. See also -the discussion under Object#clone. In general, -clone and dup may have different semantics -in descendant classes. While clone is used to duplicate -an object, including its internal state, dup typically -uses the class of the descendant object to create the new instance.

    - -

    This method may have class-specific behavior. If so, that -behavior will be documented under the #+initialize_copy+ method of -the class.

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Object) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -362
    -363
    -364
    -365
    -366
    -367
    -368
    -369
    -370
    -371
    -372
    -373
    -374
    -375
    -376
    -377
    -378
    -379
    -
    -
    # File 'src/kernel.c', line 362
    -
    -MRB_API mrb_value
    -mrb_obj_dup(mrb_state *mrb, mrb_value obj)
    -{
    -  struct RBasic *p;
    -  mrb_value dup;
    -
    -  if (mrb_immediate_p(obj)) {
    -    mrb_raisef(mrb, E_TYPE_ERROR, "can't dup %v", obj);
    -  }
    -  if (mrb_sclass_p(obj)) {
    -    mrb_raise(mrb, E_TYPE_ERROR, "can't dup singleton class");
    -  }
    -  p = mrb_obj_alloc(mrb, mrb_type(obj), mrb_obj_class(mrb, obj));
    -  dup = mrb_obj_value(p);
    -  init_copy(mrb, dup, obj);
    -
    -  return dup;
    -}
    -
    -
    - -
    -

    - - - #==(other) ⇒ Boolean - - #equal?(other) ⇒ Boolean - - #eql?(other) ⇒ Boolean - - - - - - -

    -
    -

    Equality—At the Object level, == returns -true only if obj and other are the -same object. Typically, this method is overridden in descendant -classes to provide class-specific meaning.

    - -

    Unlike ==, the equal? method should never be -overridden by subclasses: it is used to determine object identity -(that is, a.equal?(b) iff a is the same -object as b).

    - -

    The eql? method returns true if -obj and anObject have the same value. Used by -Hash to test members for equality. For objects of -class Object, eql? is synonymous with -==. Subclasses normally continue this tradition, but -there are exceptions. Numeric types, for example, -perform type conversion across ==, but not across -eql?, so:

    - -

    1 == 1.0 #=> true - 1.eql? 1.0 #=> false

    - - -
    -
    -
    - -

    Overloads:

    -
      - - -
    • - #==(other) ⇒ Boolean -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Boolean) - - - -
      • - -
      - -
      - - -
    • - - -
    • - #equal?(other) ⇒ Boolean -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Boolean) - - - -
      • - -
      - -
      - - -
    • - - -
    • - #eql?(other) ⇒ Boolean -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Boolean) - - - -
      • - -
      - -
      - - -
    • - -
    - - -
    - - - - - - -
    -
    -
    -
    -1670
    -1671
    -1672
    -1673
    -1674
    -1675
    -1676
    -1677
    -
    -
    # File 'src/class.c', line 1670
    -
    -mrb_value
    -mrb_obj_equal_m(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value arg;
    -
    -  mrb_get_args(mrb, "o", &arg);
    -  return mrb_bool_value(mrb_obj_equal(mrb, self, arg));
    -}
    -
    -
    - -
    -

    - - #extendObject - - - - - -

    -
    -

    Adds to obj the instance methods from each module given as a -parameter.

    - -

    module Mod - def hello - “Hello from Mod.\n” - end - end

    - -

    class Klass - def hello - “Hello from Klass.\n” - end - end

    - -

    k = Klass.new - k.hello #=> “Hello from Klass.\n” - k.extend(Mod) #=> # - k.hello #=> "Hello from Mod.\n"

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Object) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -424
    -425
    -426
    -427
    -428
    -429
    -430
    -431
    -432
    -
    -
    # File 'src/kernel.c', line 424
    -
    -static mrb_value
    -mrb_obj_extend_m(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value *argv;
    -  mrb_int argc;
    -
    -  mrb_get_args(mrb, "*", &argv, &argc);
    -  return mrb_obj_extend(mrb, argc, argv, self);
    -}
    -
    -
    - -
    -

    - - #formatObject - - - - - -

    -
    -

    in sprintf.c

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -9
    -
    -
    # File 'mrbgems/mruby-sprintf/src/kernel.c', line 9
    -
    -mrb_value mrb_f_sprintf(mrb_state *mrb, mrb_value obj);
    -
    -
    - -
    -

    - - #freezeObject - - - - - -

    -
    -

    15.3.1.3.13

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -434
    -435
    -436
    -437
    -438
    -439
    -440
    -441
    -442
    -443
    -444
    -445
    -
    -
    # File 'src/kernel.c', line 434
    -
    -MRB_API mrb_value
    -mrb_obj_freeze(mrb_state *mrb, mrb_value self)
    -{
    -  if (!mrb_immediate_p(self)) {
    -    struct RBasic *b = mrb_basic_ptr(self);
    -    if (!mrb_frozen_p(b)) {
    -      MRB_SET_FROZEN_FLAG(b);
    -      if (b->c->tt == MRB_TT_SCLASS) MRB_SET_FROZEN_FLAG(b->c);
    -    }
    -  }
    -  return self;
    -}
    -
    -
    - -
    -

    - - #frozen?Boolean - - - - - -

    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Boolean) - - - -
    • - -
    - -
    - - - - - - -
    -
    -
    -
    -447
    -448
    -449
    -450
    -451
    -
    -
    # File 'src/kernel.c', line 447
    -
    -static mrb_value
    -mrb_obj_frozen(mrb_state *mrb, mrb_value self)
    -{
    -  return mrb_bool_value(mrb_immediate_p(self) || mrb_frozen_p(mrb_basic_ptr(self)));
    -}
    -
    -
    - -
    -

    - - #gets(*args) ⇒ Object - - - - - -

    - - - - -
    -
    -
    -
    -28
    -29
    -30
    -
    -
    # File 'mrbgems/mruby-io/mrblib/kernel.rb', line 28
    -
    -def gets(*args)
    -  $stdin.gets(*args)
    -end
    -
    -
    - -
    -

    - - #global_variablesArray - - - - - -

    -
    -

    Returns an array of the names of global variables.

    - -

    global_variables.grep /std/ #=> [:$stdin, :$stdout, :$stderr]

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Array) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -985
    -986
    -987
    -988
    -989
    -990
    -991
    -992
    -993
    -
    -
    # File 'src/variable.c', line 985
    -
    -mrb_value
    -mrb_f_global_variables(mrb_state *mrb, mrb_value self)
    -{
    -  iv_tbl *t = mrb->globals;
    -  mrb_value ary = mrb_ary_new(mrb);
    -
    -  iv_foreach(mrb, t, gv_i, &ary);
    -  return ary;
    -}
    -
    -
    - -
    -

    - - #hashFixnum - - - - - -

    -
    -

    Generates a Fixnum hash value for this object. This -function must have the property that a.eql?(b) implies -a.hash == b.hash. The hash value is used by class -Hash. Any hash value that exceeds the capacity of a -Fixnum will be truncated before being used.

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Fixnum) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -464
    -465
    -466
    -467
    -468
    -
    -
    # File 'src/kernel.c', line 464
    -
    -static mrb_value
    -mrb_obj_hash(mrb_state *mrb, mrb_value self)
    -{
    -  return mrb_fixnum_value(mrb_obj_id(self));
    -}
    -
    -
    - -
    -

    - - #initialize_copyObject - - - - - -

    -
    -

    15.3.1.3.16

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -471
    -472
    -473
    -474
    -475
    -476
    -477
    -478
    -479
    -480
    -481
    -482
    -
    -
    # File 'src/kernel.c', line 471
    -
    -static mrb_value
    -mrb_obj_init_copy(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value orig;
    -
    -  mrb_get_args(mrb, "o", &orig);
    -  if (mrb_obj_equal(mrb, self, orig)) return self;
    -  if ((mrb_type(self) != mrb_type(orig)) || (mrb_obj_class(mrb, self) != mrb_obj_class(mrb, orig))) {
    -      mrb_raise(mrb, E_TYPE_ERROR, "initialize_copy should take same class object");
    -  }
    -  return self;
    -}
    -
    -
    - -
    -

    - - #inspectString - - - - - -

    -
    -

    Returns a string containing a human-readable representation of -obj. If not overridden and no instance variables, uses the -to_s method to generate the string. -obj. If not overridden, uses the to_s method to -generate the string.

    - -

    [ 1, 2, 3..4, ‘five’ ].inspect #=> “[1, 2, 3..4, "five"]” - Time.new.inspect #=> “2008-03-08 19:43:39 +0900”

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (String) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
    -
    -
    # File 'src/kernel.c', line 53
    -
    -MRB_API mrb_value
    -mrb_obj_inspect(mrb_state *mrb, mrb_value obj)
    -{
    -  if (mrb_object_p(obj) && mrb_obj_basic_to_s_p(mrb, obj)) {
    -    return mrb_obj_iv_inspect(mrb, mrb_obj_ptr(obj));
    -  }
    -  return mrb_any_to_s(mrb, obj);
    -}
    -
    -
    - -
    -

    - - #instance_of?Boolean - - - - - -

    -
    -

    Returns true if obj is an instance of the given -class. See also Object#kind_of?.

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Boolean) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -500
    -501
    -502
    -503
    -504
    -505
    -506
    -507
    -508
    -
    -
    # File 'src/kernel.c', line 500
    -
    -static mrb_value
    -obj_is_instance_of(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value arg;
    -
    -  mrb_get_args(mrb, "C", &arg);
    -
    -  return mrb_bool_value(mrb_obj_is_instance_of(mrb, self, mrb_class_ptr(arg)));
    -}
    -
    -
    - -
    -

    - - #instance_variable_defined?(symbol) ⇒ Boolean - - - - - -

    -
    -

    Returns true if the given instance variable is -defined in obj.

    - -

    class Fred - def initialize(p1, p2) - @a, @b = p1, p2 - end - end - fred = Fred.new(‘cat’, 99) - fred.instance_variable_defined?(:@a) #=> true - fred.instance_variable_defined?(“@b”) #=> true - fred.instance_variable_defined?(“@c”) #=> false

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Boolean) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -
    -
    # File 'mrbgems/mruby-metaprog/src/metaprog.c', line 47
    -
    -static mrb_value
    -mrb_obj_ivar_defined(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_sym sym;
    -
    -  mrb_get_args(mrb, "n", &sym);
    -  mrb_iv_name_sym_check(mrb, sym);
    -  return mrb_bool_value(mrb_iv_defined(mrb, self, sym));
    -}
    -
    -
    - -
    -

    - - #instance_variable_get(symbol) ⇒ Object - - - - - -

    -
    -

    Returns the value of the given instance variable, or nil if the -instance variable is not set. The @ part of the -variable name should be included for regular instance -variables. Throws a NameError exception if the -supplied symbol is not valid as an instance variable name.

    - -

    class Fred - def initialize(p1, p2) - @a, @b = p1, p2 - end - end - fred = Fred.new(‘cat’, 99) - fred.instance_variable_get(:@a) #=> “cat” - fred.instance_variable_get(“@b”) #=> 99

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Object) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -
    -
    # File 'mrbgems/mruby-metaprog/src/metaprog.c', line 77
    -
    -static mrb_value
    -mrb_obj_ivar_get(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_sym iv_name;
    -
    -  mrb_get_args(mrb, "n", &iv_name);
    -  mrb_iv_name_sym_check(mrb, iv_name);
    -  return mrb_iv_get(mrb, self, iv_name);
    -}
    -
    -
    - -
    -

    - - #instance_variable_set(symbol, obj) ⇒ Object - - - - - -

    -
    -

    Sets the instance variable names by symbol to -object, thereby frustrating the efforts of the class’s -author to attempt to provide proper encapsulation. The variable -did not have to exist prior to this call.

    - -

    class Fred - def initialize(p1, p2) - @a, @b = p1, p2 - end - end - fred = Fred.new(‘cat’, 99) - fred.instance_variable_set(:@a, ‘dog’) #=> “dog” - fred.instance_variable_set(:@c, ‘cat’) #=> “cat” - fred.inspect #=> “#<Fred:0x401b3da8 @a="dog", @b=99, @c="cat">”

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Object) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -107
    -108
    -109
    -110
    -111
    -112
    -113
    -114
    -115
    -116
    -117
    -
    -
    # File 'mrbgems/mruby-metaprog/src/metaprog.c', line 107
    -
    -static mrb_value
    -mrb_obj_ivar_set(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_sym iv_name;
    -  mrb_value val;
    -
    -  mrb_get_args(mrb, "no", &iv_name, &val);
    -  mrb_iv_name_sym_check(mrb, iv_name);
    -  mrb_iv_set(mrb, self, iv_name, val);
    -  return val;
    -}
    -
    -
    - -
    -

    - - #instance_variablesArray - - - - - -

    -
    -

    Returns an array of instance variable names for the receiver. Note -that simply defining an accessor does not create the corresponding -instance variable.

    - -

    class Fred - attr_accessor :a1 - def initialize - @iv = 3 - end - end - Fred.new.instance_variables #=> [:@iv]

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Array) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -568
    -569
    -570
    -571
    -572
    -573
    -574
    -575
    -576
    -577
    -578
    -
    -
    # File 'src/variable.c', line 568
    -
    -mrb_value
    -mrb_obj_instance_variables(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value ary;
    -
    -  ary = mrb_ary_new(mrb);
    -  if (obj_iv_p(self)) {
    -    iv_foreach(mrb, mrb_obj_ptr(self)->iv, iv_i, &ary);
    -  }
    -  return ary;
    -}
    -
    -
    - -
    -

    - - - #is_a?Boolean - - #kind_of?Boolean - - - - - - -

    -
    -

    Returns true if class is the class of -obj, or if class is one of the superclasses of -obj or modules included in obj.

    - -

    module M; end - class A - include M - end - class B < A; end - class C < B; end - b = B.new - b.instance_of? A #=> false - b.instance_of? B #=> true - b.instance_of? C #=> false - b.instance_of? M #=> false - b.kind_of? A #=> true - b.kind_of? B #=> true - b.kind_of? C #=> false - b.kind_of? M #=> true

    - - -
    -
    -
    - -

    Overloads:

    -
      - - -
    • - #is_a?Boolean -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Boolean) - - - -
      • - -
      - -
      - - -
    • - - -
    • - #kind_of?Boolean -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Boolean) - - - -
      • - -
      - -
      - - -
    • - -
    - - -
    - - - - - - -
    -
    -
    -
    -537
    -538
    -539
    -540
    -541
    -542
    -543
    -544
    -545
    -
    -
    # File 'src/kernel.c', line 537
    -
    -static mrb_value
    -mrb_obj_is_kind_of_m(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value arg;
    -
    -  mrb_get_args(mrb, "C", &arg);
    -
    -  return mrb_bool_value(mrb_obj_is_kind_of(mrb, self, mrb_class_ptr(arg)));
    -}
    -
    -
    - -
    -

    - - - #block_given?Boolean - - #iterator?Boolean - - - - - - -

    -
    -

    Returns true if yield would execute a -block in the current context. The iterator? form -is mildly deprecated.

    - -

    def try - if block_given? - yield - else - “no block” - end - end - try #=> “no block” - try { “hello” } #=> “hello” - try do “hello” end #=> “hello”

    - - -
    -
    -
    - -

    Overloads:

    -
      - - -
    • - #block_given?Boolean -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Boolean) - - - -
      • - -
      - -
      - - -
    • - - -
    • - #iterator?Boolean -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Boolean) - - - -
      • - -
      - -
      - - -
    • - -
    - - -
    - - - - - - -
    -
    -
    -
    -127
    -128
    -129
    -130
    -131
    -132
    -133
    -134
    -135
    -136
    -137
    -138
    -139
    -140
    -141
    -142
    -143
    -144
    -145
    -146
    -147
    -148
    -149
    -150
    -151
    -152
    -153
    -154
    -155
    -156
    -157
    -158
    -159
    -160
    -161
    -162
    -163
    -164
    -165
    -166
    -167
    -168
    -169
    -170
    -171
    -172
    -173
    -174
    -175
    -176
    -177
    -178
    -179
    -180
    -
    -
    # File 'src/kernel.c', line 127
    -
    -static mrb_value
    -mrb_f_block_given_p_m(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_callinfo *ci = &mrb->c->ci[-1];
    -  mrb_callinfo *cibase = mrb->c->cibase;
    -  mrb_value *bp;
    -  struct RProc *p;
    -
    -  if (ci <= cibase) {
    -    /* toplevel does not have block */
    -    return mrb_false_value();
    -  }
    -  p = ci->proc;
    -  /* search method/class/module proc */
    -  while (p) {
    -    if (MRB_PROC_SCOPE_P(p)) break;
    -    p = p->upper;
    -  }
    -  if (p == NULL) return mrb_false_value();
    -  /* search ci corresponding to proc */
    -  while (cibase < ci) {
    -    if (ci->proc == p) break;
    -    ci--;
    -  }
    -  if (ci == cibase) {
    -    return mrb_false_value();
    -  }
    -  else if (ci->env) {
    -    struct REnv *e = ci->env;
    -    int bidx;
    -
    -    /* top-level does not have block slot (always false) */
    -    if (e->stack == mrb->c->stbase)
    -      return mrb_false_value();
    -    /* use saved block arg position */
    -    bidx = MRB_ENV_BIDX(e);
    -    /* bidx may be useless (e.g. define_method) */
    -    if (bidx >= MRB_ENV_STACK_LEN(e))
    -      return mrb_false_value();
    -    bp = &e->stack[bidx];
    -  }
    -  else {
    -    bp = ci[1].stackent+1;
    -    if (ci->argc >= 0) {
    -      bp += ci->argc;
    -    }
    -    else {
    -      bp++;
    -    }
    -  }
    -  if (mrb_nil_p(*bp))
    -    return mrb_false_value();
    -  return mrb_true_value();
    -}
    -
    -
    - -
    -

    - - - #is_a?Boolean - - #kind_of?Boolean - - - - - - -

    -
    -

    Returns true if class is the class of -obj, or if class is one of the superclasses of -obj or modules included in obj.

    - -

    module M; end - class A - include M - end - class B < A; end - class C < B; end - b = B.new - b.instance_of? A #=> false - b.instance_of? B #=> true - b.instance_of? C #=> false - b.instance_of? M #=> false - b.kind_of? A #=> true - b.kind_of? B #=> true - b.kind_of? C #=> false - b.kind_of? M #=> true

    - - -
    -
    -
    - -

    Overloads:

    -
      - - -
    • - #is_a?Boolean -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Boolean) - - - -
      • - -
      - -
      - - -
    • - - -
    • - #kind_of?Boolean -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Boolean) - - - -
      • - -
      - -
      - - -
    • - -
    - - -
    - - - - - - -
    -
    -
    -
    -537
    -538
    -539
    -540
    -541
    -542
    -543
    -544
    -545
    -
    -
    # File 'src/kernel.c', line 537
    -
    -static mrb_value
    -mrb_obj_is_kind_of_m(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value arg;
    -
    -  mrb_get_args(mrb, "C", &arg);
    -
    -  return mrb_bool_value(mrb_obj_is_kind_of(mrb, self, mrb_class_ptr(arg)));
    -}
    -
    -
    - -
    -

    - - #local_variablesArray - - - - - -

    -
    -

    Returns the names of local variables in the current scope.

    - -

    [mruby limitation] -If variable symbol information was stripped out from -compiled binary files using mruby-strip -l, this -method always returns an empty array.

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Array) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -132
    -133
    -134
    -135
    -136
    -137
    -138
    -139
    -140
    -141
    -142
    -143
    -144
    -145
    -146
    -147
    -148
    -149
    -150
    -151
    -152
    -153
    -154
    -155
    -156
    -157
    -158
    -159
    -160
    -161
    -162
    -163
    -164
    -165
    -166
    -167
    -168
    -169
    -170
    -
    -
    # File 'mrbgems/mruby-metaprog/src/metaprog.c', line 132
    -
    -static mrb_value
    -mrb_local_variables(mrb_state *mrb, mrb_value self)
    -{
    -  struct RProc *proc;
    -  mrb_irep *irep;
    -  mrb_value vars;
    -  size_t i;
    -
    -  proc = mrb->c->ci[-1].proc;
    -
    -  if (MRB_PROC_CFUNC_P(proc)) {
    -    return mrb_ary_new(mrb);
    -  }
    -  vars = mrb_hash_new(mrb);
    -  while (proc) {
    -    if (MRB_PROC_CFUNC_P(proc)) break;
    -    irep = proc->body.irep;
    -    if (!irep->lv) break;
    -    for (i = 0; i + 1 < irep->nlocals; ++i) {
    -      if (irep->lv[i].name) {
    -        mrb_sym sym = irep->lv[i].name;
    -        const char *name = mrb_sym_name(mrb, sym);
    -        switch (name[0]) {
    -        case '*': case '&':
    -          break;
    -        default:
    -          mrb_hash_set(mrb, vars, mrb_symbol_value(sym), mrb_true_value());
    -          break;
    -        }
    -      }
    -    }
    -    if (!MRB_PROC_ENV_P(proc)) break;
    -    proc = proc->upper;
    -    //if (MRB_PROC_SCOPE_P(proc)) break;
    -    if (!proc->c) break;
    -  }
    -
    -  return mrb_hash_keys(mrb, vars);
    -}
    -
    -
    - -
    -

    - - #loop(&block) ⇒ Object - - - - - -

    -
    -

    Calls the given block repetitively.

    - -

    ISO 15.3.1.3.29

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -
    -
    # File 'mrblib/kernel.rb', line 27
    -
    -def loop(&block)
    -  return to_enum :loop unless block
    -
    -  while true
    -    yield
    -  end
    -rescue StopIteration => e
    -  e.result
    -end
    -
    -
    - -
    -

    - - #methodsArray - - - - - -

    -
    -

    Returns a list of the names of methods publicly accessible in -obj. This will include all the methods accessible in -obj’s ancestors.

    - -

    class Klass - def kMethod() - end - end - k = Klass.new - k.methods[0..9] #=> [:kMethod, :respond_to?, :nil?, :is_a?, - # :class, :instance_variable_set, - # :methods, :extend, :send, :instance_eval] - k.methods.length #=> 42

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Array) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -252
    -253
    -254
    -255
    -256
    -257
    -258
    -
    -
    # File 'mrbgems/mruby-metaprog/src/metaprog.c', line 252
    -
    -static mrb_value
    -mrb_obj_methods_m(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_bool recur = TRUE;
    -  mrb_get_args(mrb, "|b", &recur);
    -  return mrb_obj_methods(mrb, recur, self, (mrb_method_flag_t)0); /* everything but private */
    -}
    -
    -
    - -
    -

    - - #nil?Boolean - - - - - -

    -
    -

    call_seq: - nil.nil? -> true

    -.nil? -> false - -Only the object nil responds true to nil?. - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Boolean) - - - -
    • - -
    - -
    - - - - - - -
    -
    -
    -
    -547
    -548
    -549
    -550
    -551
    -552
    -553
    -554
    -555
    -556
    -557
    -558
    -559
    -560
    -561
    -562
    -
    -
    # File 'src/kernel.c', line 547
    -
    -KHASH_DECLARE(st, mrb_sym, char, FALSE)
    -KHASH_DEFINE(st, mrb_sym, char, FALSE, kh_int_hash_func, kh_int_hash_equal)
    -
    -/* 15.3.1.3.32 */
    -/*
    - * call_seq:
    - *   nil.nil?               -> true
    - *   <anything_else>.nil?   -> false
    - *
    - * Only the object <i>nil</i> responds <code>true</code> to <code>nil?</code>.
    - */
    -static mrb_value
    -mrb_false(mrb_state *mrb, mrb_value self)
    -{
    -  return mrb_false_value();
    -}
    -
    -
    - -
    -

    - - #object_idObject - - - - - -

    -
    -

    call-seq: - obj.id -> fixnum - obj.object_id -> fixnum

    - -

    Returns an integer identifier for obj. The same number will -be returned on all calls to id for a given object, and -no two active objects will share an id. -Object#object_id is a different concept from the -:name notation, which returns the symbol id of -name. Replaces the deprecated Object#id.

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -97
    -98
    -99
    -100
    -101
    -
    -
    # File 'src/kernel.c', line 97
    -
    -mrb_value
    -mrb_obj_id_m(mrb_state *mrb, mrb_value self)
    -{
    -  return mrb_fixnum_value(mrb_obj_id(self));
    -}
    -
    -
    - -
    -

    - - #open(file, *rest, &block) ⇒ Object - - - - - -

    -
    - - - -
    -
    -
    - -

    Raises:

    - - -
    - - - - - - -
    -
    -
    -
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -
    -
    # File 'mrbgems/mruby-io/mrblib/kernel.rb', line 6
    -
    -def open(file, *rest, &block)
    -  raise ArgumentError unless file.is_a?(String)
    -
    -  if file[0] == "|"
    -    IO.popen(file[1..-1], *rest, &block)
    -  else
    -    File.open(file, *rest, &block)
    -  end
    -end
    -
    -
    - -
    -

    - - #p(*args) ⇒ Object - - - - - -

    -
    -

    Print human readable object description

    - -

    ISO 15.3.1.3.34

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -
    -
    # File 'mrbgems/mruby-print/mrblib/print.rb', line 40
    -
    -def p(*args)
    -  i = 0
    -  len = args.size
    -  while i < len
    -    __printstr__ args[i].inspect
    -    __printstr__ "\n"
    -    i += 1
    -  end
    -  args.__svalue
    -end
    -
    -
    - -
    -
    -
    -

    Invoke method +print+ on STDOUT and passing +*args+

    - -

    ISO 15.3.1.2.10

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -10
    -11
    -12
    -
    -
    # File 'mrbgems/mruby-print/mrblib/print.rb', line 10
    -
    -def print(*args)
    -  $stdout.print(*args)
    -end
    -
    -
    - -
    -

    - - #printf(*args) ⇒ Object - - - - - -

    - - - - -
    -
    -
    -
    -24
    -25
    -26
    -
    -
    # File 'mrbgems/mruby-io/mrblib/kernel.rb', line 24
    -
    -def printf(*args)
    -  $stdout.printf(*args)
    -end
    -
    -
    - -
    -

    - - #private_methods(all = true) ⇒ Array - - - - - -

    -
    -

    Returns the list of private methods accessible to obj. If -the all parameter is set to false, only those methods -in the receiver will be listed.

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Array) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -269
    -270
    -271
    -272
    -273
    -274
    -275
    -
    -
    # File 'mrbgems/mruby-metaprog/src/metaprog.c', line 269
    -
    -static mrb_value
    -mrb_obj_private_methods(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_bool recur = TRUE;
    -  mrb_get_args(mrb, "|b", &recur);
    -  return mrb_obj_methods(mrb, recur, self, NOEX_PRIVATE); /* private attribute not define */
    -}
    -
    -
    - -
    -

    - - #protected_methods(all = true) ⇒ Array - - - - - -

    -
    -

    Returns the list of protected methods accessible to obj. If -the all parameter is set to false, only those methods -in the receiver will be listed.

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Array) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -286
    -287
    -288
    -289
    -290
    -291
    -292
    -
    -
    # File 'mrbgems/mruby-metaprog/src/metaprog.c', line 286
    -
    -static mrb_value
    -mrb_obj_protected_methods(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_bool recur = TRUE;
    -  mrb_get_args(mrb, "|b", &recur);
    -  return mrb_obj_methods(mrb, recur, self, NOEX_PROTECTED); /* protected attribute not define */
    -}
    -
    -
    - -
    -

    - - #public_methods(all = true) ⇒ Array - - - - - -

    -
    -

    Returns the list of public methods accessible to obj. If -the all parameter is set to false, only those methods -in the receiver will be listed.

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Array) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -303
    -304
    -305
    -306
    -307
    -308
    -309
    -
    -
    # File 'mrbgems/mruby-metaprog/src/metaprog.c', line 303
    -
    -static mrb_value
    -mrb_obj_public_methods(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_bool recur = TRUE;
    -  mrb_get_args(mrb, "|b", &recur);
    -  return mrb_obj_methods(mrb, recur, self, NOEX_PUBLIC); /* public attribute not define */
    -}
    -
    -
    - -
    -

    - - #puts(*args) ⇒ Object - - - - - -

    -
    -

    Invoke method +puts+ on STDOUT and passing +args+

    - -

    ISO 15.3.1.2.11

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -23
    -24
    -25
    -
    -
    # File 'mrbgems/mruby-print/mrblib/print.rb', line 23
    -
    -def puts(*args)
    -  $stdout.puts(*args)
    -end
    -
    -
    - -
    -

    - - - #raiseObject - - #raise(string) ⇒ Object - - #raise(exception[, string]) ⇒ Object - - - - - - -

    -
    -

    With no arguments, raises a RuntimeError -With a single +String+ argument, raises a -+RuntimeError+ with the string as a message. Otherwise, -the first parameter should be the name of an +Exception+ -class (or an object that returns an +Exception+ object when sent -an +exception+ message). The optional second parameter sets the -message associated with the exception, and the third parameter is an -array of callback information. Exceptions are caught by the -+rescue+ clause of begin...end blocks.

    - -

    raise “Failed to create socket” - raise ArgumentError, “No parameters”, caller

    - - -
    -
    -
    - - -
    - - - - - - -
    -
    -
    -
    -585
    -586
    -587
    -588
    -589
    -590
    -591
    -592
    -593
    -594
    -595
    -596
    -597
    -598
    -599
    -600
    -601
    -602
    -603
    -604
    -605
    -606
    -607
    -608
    -609
    -610
    -
    -
    # File 'src/kernel.c', line 585
    -
    -MRB_API mrb_value
    -mrb_f_raise(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_value a[2], exc;
    -  mrb_int argc;
    -
    -
    -  argc = mrb_get_args(mrb, "|oo", &a[0], &a[1]);
    -  switch (argc) {
    -  case 0:
    -    mrb_raise(mrb, E_RUNTIME_ERROR, "");
    -    break;
    -  case 1:
    -    if (mrb_string_p(a[0])) {
    -      a[1] = a[0];
    -      argc = 2;
    -      a[0] = mrb_obj_value(E_RUNTIME_ERROR);
    -    }
    -    /* fall through */
    -  default:
    -    exc = mrb_make_exception(mrb, argc, a);
    -    mrb_exc_raise(mrb, exc);
    -    break;
    -  }
    -  return mrb_nil_value();            /* not reached */
    -}
    -
    -
    - -
    -

    - - #Rational(numerator, denominator = 1) ⇒ Object - - - - - -

    - - - - -
    -
    -
    -
    -86
    -87
    -88
    -89
    -90
    -91
    -
    -
    # File 'mrbgems/mruby-rational/mrblib/rational.rb', line 86
    -
    -def Rational(numerator, denominator = 1)
    -  a = numerator
    -  b = denominator
    -  a, b = b, a % b until b == 0
    -  Rational._new(numerator.div(a), denominator.div(a))
    -end
    -
    -
    - -
    -

    - - #remove_instance_variable(symbol) ⇒ Object - - - - - -

    -
    -

    Removes the named instance variable from obj, returning that -variable’s value.

    - -

    class Dummy - attr_reader :var - def initialize - @var = 99 - end - def remove - remove_instance_variable(:@var) - end - end - d = Dummy.new - d.var #=> 99 - d.remove #=> 99 - d.var #=> nil

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Object) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -634
    -635
    -636
    -637
    -638
    -639
    -640
    -641
    -642
    -643
    -644
    -645
    -646
    -647
    -
    -
    # File 'src/kernel.c', line 634
    -
    -static mrb_value
    -mrb_obj_remove_instance_variable(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_sym sym;
    -  mrb_value val;
    -
    -  mrb_get_args(mrb, "n", &sym);
    -  mrb_iv_name_sym_check(mrb, sym);
    -  val = mrb_iv_remove(mrb, self, sym);
    -  if (mrb_undef_p(val)) {
    -    mrb_name_error(mrb, sym, "instance variable %n not defined", sym);
    -  }
    -  return val;
    -}
    -
    -
    - -
    -

    - - #respond_to?(symbol, include_private = false) ⇒ Boolean - - - - - -

    -
    -

    Returns +true+ if obj responds to the given -method. Private methods are included in the search only if the -optional second parameter evaluates to +true+.

    - -

    If the method is not implemented, -as Process.fork on Windows, File.lchmod on GNU/Linux, etc., -false is returned.

    - -

    If the method is not defined, respond_to_missing? -method is called and the result is returned.

    - - -
    -
    -
    - -
    -
    - - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Boolean) - - - -
    • - -
    - -
    - - - - -
    - - - - - - -
    -
    -
    -
    -725
    -726
    -727
    -728
    -729
    -730
    -731
    -732
    -733
    -734
    -735
    -736
    -737
    -738
    -739
    -740
    -741
    -742
    -743
    -744
    -
    -
    # File 'src/kernel.c', line 725
    -
    -static mrb_value
    -obj_respond_to(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_sym id, rtm_id;
    -  mrb_bool priv = FALSE, respond_to_p;
    -
    -  mrb_get_args(mrb, "n|b", &id, &priv);
    -  respond_to_p = basic_obj_respond_to(mrb, self, id, !priv);
    -  if (!respond_to_p) {
    -    rtm_id = mrb_intern_lit(mrb, "respond_to_missing?");
    -    if (basic_obj_respond_to(mrb, self, rtm_id, !priv)) {
    -      mrb_value args[2], v;
    -      args[0] = mrb_symbol_value(id);
    -      args[1] = mrb_bool_value(priv);
    -      v = mrb_funcall_argv(mrb, self, rtm_id, 2, args);
    -      return mrb_bool_value(mrb_bool(v));
    -    }
    -  }
    -  return mrb_bool_value(respond_to_p);
    -}
    -
    -
    - -
    -

    - - - #send(symbol[, args...]) ⇒ Object - - #__send__(symbol[, args...]) ⇒ Object - - - - - - -

    -
    -

    Invokes the method identified by symbol, passing it any -arguments specified. You can use __send__ if the name -+send+ clashes with an existing method in obj.

    - -

    class Klass - def hello(*args) - “Hello “ + args.join(‘ ‘) - end - end - k = Klass.new - k.send :hello, “gentle”, “readers” #=> “Hello gentle readers”

    - - -
    -
    -
    - -

    Overloads:

    -
      - - -
    • - #send(symbol[, args...]) ⇒ Object -
      -
      - - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Object) - - - -
      • - -
      - -
      - - -
    • - - -
    • - #__send__(symbol[, args...]) ⇒ Object -
      -
      +

      Kernel

      + +

      ISO 15.3.1

      -

      Returns:

      -
        - -
      • - - - (Object) - - - -
      • - -
      -
      - +
    - - - -
    - - - - - - -
    -
     
     
    -592
    -593
    -594
    -595
    -596
    -597
    -598
    -599
    -600
    -601
    -602
    -603
    -604
    -605
    -606
    -607
    -608
    -609
    -610
    -611
    -612
    -613
    -614
    -615
    -616
    -617
    -618
    -619
    -620
    -621
    -622
    -623
    -624
    -625
    -626
    -627
    -628
    -629
    -630
    -631
    -632
    -633
    -634
    -635
    -636
    -
    -
    # File 'src/vm.c', line 592
     
    -mrb_value
    -mrb_f_send(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_sym name;
    -  mrb_value block, *argv, *regs;
    -  mrb_int argc, i, len;
    -  mrb_method_t m;
    -  struct RClass *c;
    -  mrb_callinfo *ci;
     
    -  mrb_get_args(mrb, "n*&", &name, &argv, &argc, &block);
    -  ci = mrb->c->ci;
    -  if (ci->acc < 0) {
    -  funcall:
    -    return mrb_funcall_with_block(mrb, self, name, argc, argv, block);
    -  }
     
    -  c = mrb_class(mrb, self);
    -  m = mrb_method_search_vm(mrb, &c, name);
    -  if (MRB_METHOD_UNDEF_P(m)) {            /* call method_mising */
    -    goto funcall;
    -  }
    +  
    +    

    + Instance Method Summary + collapse +

    - ci->mid = name; - ci->target_class = c; - regs = mrb->c->stack+1; - /* remove first symbol from arguments */ - if (ci->argc >= 0) { - for (i=0,len=ci->argc; i<len; i++) { - regs[i] = regs[i+1]; - } - ci->argc--; - } - else { /* variable length arguments */ - mrb_ary_shift(mrb, regs[0]); - } +
      + +
    • + + + #!~(y) ⇒ Object + - if (MRB_METHOD_CFUNC_P(m)) { - if (MRB_METHOD_PROC_P(m)) { - ci->proc = MRB_METHOD_PROC(m); - } - return MRB_METHOD_CFUNC(m)(mrb, self); - } - return mrb_exec_irep(mrb, self, MRB_METHOD_PROC(m)); -}
    -
    -
    -
    -

    + + + + - #singleton_classObject - - -

    -
    -

    15.3.1.3.28 (15.3.1.2.7)

    - -
    -
    -
    +
    +

    11.4.4 Step c).

    +
    + + -
    - - - - - - -
    -
    +      
    +        
  • + + + #extend(*args) ⇒ Object + + + + + + + + + + -1264 -1265 -1266 -1267 -1268 -1269 -1270 -1271 -1272 -1273 -1274 -1275 -1276 -1277 -1278 -1279 -1280 -1281 -1282 -1283 -1284 -1285 -1286 -1287 -1288 -1289 -1290 -1291
  • -
    -
    # File 'src/class.c', line 1264
    +  
    +    
    +

    call-seq: obj.extend(module, …) -> obj.

    +
    + + -MRB_API mrb_value -mrb_singleton_class(mrb_state *mrb, mrb_value v) -{ - struct RBasic *obj; + +
  • + + + #tap {|_self| ... } ⇒ Object + - switch (mrb_type(v)) { - case MRB_TT_FALSE: - if (mrb_nil_p(v)) - return mrb_obj_value(mrb->nil_class); - return mrb_obj_value(mrb->false_class); - case MRB_TT_TRUE: - return mrb_obj_value(mrb->true_class); - case MRB_TT_CPTR: - return mrb_obj_value(mrb->object_class); - case MRB_TT_SYMBOL: - case MRB_TT_FIXNUM: -#ifndef MRB_WITHOUT_FLOAT - case MRB_TT_FLOAT: -#endif - mrb_raise(mrb, E_TYPE_ERROR, "can't define singleton"); - return mrb_nil_value(); /* not reached */ - default: - break; - } - obj = mrb_basic_ptr(v); - prepare_singleton_class(mrb, obj); - return mrb_obj_value(obj->c); -}
  • -
    -
    -
    -

    + + + + - #singleton_method(name) ⇒ Object - - -

    - - - - -
    -
     
    +  
    +    
    +

    call-seq: obj.tap{|x|…} -> obj.

    +
    + + -2 -3 -4 -5 -6 -7 -8 -9
    -
    -
    # File 'mrbgems/mruby-method/mrblib/kernel.rb', line 2
    +      
    +        
  • + + + #to_enum(meth = :each, *args, **kwd) ⇒ Object + -def singleton_method(name) - m = method(name) - sc = (class <<self; self; end) - if m.owner != sc - raise NameError, "undefined method '#{name}' for class '#{sc}'" - end - m -end
  • -
    -
    -
    -

    + (also: #enum_for) + + + + + + + - #singleton_methods(all = true) ⇒ Array +
    +

    call-seq: obj.to_enum(method = :each, args) -> enum obj.enum_for(method = :each, args) -> enum.

    +
    + + + +
  • + + + #yield_self(&block) ⇒ Object + + + + (also: #then) + + + + + + + + -
  • -
    -

    Returns an array of the names of singleton methods for obj. -If the optional all parameter is true, the list will include -methods in modules included in obj. -Only public and protected singleton methods are returned.

    -

    module Other - def three() end - end

    + +
    +

    call-seq: obj.yield_self {|_obj|…} -> an_object obj.then {|_obj|…} -> an_object.

    +
    + + -

    class Single - def Single.four() end - end

    + + + -

    a = Single.new

    -

    def a.one() - end

    -

    class « a - include Other - def two() - end - end

    +
    +

    Instance Method Details

    -

    Single.singleton_methods #=> [:four] - a.singleton_methods(false) #=> [:two, :one] - a.singleton_methods #=> [:two, :one, :three]

    + +
    +

    + + #!~(y) ⇒ Object + + -

    -
    -
    -
    +
    +

    11.4.4 Step c)

    -

    Returns:

    -
      - -
    • - - - (Array) - - - -
    • - -
    - -
    - - +
    -
    -
     
     
    -376
    -377
    -378
    -379
    -380
    -381
    -382
    +38 +39 +40
    -
    # File 'mrbgems/mruby-metaprog/src/metaprog.c', line 376
    +      
    # File 'mrblib/kernel.rb', line 38
     
    -static mrb_value
    -mrb_obj_singleton_methods_m(mrb_state *mrb, mrb_value self)
    -{
    -  mrb_bool recur = TRUE;
    -  mrb_get_args(mrb, "|b", &recur);
    -  return mrb_obj_singleton_methods(mrb, recur, self);
    -}
    +def !~(y) + !(self =~ y) +end
    -

    +

    - #sprintfObject + #extend(*args) ⇒ Object @@ -6967,7 +306,18 @@

    -

    in sprintf.c

    + +

    call-seq: obj.extend(module, …) -> obj

    + +

    Adds to obj the instance methods from each module given as a parameter.

    + +

    module Mod def hello “Hello from Mod.n” end end

    + +

    class Klass def hello “Hello from Klass.n” end end

    + +

    k = Klass.new k.hello #=> “Hello from Klass.n” k.extend(Mod) #=> #<Klass:0x401b3bc8> k.hello #=> “Hello from Mod.n”

    + +

    ISO 15.3.1.3.13

    @@ -6975,20 +325,36 @@

    -
    - +

    +
     
     
    -9
    +27 +28 +29 +30 +31 +32 +33 +34 +35
    -
    # File 'mrbgems/mruby-sprintf/src/kernel.c', line 9
    +      
    # File 'mrblib/00kernel.rb', line 27
     
    -mrb_value mrb_f_sprintf(mrb_state *mrb, mrb_value obj);
    +def extend(*args) + args.reverse! + obj = self + args.each do |m| + m.__send__(:extend_object, obj) + m.__send__(:extended, obj) + end + self +end
    @@ -7005,40 +371,12 @@

    -

    call-seq: - obj.tap{|x|…} -> obj

    + +

    call-seq: obj.tap{|x|…} -> obj

    -

    Yields x to the block, and then returns x. - The primary purpose of this method is to “tap into” a method chain, - in order to perform operations on intermediate results within the chain.

    +

    Yields x to the block, and then returns x. The primary purpose of this method is to “tap into” a method chain, in order to perform operations on intermediate results within the chain.

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    (1..10) .tap xputs “original: #{x.inspect”}  
    .to_a .tap xputs “array: #{x.inspect”}  
    .select xx%2==0 .tap xputs “evens: #{x.inspect”}
    .map {xx*x } .tap xputs “squares: #{x.inspect”}
    +

    (1..10) .tap {|x| puts “original: #{x.inspect}”} .to_a .tap {|x| puts “array: #{x.inspect}”} .select {|x| x%2==0} .tap {|x| puts “evens: #{x.inspect}”} .map { |x| x*x } .tap {|x| puts “squares: #{x.inspect}”}

    @@ -7071,15 +409,16 @@

    — -

    the object that the method was called on

    +
    +

    the object that the method was called on

    -
    - +

    +
    @@ -7106,7 +445,7 @@

    - #to_enum(meth = :each, *args) ⇒ Object + #to_enum(meth = :each, *args, **kwd) ⇒ Object @@ -7118,29 +457,20 @@

    -

    call-seq: - obj.to_enum(method = :each, *args) -> enum - obj.enum_for(method = :each, *args) -> enum

    + +

    call-seq: obj.to_enum(method = :each, args) -> enum obj.enum_for(method = :each, args) -> enum

    -

    Creates a new Enumerator which will enumerate by calling +method+ on -+obj+, passing +args+ if any.

    +

    Creates a new Enumerator which will enumerate by calling method on obj, passing args if any.

    === Examples

    str = “xyz”

    -

    enum = str.enum_for(:each_byte) - enum.each { |b| puts b } - # => 120 - # => 121 - # => 122

    +

    enum = str.enum_for(:each_byte) enum.each { |b| puts b } # => 120 # => 121 # => 122

    -

    # protect an array from being modified by some_method - a = [1, 2, 3] - some_method(a.to_enum)

    +

    # protect an array from being modified by some_method a = [1, 2, 3] some_method(a.to_enum)

    -

    It is typical to call to_enum when defining methods for -a generic Enumerable, in case no block is passed.

    +

    It is typical to call to_enum when defining methods for a generic Enumerable, in case no block is passed.

    Here is such an example with parameter passing:

    @@ -7149,7 +479,7 @@

    def repeat(n) raise ArgumentError, "#{n} is negative!" if n < 0 unless block_given? - return to_enum(__method__, n) # __method__ is :repeat here + return to_enum(__callee__, n) do # __callee__ is :repeat here end each do |*val| n.times { yield *val } @@ -7170,20 +500,20 @@

    -
    - +

    +
     
     
    -647
    -648
    -649
    +662 +663 +664
    -
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 647
    +      
    # File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 662
     
     def to_enum(*a)
       raise NotImplementedError.new("fiber required for enumerator")
    @@ -7191,30 +521,6 @@ 

    -
    - -
    -

    - - #to_sObject - - - - - -

    -
    -

    15.3.1.3.46

    - - -
    -
    -
    - - -
    - -
    @@ -7232,20 +538,12 @@

    -

    call-seq: - obj.yield_self {|_obj|…} -> an_object - obj.then {|_obj|…} -> an_object

    + +

    call-seq: obj.yield_self {|_obj|…} -> an_object obj.then {|_obj|…} -> an_object

    -

    Yields obj and returns the result.

    +

    Yields obj and returns the result.

    - - - - - - - -
    ‘my string’.yield_self ss.upcase #=> “MY STRING”
    +

    ‘my string’.yield_self {|s|s.upcase} #=> “MY STRING”

    @@ -7253,8 +551,8 @@

    -
    - +

    +
    @@ -7282,11 +580,11 @@

    - + diff --git a/docs/api/KeyError.html b/docs/api/KeyError.html index cf9d964..9818c82 100644 --- a/docs/api/KeyError.html +++ b/docs/api/KeyError.html @@ -6,17 +6,17 @@ Exception: KeyError - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -78,9 +78,7 @@
    • Object
    • - - - + @@ -124,36 +122,14 @@ - - - - - - - - - - - -

      Method Summary

      - -

      Methods inherited from Exception

      -

      #backtrace, #exception, #initialize, #inspect, #message, #set_backtrace, #to_s

      -
      -

      Constructor Details

      - -

      This class inherits a constructor from Exception

      - -
      - - + diff --git a/docs/api/LocalJumpError.html b/docs/api/LocalJumpError.html index b9f1f44..5a9f5f2 100644 --- a/docs/api/LocalJumpError.html +++ b/docs/api/LocalJumpError.html @@ -6,17 +6,17 @@ Exception: LocalJumpError - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -73,14 +73,12 @@
      Inherits:
      - ScriptError + StandardError
      • Object
      • - - - + @@ -109,7 +107,8 @@

        Overview

        -

        ISO 15.2.25 says “LocalJumpError < StandardError”

        + +

        ISO 15.2.25

        @@ -117,8 +116,7 @@

        Overview

        -
        - +
        @@ -127,37 +125,16 @@

        Overview

        - - - - - - - - - - - - -

        Method Summary

        - -

        Methods inherited from Exception

        -

        #backtrace, #exception, #initialize, #inspect, #message, #set_backtrace, #to_s

        -
        -

        Constructor Details

        - -

        This class inherits a constructor from Exception

        - -
        +
        - +
        diff --git a/docs/api/Math.html b/docs/api/Math.html index e44bfdb..85298e6 100644 --- a/docs/api/Math.html +++ b/docs/api/Math.html @@ -6,17 +6,17 @@ Module: Math - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -119,7 +119,8 @@

        -

        Computes the arc cosine of x.

        +
        +

        Computes the arc cosine of x.

        @@ -142,7 +143,8 @@

        -

        Computes the inverse hyperbolic cosine of x.

        +
        +

        Computes the inverse hyperbolic cosine of x.

        @@ -165,7 +167,8 @@

        -

        Computes the arc sine of x.

        +
        +

        Computes the arc sine of x.

        @@ -188,7 +191,8 @@

        -

        Computes the inverse hyperbolic sine of x.

        +
        +

        Computes the inverse hyperbolic sine of x.

        @@ -211,7 +215,8 @@

        -

        Computes the arc tangent of x.

        +
        +

        Computes the arc tangent of x.

        @@ -234,7 +239,8 @@

        -

        Computes the arc tangent given y and x.

        +
        +

        Computes the arc tangent given y and x.

        @@ -257,7 +263,8 @@

        -

        Computes the inverse hyperbolic tangent of x.

        +
        +

        Computes the inverse hyperbolic tangent of x.

        @@ -280,7 +287,8 @@

        -

        Returns the cube root of numeric.

        +
        +

        Returns the cube root of numeric.

        @@ -303,7 +311,8 @@

        -

        Computes the cosine of x (expressed in radians).

        +
        +

        Computes the cosine of x (expressed in radians).

        @@ -326,7 +335,8 @@

        -

        Computes the hyperbolic cosine of x (expressed in radians).

        +
        +

        Computes the hyperbolic cosine of x (expressed in radians).

        @@ -349,7 +359,8 @@

        -

        Calculates the error function of x.

        +
        +

        Calculates the error function of x.

        @@ -372,7 +383,8 @@

        -

        Calculates the complementary error function of x.

        +
        +

        Calculates the complementary error function of x.

        @@ -395,7 +407,8 @@

        -

        Returns e**x.

        +
        +

        Returns e**x.

        @@ -418,7 +431,8 @@

        -

        Returns a two-element array containing the normalized fraction (a Float) and exponent (a Fixnum) of numeric.

        +
        +

        Returns a two-element array containing the normalized fraction (a Float) and exponent (a Integer) of numeric.

        @@ -441,7 +455,8 @@

        -

        Returns sqrt(x2 + y2), the hypotenuse of a right-angled triangle with sides x and y.

        +
        +

        Returns sqrt(x2 + y2), the hypotenuse of a right-angled triangle with sides x and y.

        @@ -464,7 +479,8 @@

        -

        Returns the value of flt*(2**int).

        +
        +

        Returns the value of flt(2*int).

        @@ -487,7 +503,8 @@

        -

        Returns the natural logarithm of numeric.

        +
        +

        Returns the natural logarithm of numeric.

        @@ -510,7 +527,8 @@

        -

        Returns the base 10 logarithm of numeric.

        +
        +

        Returns the base 10 logarithm of numeric.

        @@ -533,7 +551,8 @@

        -

        Returns the base 2 logarithm of numeric.

        +
        +

        Returns the base 2 logarithm of numeric.

        @@ -556,7 +575,8 @@

        -

        Computes the sine of x (expressed in radians).

        +
        +

        Computes the sine of x (expressed in radians).

        @@ -579,7 +599,8 @@

        -

        Computes the hyperbolic sine of x (expressed in radians).

        +
        +

        Computes the hyperbolic sine of x (expressed in radians).

        @@ -602,7 +623,8 @@

        -

        Returns the square root of numeric.

        +
        +

        Returns the square root of numeric.

        @@ -625,7 +647,8 @@

        -

        Returns the tangent of x (expressed in radians).

        +
        +

        Returns the tangent of x (expressed in radians).

        @@ -648,7 +671,8 @@

        -

        Computes the hyperbolic tangent of x (expressed in radians).

        +
        +

        Computes the hyperbolic tangent of x (expressed in radians).

        @@ -674,7 +698,8 @@

        -

        Computes the arc cosine of x. Returns 0..PI.

        + +

        Computes the arc cosine of x. Returns 0..PI.

        @@ -685,7 +710,6 @@

        -

        @@ -704,42 +728,40 @@

      - - + + + + - -
       
       
      -268
      -269
      -270
      -271
      -272
      -273
      -274
      -275
      -276
      -277
      -278
      -279
      -280
      +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265
      -
      # File 'mrbgems/mruby-math/src/math.c', line 268
      +      
      # File 'mrbgems/mruby-math/src/math.c', line 254
       
       static mrb_value
       math_acos(mrb_state *mrb, mrb_value obj)
       {
      -  mrb_float x;
      +  mrb_float x = get_float_arg(mrb);
       
      -  mrb_get_args(mrb, "f", &x);
         if (x < -1.0 || x > 1.0) {
           domain_error(mrb, "acos");
         }
      @@ -763,7 +785,8 @@ 

      -

      Computes the inverse hyperbolic cosine of x.

      + +

      Computes the inverse hyperbolic cosine of x.

      @@ -774,7 +797,6 @@

      -

      @@ -793,42 +815,40 @@

      -

      - + + - - + +
       
       
      -416
      -417
      -418
      -419
      -420
      -421
      -422
      -423
      -424
      -425
      -426
      -427
      -428
      +378 +379 +380 +381 +382 +383 +384 +385 +386 +387 +388 +389
      -
      # File 'mrbgems/mruby-math/src/math.c', line 416
      +      
      # File 'mrbgems/mruby-math/src/math.c', line 378
       
       static mrb_value
       math_acosh(mrb_state *mrb, mrb_value obj)
       {
      -  mrb_float x;
      +  mrb_float x = get_float_arg(mrb);
       
      -  mrb_get_args(mrb, "f", &x);
         if (x < 1.0) {
           domain_error(mrb, "acosh");
         }
      @@ -852,7 +872,8 @@ 

      -

      Computes the arc sine of x.

      + +

      Computes the arc sine of x.

      @@ -863,7 +884,6 @@

      -

      @@ -882,8 +902,8 @@

      -

      - + +

      Returns:

      @@ -897,44 +917,43 @@

      -

      computed value between -(PI/2) and (PI/2).

      +
      +

      computed value between -(PI/2) and (PI/2).

      -
      - + +
       
       
      -248
      -249
      -250
      -251
      -252
      -253
      -254
      -255
      -256
      -257
      -258
      -259
      -260
      +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246
      -
      # File 'mrbgems/mruby-math/src/math.c', line 248
      +      
      # File 'mrbgems/mruby-math/src/math.c', line 235
       
       static mrb_value
       math_asin(mrb_state *mrb, mrb_value obj)
       {
      -  mrb_float x;
      +  mrb_float x = get_float_arg(mrb);
       
      -  mrb_get_args(mrb, "f", &x);
         if (x < -1.0 || x > 1.0) {
           domain_error(mrb, "asin");
         }
      @@ -958,7 +977,8 @@ 

      -

      Computes the inverse hyperbolic sine of x.

      + +

      Computes the inverse hyperbolic sine of x.

      @@ -969,7 +989,6 @@

      -

      @@ -988,43 +1007,33 @@

      -

      - + + - - + + @@ -1043,7 +1052,8 @@

      -

      Computes the arc tangent of x. Returns -(PI/2) .. (PI/2).

      + +

      Computes the arc tangent of x. Returns -(PI/2) .. (PI/2).

      @@ -1054,7 +1064,6 @@

      -

      @@ -1073,41 +1082,33 @@

      -

      - + + - - + +
       
       
      -398
      -399
      -400
      -401
      -402
      -403
      -404
      -405
      -406
      -407
      -408
      +365 +366 +367 +368 +369 +370
      -
      # File 'mrbgems/mruby-math/src/math.c', line 398
      +      
      # File 'mrbgems/mruby-math/src/math.c', line 365
       
       static mrb_value
       math_asinh(mrb_state *mrb, mrb_value obj)
       {
      -  mrb_float x;
      -
      -  mrb_get_args(mrb, "f", &x);
      -
      -  x = asinh(x);
      -
      +  mrb_float x = asinh(get_float_arg(mrb));
         return mrb_float_value(mrb, x);
       }
      @@ -1126,19 +1127,10 @@

      -

      Computes the arc tangent given y and x. Returns --PI..PI.

      + +

      Computes the arc tangent given y and x. Returns -PI..PI.

      -

      Math.atan2(-0.0, -1.0) #=> -3.141592653589793 - Math.atan2(-1.0, -1.0) #=> -2.356194490192345 - Math.atan2(-1.0, 0.0) #=> -1.5707963267948966 - Math.atan2(-1.0, 1.0) #=> -0.7853981633974483 - Math.atan2(-0.0, 1.0) #=> -0.0 - Math.atan2(0.0, 1.0) #=> 0.0 - Math.atan2(1.0, 1.0) #=> 0.7853981633974483 - Math.atan2(1.0, 0.0) #=> 1.5707963267948966 - Math.atan2(1.0, -1.0) #=> 2.356194490192345 - Math.atan2(0.0, -1.0) #=> 3.141592653589793

      +

      Math.atan2(-0.0, -1.0) #=> -3.141592653589793 Math.atan2(-1.0, -1.0) #=> -2.356194490192345 Math.atan2(-1.0, 0.0) #=> -1.5707963267948966 Math.atan2(-1.0, 1.0) #=> -0.7853981633974483 Math.atan2(-0.0, 1.0) #=> -0.0 Math.atan2(0.0, 1.0) #=> 0.0 Math.atan2(1.0, 1.0) #=> 0.7853981633974483 Math.atan2(1.0, 0.0) #=> 1.5707963267948966 Math.atan2(1.0, -1.0) #=> 2.356194490192345 Math.atan2(0.0, -1.0) #=> 3.141592653589793

      @@ -1149,7 +1141,6 @@

      -

      @@ -1168,32 +1159,32 @@

      -

      - + + + + - -
       
       
      -288
      -289
      -290
      -291
      -292
      -293
      -294
      -295
      -296
      -297
      +273 +274 +275 +276 +277 +278
      -
      # File 'mrbgems/mruby-math/src/math.c', line 288
      +      
      # File 'mrbgems/mruby-math/src/math.c', line 273
       
       static mrb_value
       math_atan(mrb_state *mrb, mrb_value obj)
       {
      -  mrb_float x;
      -
      -  mrb_get_args(mrb, "f", &x);
      -  x = atan(x);
      -
      +  mrb_float x = atan(get_float_arg(mrb));
         return mrb_float_value(mrb, x);
       }
       
       
      -318
      -319
      -320
      -321
      -322
      -323
      -324
      -325
      -326
      -327
      +299 +300 +301 +302 +303 +304 +305 +306 +307 +308
      -
      # File 'mrbgems/mruby-math/src/math.c', line 318
      +      
      # File 'mrbgems/mruby-math/src/math.c', line 299
       
       static mrb_value
       math_atan2(mrb_state *mrb, mrb_value obj)
      @@ -1221,7 +1212,8 @@ 

      -

      Computes the inverse hyperbolic tangent of x.

      + +

      Computes the inverse hyperbolic tangent of x.

      @@ -1232,7 +1224,6 @@

      -

      @@ -1251,42 +1242,40 @@

      -

      - + + + + - -
       
       
      -436
      -437
      -438
      -439
      -440
      -441
      -442
      -443
      -444
      -445
      -446
      -447
      -448
      +397 +398 +399 +400 +401 +402 +403 +404 +405 +406 +407 +408
      -
      # File 'mrbgems/mruby-math/src/math.c', line 436
      +      
      # File 'mrbgems/mruby-math/src/math.c', line 397
       
       static mrb_value
       math_atanh(mrb_state *mrb, mrb_value obj)
       {
      -  mrb_float x;
      +  mrb_float x = get_float_arg(mrb);
       
      -  mrb_get_args(mrb, "f", &x);
         if (x < -1.0 || x > 1.0) {
           domain_error(mrb, "atanh");
         }
      @@ -1310,31 +1299,10 @@ 

      -

      Returns the cube root of numeric.

      + +

      Returns the cube root of numeric.

      -

      -9.upto(9) {|x| - p [x, Math.cbrt(x), Math.cbrt(x)**3] - } - #=> - [-9, -2.0800838230519, -9.0] - [-8, -2.0, -8.0] - [-7, -1.91293118277239, -7.0] - [-6, -1.81712059283214, -6.0] - [-5, -1.7099759466767, -5.0] - [-4, -1.5874010519682, -4.0] - [-3, -1.44224957030741, -3.0] - [-2, -1.25992104989487, -2.0] - [-1, -1.0, -1.0] - [0, 0.0, 0.0] - [1, 1.0, 1.0] - [2, 1.25992104989487, 2.0] - [3, 1.44224957030741, 3.0] - [4, 1.5874010519682, 4.0] - [5, 1.7099759466767, 5.0] - [6, 1.81712059283214, 6.0] - [7, 1.91293118277239, 7.0] - [8, 2.0, 8.0] - [9, 2.0800838230519, 9.0]

      +

      -9.upto(9) {|x| p [x, Math.cbrt(x), Math.cbrt(x)**3] } #=> [-9, -2.0800838230519, -9.0] [-8, -2.0, -8.0] [-7, -1.91293118277239, -7.0] [-6, -1.81712059283214, -6.0] [-5, -1.7099759466767, -5.0] [-4, -1.5874010519682, -4.0] [-3, -1.44224957030741, -3.0] [-2, -1.25992104989487, -2.0] [-1, -1.0, -1.0] [0, 0.0, 0.0] [1, 1.0, 1.0] [2, 1.25992104989487, 2.0] [3, 1.44224957030741, 3.0] [4, 1.5874010519682, 4.0] [5, 1.7099759466767, 5.0] [6, 1.81712059283214, 6.0] [7, 1.91293118277239, 7.0] [8, 2.0, 8.0] [9, 2.0800838230519, 9.0]

      @@ -1345,7 +1313,6 @@

      -

      @@ -1364,41 +1331,33 @@

      -

      - + + - - + + @@ -1417,8 +1376,8 @@

      -

      Computes the cosine of x (expressed in radians). Returns --1..1.

      + +

      Computes the cosine of x (expressed in radians). Returns -1..1.

      @@ -1429,7 +1388,6 @@

      -

      @@ -1448,41 +1406,33 @@

      -

      - + + + + - -
       
       
      -615
      -616
      -617
      -618
      -619
      -620
      -621
      -622
      -623
      -624
      +568 +569 +570 +571 +572 +573
      -
      # File 'mrbgems/mruby-math/src/math.c', line 615
      +      
      # File 'mrbgems/mruby-math/src/math.c', line 568
       
       static mrb_value
       math_cbrt(mrb_state *mrb, mrb_value obj)
       {
      -  mrb_float x;
      -
      -  mrb_get_args(mrb, "f", &x);
      -  x = cbrt(x);
      -
      +  mrb_float x = cbrt(get_float_arg(mrb));
         return mrb_float_value(mrb, x);
       }
      @@ -1501,7 +1451,8 @@

      -

      Computes the hyperbolic cosine of x (expressed in radians).

      + +

      Computes the hyperbolic cosine of x (expressed in radians).

      @@ -1512,7 +1463,6 @@

      -

      @@ -1531,41 +1481,33 @@

      -

      - + + - - + +
       
       
      -209
      -210
      -211
      -212
      -213
      -214
      -215
      -216
      -217
      -218
      +204 +205 +206 +207 +208 +209
      -
      # File 'mrbgems/mruby-math/src/math.c', line 209
      +      
      # File 'mrbgems/mruby-math/src/math.c', line 204
       
       static mrb_value
       math_cos(mrb_state *mrb, mrb_value obj)
       {
      -  mrb_float x;
      -
      -  mrb_get_args(mrb, "f", &x);
      -  x = cos(x);
      -
      +  mrb_float x = cos(get_float_arg(mrb));
         return mrb_float_value(mrb, x);
       }
      @@ -1584,7 +1526,8 @@

      -

      Calculates the error function of x.

      + +

      Calculates the error function of x.

      @@ -1595,7 +1538,6 @@

      -

      @@ -1614,41 +1556,33 @@

      -

      - + + - - + +
       
       
      -358
      -359
      -360
      -361
      -362
      -363
      -364
      -365
      -366
      -367
      +333 +334 +335 +336 +337 +338
      -
      # File 'mrbgems/mruby-math/src/math.c', line 358
      +      
      # File 'mrbgems/mruby-math/src/math.c', line 333
       
       static mrb_value
       math_cosh(mrb_state *mrb, mrb_value obj)
       {
      -  mrb_float x;
      -
      -  mrb_get_args(mrb, "f", &x);
      -  x = cosh(x);
      -
      +  mrb_float x = cosh(get_float_arg(mrb));
         return mrb_float_value(mrb, x);
       }
      @@ -1667,7 +1601,8 @@

      -

      Calculates the complementary error function of x.

      + +

      Calculates the complementary error function of x.

      @@ -1678,7 +1613,6 @@

      -

      @@ -1697,41 +1631,33 @@

      -

      - + + + + - -
       
       
      -697
      -698
      -699
      -700
      -701
      -702
      -703
      -704
      -705
      -706
      +645 +646 +647 +648 +649 +650
      -
      # File 'mrbgems/mruby-math/src/math.c', line 697
      +      
      # File 'mrbgems/mruby-math/src/math.c', line 645
       
       static mrb_value
       math_erf(mrb_state *mrb, mrb_value obj)
       {
      -  mrb_float x;
      -
      -  mrb_get_args(mrb, "f", &x);
      -  x = erf(x);
      -
      +  mrb_float x = erf(get_float_arg(mrb));
         return mrb_float_value(mrb, x);
       }
      @@ -1750,11 +1676,10 @@

      -

      Returns e**x.

      + +

      Returns e**x.

      -

      Math.exp(0) #=> 1.0 - Math.exp(1) #=> 2.718281828459045 - Math.exp(1.5) #=> 4.4816890703380645

      +

      Math.exp(0) #=> 1.0 Math.exp(1) #=> 2.718281828459045 Math.exp(1.5) #=> 4.4816890703380645

      @@ -1765,7 +1690,6 @@

      -

      @@ -1784,41 +1708,33 @@

      -

      - + + - - + +
       
       
      -715
      -716
      -717
      -718
      -719
      -720
      -721
      -722
      -723
      -724
      +659 +660 +661 +662 +663 +664
      -
      # File 'mrbgems/mruby-math/src/math.c', line 715
      +      
      # File 'mrbgems/mruby-math/src/math.c', line 659
       
       static mrb_value
       math_erfc(mrb_state *mrb, mrb_value obj)
       {
      -  mrb_float x;
      -
      -  mrb_get_args(mrb, "f", &x);
      -  x = erfc(x);
      -
      +  mrb_float x = erfc(get_float_arg(mrb));
         return mrb_float_value(mrb, x);
       }
      @@ -1837,12 +1753,10 @@

      -

      Returns a two-element array containing the normalized fraction (a -Float) and exponent (a Fixnum) of -numeric.

      + +

      Returns a two-element array containing the normalized fraction (a Float) and exponent (a Integer) of numeric.

      -

      fraction, exponent = Math.frexp(1234) #=> [0.6025390625, 11] - fraction * 2**exponent #=> 1234.0

      +

      fraction, exponent = Math.frexp(1234) #=> [0.6025390625, 11] fraction * 2**exponent #=> 1234.0

      @@ -1853,7 +1767,6 @@

      -

      @@ -1872,41 +1785,39 @@

      -

      - + + + + - -
       
       
      -465
      -466
      -467
      -468
      -469
      -470
      -471
      -472
      -473
      -474
      +425 +426 +427 +428 +429 +430
      -
      # File 'mrbgems/mruby-math/src/math.c', line 465
      +      
      # File 'mrbgems/mruby-math/src/math.c', line 425
       
       static mrb_value
       math_exp(mrb_state *mrb, mrb_value obj)
       {
      -  mrb_float x;
      -
      -  mrb_get_args(mrb, "f", &x);
      -  x = exp(x);
      -
      +  mrb_float x = exp(get_float_arg(mrb));
         return mrb_float_value(mrb, x);
       }
       
       
      -638
      -639
      -640
      -641
      -642
      -643
      -644
      -645
      -646
      -647
      -648
      +587 +588 +589 +590 +591 +592 +593 +594 +595 +596
      -
      # File 'mrbgems/mruby-math/src/math.c', line 638
      +      
      # File 'mrbgems/mruby-math/src/math.c', line 587
       
       static mrb_value
       math_frexp(mrb_state *mrb, mrb_value obj)
       {
      -  mrb_float x;
      +  mrb_float x = get_float_arg(mrb);
         int exp;
       
      -  mrb_get_args(mrb, "f", &x);
         x = frexp(x, &exp);
       
         return mrb_assoc_new(mrb, mrb_float_value(mrb, x), mrb_fixnum_value(exp));
      @@ -1927,10 +1838,10 @@ 

      -

      Returns sqrt(x2 + y2), the hypotenuse of a right-angled triangle -with sides x and y.

      + +

      Returns sqrt(x2 + y2), the hypotenuse of a right-angled triangle with sides x and y.

      -

      Math.hypot(3, 4) #=> 5.0

      +

      Math.hypot(3, 4) #=> 5.0

      @@ -1941,7 +1852,6 @@

      -

      @@ -1960,32 +1870,32 @@

      -

      - + + - - + +
       
       
      -680
      -681
      -682
      -683
      -684
      -685
      -686
      -687
      -688
      -689
      +628 +629 +630 +631 +632 +633 +634 +635 +636 +637
      -
      # File 'mrbgems/mruby-math/src/math.c', line 680
      +      
      # File 'mrbgems/mruby-math/src/math.c', line 628
       
       static mrb_value
       math_hypot(mrb_state *mrb, mrb_value obj)
      @@ -2013,10 +1923,10 @@ 

      -

      Returns the value of flt*(2**int).

      + +

      Returns the value of flt(2*int).

      -

      fraction, exponent = Math.frexp(1234) - Math.ldexp(fraction, exponent) #=> 1234.0

      +

      fraction, exponent = Math.frexp(1234) Math.ldexp(fraction, exponent) #=> 1234.0

      @@ -2027,7 +1937,6 @@

      -

      @@ -2046,33 +1955,33 @@

      -

      - + + + + - -
       
       
      -659
      -660
      -661
      -662
      -663
      -664
      -665
      -666
      -667
      -668
      -669
      +607 +608 +609 +610 +611 +612 +613 +614 +615 +616 +617
      -
      # File 'mrbgems/mruby-math/src/math.c', line 659
      +      
      # File 'mrbgems/mruby-math/src/math.c', line 607
       
       static mrb_value
       math_ldexp(mrb_state *mrb, mrb_value obj)
      @@ -2105,14 +2014,10 @@ 

      -

      Returns the natural logarithm of numeric. -If additional second argument is given, it will be the base -of logarithm.

      + +

      Returns the natural logarithm of numeric. If additional second argument is given, it will be the base of logarithm.

      -

      Math.log(1) #=> 0.0 - Math.log(Math::E) #=> 1.0 - Math.log(Math::E**3) #=> 3.0 - Math.log(12,3) #=> 2.2618595071429146

      +

      Math.log(1) #=> 0.0 Math.log(Math::E) #=> 1.0 Math.log(Math::E**3) #=> 3.0 Math.log(12,3) #=> 2.2618595071429146

      @@ -2129,7 +2034,6 @@

      -

      @@ -2148,8 +2052,8 @@

      -

      - + + @@ -2160,7 +2064,6 @@

      -
      @@ -2179,44 +2082,44 @@

      -

      - + + - - + +
       
       
      -491
      -492
      -493
      -494
      -495
      -496
      -497
      -498
      -499
      -500
      -501
      -502
      -503
      -504
      -505
      -506
      -507
      -508
      -509
      +447 +448 +449 +450 +451 +452 +453 +454 +455 +456 +457 +458 +459 +460 +461 +462 +463 +464 +465
      -
      # File 'mrbgems/mruby-math/src/math.c', line 491
      +      
      # File 'mrbgems/mruby-math/src/math.c', line 447
       
       static mrb_value
       math_log(mrb_state *mrb, mrb_value obj)
      @@ -2253,11 +2156,10 @@ 

      -

      Returns the base 10 logarithm of numeric.

      + +

      Returns the base 10 logarithm of numeric.

      -

      Math.log10(1) #=> 0.0 - Math.log10(10) #=> 1.0 - Math.log10(10**100) #=> 100.0

      +

      Math.log10(1) #=> 0.0 Math.log10(10) #=> 1.0 Math.log10(10**100) #=> 100.0

      @@ -2268,7 +2170,6 @@

      -

      @@ -2287,42 +2188,40 @@

      -

      - + - - + + +
       
       
      -548
      -549
      -550
      -551
      -552
      -553
      -554
      -555
      -556
      -557
      -558
      -559
      -560
      +503 +504 +505 +506 +507 +508 +509 +510 +511 +512 +513 +514
      -
      # File 'mrbgems/mruby-math/src/math.c', line 548
      +      
      # File 'mrbgems/mruby-math/src/math.c', line 503
       
       static mrb_value
       math_log10(mrb_state *mrb, mrb_value obj)
       {
      -  mrb_float x;
      +  mrb_float x = get_float_arg(mrb);
       
      -  mrb_get_args(mrb, "f", &x);
         if (x < 0.0) {
           domain_error(mrb, "log10");
         }
      @@ -2346,12 +2245,10 @@ 

      -

      Returns the base 2 logarithm of numeric.

      + +

      Returns the base 2 logarithm of numeric.

      -

      Math.log2(1) #=> 0.0 - Math.log2(2) #=> 1.0 - Math.log2(32768) #=> 15.0 - Math.log2(65536) #=> 16.0

      +

      Math.log2(1) #=> 0.0 Math.log2(2) #=> 1.0 Math.log2(32768) #=> 15.0 Math.log2(65536) #=> 16.0

      @@ -2362,7 +2259,6 @@

      -

      @@ -2381,42 +2277,40 @@

      -

      - + + - - + +
       
       
      -523
      -524
      -525
      -526
      -527
      -528
      -529
      -530
      -531
      -532
      -533
      -534
      -535
      +479 +480 +481 +482 +483 +484 +485 +486 +487 +488 +489 +490
      -
      # File 'mrbgems/mruby-math/src/math.c', line 523
      +      
      # File 'mrbgems/mruby-math/src/math.c', line 479
       
       static mrb_value
       math_log2(mrb_state *mrb, mrb_value obj)
       {
      -  mrb_float x;
      +  mrb_float x = get_float_arg(mrb);
       
      -  mrb_get_args(mrb, "f", &x);
         if (x < 0.0) {
           domain_error(mrb, "log2");
         }
      @@ -2440,8 +2334,8 @@ 

      -

      Computes the sine of x (expressed in radians). Returns --1..1.

      + +

      Computes the sine of x (expressed in radians). Returns -1..1.

      @@ -2452,7 +2346,6 @@

      -

      @@ -2471,41 +2364,33 @@

      -

      - + + + + - - @@ -2524,8 +2409,8 @@

      -

      Computes the hyperbolic sine of x (expressed in -radians).

      + +

      Computes the hyperbolic sine of x (expressed in radians).

      @@ -2536,7 +2421,6 @@

      -

      @@ -2555,41 +2439,33 @@

      -

      - + + + + - -
       
       
      +190
       191
       192
       193
       194
      -195
      -196
      -197
      -198
      -199
      -200
      +195
      -
      # File 'mrbgems/mruby-math/src/math.c', line 191
      +      
      # File 'mrbgems/mruby-math/src/math.c', line 190
       
       static mrb_value
       math_sin(mrb_state *mrb, mrb_value obj)
       {
      -  mrb_float x;
      -
      -  mrb_get_args(mrb, "f", &x);
      -  x = sin(x);
      -
      +  mrb_float x = sin(get_float_arg(mrb));
         return mrb_float_value(mrb, x);
       }
      @@ -2608,7 +2484,8 @@

      -

      Returns the square root of numeric.

      + +

      Returns the square root of numeric.

      @@ -2619,7 +2496,6 @@

      -

      @@ -2638,42 +2514,40 @@

      -

      - + + - - + +
       
       
      -341
      -342
      -343
      -344
      -345
      -346
      -347
      -348
      -349
      -350
      +320 +321 +322 +323 +324 +325
      -
      # File 'mrbgems/mruby-math/src/math.c', line 341
      +      
      # File 'mrbgems/mruby-math/src/math.c', line 320
       
       static mrb_value
       math_sinh(mrb_state *mrb, mrb_value obj)
       {
      -  mrb_float x;
      -
      -  mrb_get_args(mrb, "f", &x);
      -  x = sinh(x);
      -
      +  mrb_float x = sinh(get_float_arg(mrb));
         return mrb_float_value(mrb, x);
       }
       
       
      -569
      -570
      -571
      -572
      -573
      -574
      -575
      -576
      -577
      -578
      -579
      -580
      -581
      +523 +524 +525 +526 +527 +528 +529 +530 +531 +532 +533 +534
      -
      # File 'mrbgems/mruby-math/src/math.c', line 569
      +      
      # File 'mrbgems/mruby-math/src/math.c', line 523
       
       static mrb_value
       math_sqrt(mrb_state *mrb, mrb_value obj)
       {
      -  mrb_float x;
      +  mrb_float x = get_float_arg(mrb);
       
      -  mrb_get_args(mrb, "f", &x);
         if (x < 0.0) {
           domain_error(mrb, "sqrt");
         }
      @@ -2697,7 +2571,8 @@ 

      -

      Returns the tangent of x (expressed in radians).

      + +

      Returns the tangent of x (expressed in radians).

      @@ -2708,7 +2583,6 @@

      -

      @@ -2727,41 +2601,33 @@

      -

      - + + - - + + @@ -2780,8 +2646,8 @@

      -

      Computes the hyperbolic tangent of x (expressed in -radians).

      + +

      Computes the hyperbolic tangent of x (expressed in radians).

      @@ -2792,7 +2658,6 @@

      -

      @@ -2811,41 +2676,33 @@

      -

      - + + - - + +
       
       
      -226
      -227
      -228
      -229
      -230
      -231
      -232
      -233
      -234
      -235
      +217 +218 +219 +220 +221 +222
      -
      # File 'mrbgems/mruby-math/src/math.c', line 226
      +      
      # File 'mrbgems/mruby-math/src/math.c', line 217
       
       static mrb_value
       math_tan(mrb_state *mrb, mrb_value obj)
       {
      -  mrb_float x;
      -
      -  mrb_get_args(mrb, "f", &x);
      -  x = tan(x);
      -
      +  mrb_float x = tan(get_float_arg(mrb));
         return mrb_float_value(mrb, x);
       }
      @@ -2857,11 +2714,11 @@

      - + diff --git a/docs/api/Method.html b/docs/api/Method.html index 916e4e2..8734884 100644 --- a/docs/api/Method.html +++ b/docs/api/Method.html @@ -6,17 +6,17 @@ Class: Method - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -98,9 +98,7 @@
      Defined in:
      -
      mrbgems/mruby-method/src/method.c,
      - mrbgems/mruby-method/mrblib/method.rb
      -
      +
      mrbgems/mruby-method/mrblib/method.rb
      @@ -137,8 +135,7 @@

      -
      -
      +
      @@ -146,1129 +143,60 @@

    • - #== ⇒ Object - - - - - - - - - - - - - -
      -
      - -
    • - - -
    • - - - #>>(other) ⇒ Object - - - - - - - - - - - - - -
      -
      - -
    • - - -
    • - - - #[] ⇒ Object - - - - - - - - - - - - - -
      -
      - -
    • - - -
    • - - - #arity ⇒ Object - - - - - - - - - - - - - -
      -
      - -
    • - - -
    • - - - #call ⇒ Object - - - - - - - - - - - - - -
      -
      - -
    • - - -
    • - - - #eql? ⇒ Boolean - - - - - - - - - - - - - -
      -
      - -
    • - - -
    • - - - #inspect ⇒ Object - - - - - - - - - - - - - -
      -
      - -
    • - - -
    • - - - #name ⇒ Object - - - - - - - - - - - - - -
      -
      - -
    • - - -
    • - - - #owner ⇒ Object - - - - - - - - - - - - - -
      -
      - -
    • - - -
    • - - - #parameters ⇒ Object - - - - - - - - - - - - - -
      -
      - -
    • - - -
    • - - - #receiver ⇒ Object - - - - - - - - - - - - - -
      -
      - -
    • - - -
    • - - - #source_location ⇒ Object - - - - - - - - - - - - - -
      -
      - -
    • - - -
    • - - - #super_method ⇒ Object - - - - - - - - - - - - - -
      -
      - -
    • - - -
    • - - - #to_proc ⇒ Object - - - - - - - - - - - - - -
      -
      - -
    • - - -
    • - - - #to_s ⇒ Object - - - - - - - - - - - - - -
      -
      - -
    • - - -
    • - - - #unbind ⇒ Object - - - - - - - - - - - - - -
      -
      - -
    • - - - - - - - -
      -

      Instance Method Details

      - - -
      -

      - - #<<(other) ⇒ Object - - - - - -

       
       
      -376
      -377
      -378
      -379
      -380
      -381
      -382
      -383
      -384
      -385
      +347 +348 +349 +350 +351 +352
      -
      # File 'mrbgems/mruby-math/src/math.c', line 376
      +      
      # File 'mrbgems/mruby-math/src/math.c', line 347
       
       static mrb_value
       math_tanh(mrb_state *mrb, mrb_value obj)
       {
      -  mrb_float x;
      -
      -  mrb_get_args(mrb, "f", &x);
      -  x = tanh(x);
      -
      +  mrb_float x = tanh(get_float_arg(mrb));
         return mrb_float_value(mrb, x);
       }
      - - - - -
      -
      -
      -
      -9
      -10
      -11
      -
      -
      # File 'mrbgems/mruby-method/mrblib/method.rb', line 9
      -
      -def <<(other)
      -  ->(*args, &block) { call(other.call(*args, &block)) }
      -end
      -
      - - -
      -

      - - #==Object - - - - - -

      - - - - -
      -
      -
      -
      -51
      -52
      -53
      -54
      -55
      -56
      -57
      -58
      -59
      -60
      -61
      -62
      -63
      -64
      -65
      -66
      -67
      -68
      -69
      -70
      -71
      -72
      -73
      -74
      -75
      -76
      -77
      -78
      -79
      -80
      -81
      -82
      -83
      -84
      -85
      -86
      -87
      -88
      -89
      -90
      -91
      -92
      -93
      -94
      -95
      -96
      -97
      -98
      -99
      -100
      -101
      -102
      -103
      -104
      -105
      -106
      -107
      -
      -
      # File 'mrbgems/mruby-method/src/method.c', line 51
      -
      -static mrb_value
      -method_eql(mrb_state *mrb, mrb_value self)
      -{
      -  mrb_value other, receiver, orig_proc, other_proc;
      -  struct RClass *owner, *klass;
      -  struct RProc *orig_rproc, *other_rproc;
      -
      -  mrb_get_args(mrb, "o", &other);
      -  if (!mrb_obj_is_instance_of(mrb, other, mrb_class(mrb, self)))
      -    return mrb_false_value();
      -
      -  if (mrb_class(mrb, self) != mrb_class(mrb, other))
      -    return mrb_false_value();
      -
      -  klass = mrb_class_ptr(IV_GET(self, "_klass"));
      -  if (klass != mrb_class_ptr(IV_GET(other, "_klass")))
      -    return mrb_false_value();
      -
      -  owner = mrb_class_ptr(IV_GET(self, "_owner"));
      -  if (owner != mrb_class_ptr(IV_GET(other, "_owner")))
      -    return mrb_false_value();
      -
      -  receiver = IV_GET(self, "_recv");
      -  if (!mrb_obj_equal(mrb, receiver, IV_GET(other, "_recv")))
      -    return mrb_false_value();
      -
      -  orig_proc = IV_GET(self, "_proc");
      -  other_proc = IV_GET(other, "_proc");
      -  if (mrb_nil_p(orig_proc) && mrb_nil_p(other_proc)) {
      -    if (mrb_symbol(IV_GET(self, "_name")) == mrb_symbol(IV_GET(other, "_name")))
      -      return mrb_true_value();
      -    else
      -      return mrb_false_value();
      -  }
      -
      -  if (mrb_nil_p(orig_proc))
      -    return mrb_false_value();
      -  if (mrb_nil_p(other_proc))
      -    return mrb_false_value();
      -
      -  orig_rproc = mrb_proc_ptr(orig_proc);
      -  other_rproc = mrb_proc_ptr(other_proc);
      -  if (MRB_PROC_CFUNC_P(orig_rproc)) {
      -    if (!MRB_PROC_CFUNC_P(other_rproc))
      -      return mrb_false_value();
      -    if (orig_rproc->body.func != other_rproc->body.func)
      -      return mrb_false_value();
      -  }
      -  else {
      -    if (MRB_PROC_CFUNC_P(other_rproc))
      -      return mrb_false_value();
      -    if (orig_rproc->body.irep != other_rproc->body.irep)
      -      return mrb_false_value();
      -  }
      -
      -  return mrb_true_value();
      -}
      -
      -
      - -
      -

      - - #>>(other) ⇒ Object - - - - - -

      - - - - -
      -
      -
      -
      -13
      -14
      -15
      -
      -
      # File 'mrbgems/mruby-method/mrblib/method.rb', line 13
      -
      -def >>(other)
      -  ->(*args, &block) { other.call(call(*args, &block)) }
      -end
      -
      -
      - -
      -

      - - #[]Object - - - - - -

      - - - - -
      -
      -
      -
      -138
      -139
      -140
      -141
      -142
      -143
      -144
      -145
      -146
      -147
      -148
      -149
      -150
      -
      -
      # File 'mrbgems/mruby-method/src/method.c', line 138
      -
      -static mrb_value
      -method_call(mrb_state *mrb, mrb_value self)
      -{
      -  mrb_value proc = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_proc"));
      -  mrb_value name = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_name"));
      -  mrb_value recv = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_recv"));
      -  struct RClass *owner = mrb_class_ptr(mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_owner")));
      -  mrb_int argc;
      -  mrb_value *argv, block;
      -
      -  mrb_get_args(mrb, "*&", &argv, &argc, &block);
      -  return mcall(mrb, recv, proc, name, owner, argc, argv, block);
      -}
      -
      -
      + #>>(other) ⇒ Object -
      -

      - - #arityObject - - - - - -

      - - - - -
      -
      -
       
      -238
      -239
      -240
      -241
      -242
      -243
      -244
      -
      -
      # File 'mrbgems/mruby-method/src/method.c', line 238
      -
      -static mrb_value
      -method_arity(mrb_state *mrb, mrb_value self)
      -{
      -  mrb_value proc = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_proc"));
      -  mrb_int arity = mrb_nil_p(proc) ? -1 : mrb_proc_arity(mrb_proc_ptr(proc));
      -  return mrb_fixnum_value(arity);
      -}
      -
      -
      -
      -

      - - #callObject + - - -

      - - - - -
      -
      -
      -
      -138
      -139
      -140
      -141
      -142
      -143
      -144
      -145
      -146
      -147
      -148
      -149
      -150
      -
      -
      # File 'mrbgems/mruby-method/src/method.c', line 138
      -
      -static mrb_value
      -method_call(mrb_state *mrb, mrb_value self)
      -{
      -  mrb_value proc = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_proc"));
      -  mrb_value name = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_name"));
      -  mrb_value recv = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_recv"));
      -  struct RClass *owner = mrb_class_ptr(mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_owner")));
      -  mrb_int argc;
      -  mrb_value *argv, block;
      -
      -  mrb_get_args(mrb, "*&", &argv, &argc, &block);
      -  return mcall(mrb, recv, proc, name, owner, argc, argv, block);
      -}
      -
      -
      - -
      -

      - #eql?Boolean - - -

      -
      - - -
      -
      -
      -

      Returns:

      -
        - -
      • - - - (Boolean) - - - -
      • +
        -
      - -
      - - - - - - -
      -
      -
      -
      -51
      -52
      -53
      -54
      -55
      -56
      -57
      -58
      -59
      -60
      -61
      -62
      -63
      -64
      -65
      -66
      -67
      -68
      -69
      -70
      -71
      -72
      -73
      -74
      -75
      -76
      -77
      -78
      -79
      -80
      -81
      -82
      -83
      -84
      -85
      -86
      -87
      -88
      -89
      -90
      -91
      -92
      -93
      -94
      -95
      -96
      -97
      -98
      -99
      -100
      -101
      -102
      -103
      -104
      -105
      -106
      -107
      -
      -
      # File 'mrbgems/mruby-method/src/method.c', line 51
      -
      -static mrb_value
      -method_eql(mrb_state *mrb, mrb_value self)
      -{
      -  mrb_value other, receiver, orig_proc, other_proc;
      -  struct RClass *owner, *klass;
      -  struct RProc *orig_rproc, *other_rproc;
      -
      -  mrb_get_args(mrb, "o", &other);
      -  if (!mrb_obj_is_instance_of(mrb, other, mrb_class(mrb, self)))
      -    return mrb_false_value();
      -
      -  if (mrb_class(mrb, self) != mrb_class(mrb, other))
      -    return mrb_false_value();
      -
      -  klass = mrb_class_ptr(IV_GET(self, "_klass"));
      -  if (klass != mrb_class_ptr(IV_GET(other, "_klass")))
      -    return mrb_false_value();
      -
      -  owner = mrb_class_ptr(IV_GET(self, "_owner"));
      -  if (owner != mrb_class_ptr(IV_GET(other, "_owner")))
      -    return mrb_false_value();
      -
      -  receiver = IV_GET(self, "_recv");
      -  if (!mrb_obj_equal(mrb, receiver, IV_GET(other, "_recv")))
      -    return mrb_false_value();
      -
      -  orig_proc = IV_GET(self, "_proc");
      -  other_proc = IV_GET(other, "_proc");
      -  if (mrb_nil_p(orig_proc) && mrb_nil_p(other_proc)) {
      -    if (mrb_symbol(IV_GET(self, "_name")) == mrb_symbol(IV_GET(other, "_name")))
      -      return mrb_true_value();
      -    else
      -      return mrb_false_value();
      -  }
      -
      -  if (mrb_nil_p(orig_proc))
      -    return mrb_false_value();
      -  if (mrb_nil_p(other_proc))
      -    return mrb_false_value();
      -
      -  orig_rproc = mrb_proc_ptr(orig_proc);
      -  other_rproc = mrb_proc_ptr(other_proc);
      -  if (MRB_PROC_CFUNC_P(orig_rproc)) {
      -    if (!MRB_PROC_CFUNC_P(other_rproc))
      -      return mrb_false_value();
      -    if (orig_rproc->body.func != other_rproc->body.func)
      -      return mrb_false_value();
      -  }
      -  else {
      -    if (MRB_PROC_CFUNC_P(other_rproc))
      -      return mrb_false_value();
      -    if (orig_rproc->body.irep != other_rproc->body.irep)
      -      return mrb_false_value();
      -  }
      +
       
      -  return mrb_true_value();
      -}
      -
      -
      + +
    • + -
      -

      - - #inspectObject - - - - - -

      - - - - -
      -
      -
      -
      -287
      -288
      -289
      -290
      -291
      -292
      -293
      -294
      -295
      -296
      -297
      -298
      -299
      -300
      -301
      -302
      -303
      -304
      -305
      -306
      -307
      -308
      -309
      -310
      -311
      -312
      -313
      -
      -
      # File 'mrbgems/mruby-method/src/method.c', line 287
      -
      -static mrb_value
      -method_to_s(mrb_state *mrb, mrb_value self)
      -{
      -  mrb_value owner = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_owner"));
      -  mrb_value klass = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_klass"));
      -  mrb_value name = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_name"));
      -  mrb_value str = mrb_str_new_lit(mrb, "#<");
      -  struct RClass *rklass;
      -
      -  mrb_str_cat_cstr(mrb, str, mrb_obj_classname(mrb, self));
      -  mrb_str_cat_lit(mrb, str, ": ");
      -  rklass = mrb_class_ptr(klass);
      -  if (mrb_class_ptr(owner) == rklass) {
      -    mrb_str_concat(mrb, str, owner);
      -    mrb_str_cat_lit(mrb, str, "#");
      -    mrb_str_concat(mrb, str, name);
      -  }
      -  else {
      -    mrb_str_cat_cstr(mrb, str, mrb_class_name(mrb, rklass));
      -    mrb_str_cat_lit(mrb, str, "(");
      -    mrb_str_concat(mrb, str, owner);
      -    mrb_str_cat_lit(mrb, str, ")#");
      -    mrb_str_concat(mrb, str, name);
      -  }
      -  mrb_str_cat_lit(mrb, str, ">");
      -  return str;
      -}
      -
      -
      + #to_proc ⇒ Object -
      -

      - - #nameObject - - - - - -

      - - - - -
      -
      -
       
      -401
      -402
      -403
      -404
      -405
      -
      -
      # File 'mrbgems/mruby-method/src/method.c', line 401
      -
      -static mrb_value
      -method_name(mrb_state *mrb, mrb_value self)
      -{
      -  return mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_name"));
      -}
      -
      -
      -
      -

      - - #ownerObject + - - -

      - - - - -
      -
      -
      -
      -389
      -390
      -391
      -392
      -393
      -
      -
      # File 'mrbgems/mruby-method/src/method.c', line 389
      -
      -static mrb_value
      -method_owner(mrb_state *mrb, mrb_value self)
      -{
      -  return mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_owner"));
      -}
      -
      -
      - -
      -

      - #parametersObject - - -

      - - - - -
      -
      -
      -
      -265
      -266
      -267
      -268
      -269
      -270
      -271
      -272
      -273
      -274
      -275
      -276
      -277
      -278
      -279
      -280
      -281
      -282
      -283
      -284
      -285
      -
      -
      # File 'mrbgems/mruby-method/src/method.c', line 265
      -
      -static mrb_value
      -method_parameters(mrb_state *mrb, mrb_value self)
      -{
      -  mrb_value proc = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_proc"));
      -  struct RProc *rproc;
      -  struct RClass *orig;
      -  mrb_value ret;
      -
      -  if (mrb_nil_p(proc)) {
      -    mrb_value rest = mrb_symbol_value(mrb_intern_lit(mrb, "rest"));
      -    mrb_value arest = mrb_ary_new_from_values(mrb, 1, &rest);
      -    return mrb_ary_new_from_values(mrb, 1, &arest);
      -  }
       
      -  rproc = mrb_proc_ptr(proc);
      -  orig = rproc->c;
      -  rproc->c = mrb->proc_class;
      -  ret = mrb_funcall(mrb, proc, "parameters", 0);
      -  rproc->c = orig;
      -  return ret;
      -}
      -
      -
      - -
      -

      - #receiverObject +
      +

    • + + - - - - - - -
      -
       
       
      -395
      -396
      -397
      -398
      -399
      -
      -
      # File 'mrbgems/mruby-method/src/method.c', line 395
      +  
      +

      Instance Method Details

      -static mrb_value -method_receiver(mrb_state *mrb, mrb_value self) -{ - return mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_recv")); -}
      -
      - -
      -

      +
      +

      - #source_locationObject + #<<(other) ⇒ Object @@ -1280,55 +208,25 @@

       
       
      -246
      -247
      -248
      -249
      -250
      -251
      -252
      -253
      -254
      -255
      -256
      -257
      -258
      -259
      -260
      -261
      -262
      -263
      +9 +10 +11

      -
      # File 'mrbgems/mruby-method/src/method.c', line 246
      -
      -static mrb_value
      -method_source_location(mrb_state *mrb, mrb_value self)
      -{
      -  mrb_value proc = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_proc"));
      -  struct RProc *rproc;
      -  struct RClass *orig;
      -  mrb_value ret;
      -
      -  if (mrb_nil_p(proc))
      -    return mrb_nil_value();
      +      
      # File 'mrbgems/mruby-method/mrblib/method.rb', line 9
       
      -  rproc = mrb_proc_ptr(proc);
      -  orig = rproc->c;
      -  rproc->c = mrb->proc_class;
      -  ret = mrb_funcall(mrb, proc, "source_location", 0);
      -  rproc->c = orig;
      -  return ret;
      -}
      +def <<(other) + ->(*args, **opts, &block) { call(other.call(*args, **opts, &block)) } +end
      -

      +

      - #super_methodObject + #>>(other) ⇒ Object @@ -1340,90 +238,16 @@

       
       
      -197
      -198
      -199
      -200
      -201
      -202
      -203
      -204
      -205
      -206
      -207
      -208
      -209
      -210
      -211
      -212
      -213
      -214
      -215
      -216
      -217
      -218
      -219
      -220
      -221
      -222
      -223
      -224
      -225
      -226
      -227
      -228
      -229
      -230
      -231
      -232
      -233
      -234
      -235
      -236
      +13 +14 +15

      -
      # File 'mrbgems/mruby-method/src/method.c', line 197
      -
      -static mrb_value
      -method_super_method(mrb_state *mrb, mrb_value self)
      -{
      -  mrb_value recv = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_recv"));
      -  mrb_value klass = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_klass"));
      -  mrb_value owner = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_owner"));
      -  mrb_value name = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_name"));
      -  struct RClass *super, *rklass;
      -  struct RProc *proc;
      -  struct RObject *me;
      -
      -  switch (mrb_type(klass)) {
      -    case MRB_TT_SCLASS:
      -      super = mrb_class_ptr(klass)->super->super;
      -      break;
      -    case MRB_TT_ICLASS:
      -      super = mrb_class_ptr(klass)->super;
      -      break;
      -    default:
      -      super = mrb_class_ptr(owner)->super;
      -      break;
      -  }
      -
      -  proc = method_search_vm(mrb, &super, mrb_symbol(name));
      -  if (!proc)
      -    return mrb_nil_value();
      -
      -  rklass = super;
      -  while (super->tt == MRB_TT_ICLASS)
      -    super = super->c;
      -
      -  me = method_object_alloc(mrb, mrb_obj_class(mrb, self));
      -  mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_owner"), mrb_obj_value(super));
      -  mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_recv"), recv);
      -  mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_name"), name);
      -  mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_proc"), mrb_obj_value(proc));
      -  mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_klass"), mrb_obj_value(rklass));
      +      
      # File 'mrbgems/mruby-method/mrblib/method.rb', line 13
       
      -  return mrb_obj_value(me);
      -}
      +def >>(other) + ->(*args, **opts, &block) { other.call(call(*args, **opts, &block)) } +end
      @@ -1456,162 +280,24 @@

      def to_proc m = self - lambda { |*args, &b| - m.call(*args, &b) + lambda { |*args, **opts, &b| + m.call(*args, **opts, &b) } end

      - - -
      -

      - - #to_sObject - - - - - -

      - - - - -
      -
      -
      -
      -287
      -288
      -289
      -290
      -291
      -292
      -293
      -294
      -295
      -296
      -297
      -298
      -299
      -300
      -301
      -302
      -303
      -304
      -305
      -306
      -307
      -308
      -309
      -310
      -311
      -312
      -313
      -
      -
      # File 'mrbgems/mruby-method/src/method.c', line 287
      -
      -static mrb_value
      -method_to_s(mrb_state *mrb, mrb_value self)
      -{
      -  mrb_value owner = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_owner"));
      -  mrb_value klass = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_klass"));
      -  mrb_value name = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_name"));
      -  mrb_value str = mrb_str_new_lit(mrb, "#<");
      -  struct RClass *rklass;
      -
      -  mrb_str_cat_cstr(mrb, str, mrb_obj_classname(mrb, self));
      -  mrb_str_cat_lit(mrb, str, ": ");
      -  rklass = mrb_class_ptr(klass);
      -  if (mrb_class_ptr(owner) == rklass) {
      -    mrb_str_concat(mrb, str, owner);
      -    mrb_str_cat_lit(mrb, str, "#");
      -    mrb_str_concat(mrb, str, name);
      -  }
      -  else {
      -    mrb_str_cat_cstr(mrb, str, mrb_class_name(mrb, rklass));
      -    mrb_str_cat_lit(mrb, str, "(");
      -    mrb_str_concat(mrb, str, owner);
      -    mrb_str_cat_lit(mrb, str, ")#");
      -    mrb_str_concat(mrb, str, name);
      -  }
      -  mrb_str_cat_lit(mrb, str, ">");
      -  return str;
      -}
      -
      -
      - -
      -

      - - #unbindObject - - - - - -

      - - - - -
      -
      -
      -
      -167
      -168
      -169
      -170
      -171
      -172
      -173
      -174
      -175
      -176
      -177
      -178
      -179
      -180
      -181
      -182
      -183
      -184
      -
      -
      # File 'mrbgems/mruby-method/src/method.c', line 167
      -
      -static mrb_value
      -method_unbind(mrb_state *mrb, mrb_value self)
      -{
      -  struct RObject *ume;
      -  mrb_value owner = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_owner"));
      -  mrb_value name = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_name"));
      -  mrb_value proc = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_proc"));
      -  mrb_value klass = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_klass"));
      -
      -  ume = method_object_alloc(mrb, mrb_class_get(mrb, "UnboundMethod"));
      -  mrb_obj_iv_set(mrb, ume, mrb_intern_lit(mrb, "_owner"), owner);
      -  mrb_obj_iv_set(mrb, ume, mrb_intern_lit(mrb, "_recv"), mrb_nil_value());
      -  mrb_obj_iv_set(mrb, ume, mrb_intern_lit(mrb, "_name"), name);
      -  mrb_obj_iv_set(mrb, ume, mrb_intern_lit(mrb, "_proc"), proc);
      -  mrb_obj_iv_set(mrb, ume, mrb_intern_lit(mrb, "_klass"), klass);
      -
      -  return mrb_obj_value(ume);
      -}
      -
      - + diff --git a/docs/api/Module.html b/docs/api/Module.html index 914cf08..51fada4 100644 --- a/docs/api/Module.html +++ b/docs/api/Module.html @@ -6,17 +6,17 @@ Class: Module - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -137,7 +137,8 @@

      -

      call-seq: mod < other -> true, false, or nil.

      +
      +

      call-seq: mod < other -> true, false, or nil.

      @@ -160,7 +161,8 @@

      -

      call-seq: mod <= other -> true, false, or nil.

      +
      +

      call-seq: mod <= other -> true, false, or nil.

      @@ -183,7 +185,8 @@

      -

      call-seq: module <=> other_module -> -1, 0, +1, or nil.

      +
      +

      call-seq: module <=> other_module -> -1, 0, +1, or nil.

      @@ -206,7 +209,8 @@

      -

      call-seq: mod > other -> true, false, or nil.

      +
      +

      call-seq: mod > other -> true, false, or nil.

      @@ -229,30 +233,8 @@

      -

      call-seq: mod >= other -> true, false, or nil.

      -
      - - - - -
    • - - - #attr_accessor(*names) ⇒ Object - - - - - - - - - - - - - -

      15.2.2.4.12.

      +
      +

      call-seq: mod >= other -> true, false, or nil.

    • @@ -275,7 +257,8 @@

      -

      15.2.2.4.27.

      +
      +

      15.2.2.4.27.

      @@ -298,8 +281,7 @@

      -
      -
      +
      @@ -324,13 +306,10 @@

      -

      call-seq: - mod < other -> true, false, or nil

      + +

      call-seq: mod < other -> true, false, or nil

      -

      Returns true if mod is a subclass of other. Returns -nil if there’s no relationship between the two. -(Think of the relationship in terms of the class definition: -“class A < B” implies “A < B”.)

      +

      Returns true if mod is a subclass of other. Returns nil if there’s no relationship between the two. (Think of the relationship in terms of the class definition: “class A < B” implies “A < B”.)

      @@ -338,8 +317,8 @@

      -
      - +

      +
      @@ -380,14 +359,10 @@

      -

      call-seq: - mod <= other -> true, false, or nil

      + +

      call-seq: mod <= other -> true, false, or nil

      -

      Returns true if mod is a subclass of other or -is the same as other. Returns -nil if there’s no relationship between the two. -(Think of the relationship in terms of the class definition: -“class A < B” implies “A < B”.)

      +

      Returns true if mod is a subclass of other or is the same as other. Returns nil if there’s no relationship between the two. (Think of the relationship in terms of the class definition: “class A < B” implies “A < B”.)

      @@ -408,8 +383,8 @@

      -

      - + +
      @@ -452,15 +427,12 @@

      -

      call-seq: - module <=> other_module -> -1, 0, +1, or nil

      + +

      call-seq: module <=> other_module -> -1, 0, +1, or nil

      -

      Comparison—Returns -1, 0, +1 or nil depending on whether module -includes other_module, they are the same, or if module is included by -other_module.

      +

      Comparison—Returns -1, 0, +1 or nil depending on whether module includes other_module, they are the same, or if module is included by other_module.

      -

      Returns nil if module has no relationship with other_module, if -other_module is not a module, or if the two values are incomparable.

      +

      Returns nil if module has no relationship with other_module, if other_module is not a module, or if the two values are incomparable.

      @@ -468,8 +440,8 @@

      -
      - +

      +
      @@ -512,13 +484,10 @@

      -

      call-seq: - mod > other -> true, false, or nil

      + +

      call-seq: mod > other -> true, false, or nil

      -

      Returns true if mod is an ancestor of other. Returns -nil if there’s no relationship between the two. -(Think of the relationship in terms of the class definition: -“class A < B” implies “B > A”.)

      +

      Returns true if mod is an ancestor of other. Returns nil if there’s no relationship between the two. (Think of the relationship in terms of the class definition: “class A < B” implies “B > A”.)

      @@ -526,8 +495,8 @@

      -
      - +

      +
      @@ -568,14 +537,10 @@

      -

      call-seq: - mod >= other -> true, false, or nil

      + +

      call-seq: mod >= other -> true, false, or nil

      -

      Returns true if mod is an ancestor of other, or the -two modules are the same. Returns -nil if there’s no relationship between the two. -(Think of the relationship in terms of the class definition: -“class A < B” implies “B > A”.)

      +

      Returns true if mod is an ancestor of other, or the two modules are the same. Returns nil if there’s no relationship between the two. (Think of the relationship in terms of the class definition: “class A < B” implies “B > A”.)

      @@ -596,8 +561,8 @@

      -

      - + +
      @@ -619,50 +584,6 @@

      - - -
      -

      - - #attr_accessor(*names) ⇒ Object - - - - - -

      -
      -

      15.2.2.4.12

      - - -
      -
      -
      - - -
      - - - - - - -
      -
      -
      -
      -3
      -4
      -5
      -6
      -
      -
      # File 'mrblib/00class.rb', line 3
      -
      -def attr_accessor(*names)
      -  attr_reader(*names)
      -  attr_writer(*names)
      -end
      -
      @@ -676,7 +597,8 @@

      -

      15.2.2.4.27

      + +

      15.2.2.4.27

      @@ -684,29 +606,33 @@

      -
      - +

      +
       
       
      -14
      -15
       16
       17
       18
       19
      -20
      +20 +21 +22 +23 +24
      -
      # File 'mrblib/00class.rb', line 14
      +      
      # File 'mrblib/00class.rb', line 16
       
       def include(*args)
      -  args.reverse.each do |m|
      -    m.append_features(self)
      -    m.included(self)
      +  args.reverse!
      +  mod = self
      +  args.each do |m|
      +    m.__send__(:append_features, mod)
      +    m.__send__(:included, mod)
         end
         self
       end
      @@ -730,21 +656,25 @@

       
       
      -22
      -23
      -24
      -25
       26
       27
      -28
      +28 +29 +30 +31 +32 +33 +34

      -
      # File 'mrblib/00class.rb', line 22
      +      
      # File 'mrblib/00class.rb', line 26
       
       def prepend(*args)
      -  args.reverse.each do |m|
      -    m.prepend_features(self)
      -    m.prepended(self)
      +  args.reverse!
      +  mod = self
      +  args.each do |m|
      +    m.__send__(:prepend_features, mod)
      +    m.__send__(:prepended, mod)
         end
         self
       end
      @@ -757,11 +687,11 @@

      - + diff --git a/docs/api/NameError.html b/docs/api/NameError.html index d7ae47f..872aa3d 100644 --- a/docs/api/NameError.html +++ b/docs/api/NameError.html @@ -6,17 +6,17 @@ Exception: NameError - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -73,14 +73,12 @@
      Inherits:
      - StandardError + StandardError
      • Object
      • - - - + @@ -109,7 +107,8 @@

        Overview

        -

        ISO 15.2.31

        + +

        ISO 15.2.31

        @@ -117,8 +116,8 @@

        Overview

        -
        - +
        +

        Direct Known Subclasses

        NoMethodError

        @@ -150,7 +149,8 @@

        Instance Attribute Summary collaps -

        Returns the value of attribute name.

        +
        +

        Returns the value of attribute name.

        @@ -188,7 +188,8 @@

        -

        A new instance of NameError.

        +
        +

        A new instance of NameError.

        @@ -198,23 +199,7 @@

        - - - - - - - - - - - - - - -

        Methods inherited from Exception

        -

        #backtrace, #exception, #inspect, #message, #set_backtrace, #to_s

        -
        +

        Constructor Details

        @@ -228,7 +213,8 @@

        -

        Returns a new instance of NameError

        + +

        Returns a new instance of NameError.

        @@ -236,21 +222,21 @@

        -
        - +

        +
         
         
        -28
        -29
        -30
        -31
        +45 +46 +47 +48
        -
        # File 'mrblib/10error.rb', line 28
        +      
        # File 'mrblib/10error.rb', line 45
         
         def initialize(message=nil, name=nil)
           @name = name
        @@ -279,7 +265,8 @@ 

        -

        Returns the value of attribute name

        + +

        Returns the value of attribute name.

        @@ -287,20 +274,20 @@

        -
        - +

        +
         
         
        -26
        -27
        -28
        +43 +44 +45
        -
        # File 'mrblib/10error.rb', line 26
        +      
        # File 'mrblib/10error.rb', line 43
         
         def name
           @name
        @@ -315,11 +302,11 @@ 

        - + diff --git a/docs/api/NilClass.html b/docs/api/NilClass.html deleted file mode 100644 index 3e378b4..0000000 --- a/docs/api/NilClass.html +++ /dev/null @@ -1,1163 +0,0 @@ - - - - - - - Class: NilClass - - — Documentation by YARD 0.9.20 - - - - - - - - - - - - - - - - - - - - - - - -
        - - -

        Class: NilClass - - - -

        -
        - -
        -
        Inherits:
        -
        - Object - -
          -
        • Object
        • - - - -
        - show all - -
        -
        - - - - - - - - - - - -
        -
        Defined in:
        -
        src/object.c
        -
        - -
        - - - - - - - - - -

        - Instance Method Summary - collapse -

        - -
          - -
        • - - - #& ⇒ Object - - - - - - - - - - - - - -

          And—Returns false.

          -
          - -
        • - - -
        • - - - #^ ⇒ Object - - - - - - - - - - - - - -

          Exclusive Or—If obj is nil or false, returns false; otherwise, returns true.

          -
          - -
        • - - -
        • - - - #inspect ⇒ Object - - - - - - - - - - - - - -

          15.2.4.3.5.

          -
          - -
        • - - -
        • - - - #nil? ⇒ Boolean - - - - - - - - - - - - - -

          call_seq: nil.nil? -> true.

          -
          - -
        • - - -
        • - - - #to_a ⇒ Array - - - - - - - - - - - - - -

          Always returns an empty array.

          -
          - -
        • - - -
        • - - - #to_f ⇒ 0.0 - - - - - - - - - - - - - -

          Always returns zero.

          -
          - -
        • - - -
        • - - - #to_h ⇒ Object - - - - - - - - - - - - - -

          Always returns an empty hash.

          -
          - -
        • - - -
        • - - - #to_i ⇒ 0 - - - - - - - - - - - - - -

          Always returns zero.

          -
          - -
        • - - -
        • - - - #to_s ⇒ Object - - - - - - - - - - - - - -

          Always returns the empty string.

          -
          - -
        • - - -
        • - - - #| ⇒ Object - - - - - - - - - - - - - -

          Or—Returns false if obj is nil or false; true otherwise.

          -
          - -
        • - - -
        - - - - -
        -

        Instance Method Details

        - - -
        -

        - - - #&(obj) ⇒ false - - #&(obj) ⇒ false - - - - - - -

        -
        -

        And—Returns false. obj is always -evaluated as it is the argument to a method call—there is no -short-circuit evaluation in this case.

        - - -
        -
        -
        - -

        Overloads:

        -
          - - -
        • - #&(obj) ⇒ false -
          -
          - - - -
          -
          -
          - -

          Returns:

          -
            - -
          • - - - (false) - - - -
          • - -
          - -
          - - -
        • - - -
        • - #&(obj) ⇒ false -
          -
          - - - -
          -
          -
          - -

          Returns:

          -
            - -
          • - - - (false) - - - -
          • - -
          - -
          - - -
        • - -
        - - -
        - - - - - - -
        -
        -
        -
        -201
        -202
        -203
        -204
        -205
        -
        -
        # File 'src/object.c', line 201
        -
        -static mrb_value
        -false_and(mrb_state *mrb, mrb_value obj)
        -{
        -  return mrb_false_value();
        -}
        -
        -
        - -
        -

        - - - #^(obj) ⇒ Boolean - - #^(obj) ⇒ Boolean - - - - - - -

        -
        -

        Exclusive Or—If obj is nil or -false, returns false; otherwise, returns -true.

        - - -
        -
        -
        - -

        Overloads:

        -
          - - -
        • - #^(obj) ⇒ Boolean -
          -
          - - - -
          -
          -
          - -

          Returns:

          -
            - -
          • - - - (Boolean) - - - -
          • - -
          - -
          - - -
        • - - -
        • - #^(obj) ⇒ Boolean -
          -
          - - - -
          -
          -
          - -

          Returns:

          -
            - -
          • - - - (Boolean) - - - -
          • - -
          - -
          - - -
        • - -
        - - -
        - - - - - - -
        -
        -
        -
        -220
        -221
        -222
        -223
        -224
        -225
        -226
        -227
        -
        -
        # File 'src/object.c', line 220
        -
        -static mrb_value
        -false_xor(mrb_state *mrb, mrb_value obj)
        -{
        -  mrb_bool obj2;
        -
        -  mrb_get_args(mrb, "b", &obj2);
        -  return mrb_bool_value(obj2);
        -}
        -
        -
        - -
        -

        - - #inspectObject - - - - - -

        -
        -

        15.2.4.3.5

        - - -
        -
        -
        - - -
        - - - - - - -
        -
        -
        -
        -89
        -90
        -91
        -92
        -93
        -
        -
        # File 'src/object.c', line 89
        -
        -static mrb_value
        -nil_inspect(mrb_state *mrb, mrb_value obj)
        -{
        -  return mrb_str_new_lit_frozen(mrb, "nil");
        -}
        -
        -
        - -
        -

        - - #nil?Boolean - - - - - -

        -
        -

        call_seq: - nil.nil? -> true

        - -

        Only the object nil responds true to nil?.

        - - -
        -
        -
        - -

        Returns:

        -
          - -
        • - - - (Boolean) - - - -
        • - -
        - -
        - - - - - - -
        -
        -
        -
        -69
        -70
        -71
        -72
        -73
        -
        -
        # File 'src/object.c', line 69
        -
        -static mrb_value
        -mrb_true(mrb_state *mrb, mrb_value obj)
        -{
        -  return mrb_true_value();
        -}
        -
        -
        - -
        -

        - - #to_aArray - - - - - -

        -
        -

        Always returns an empty array.

        - - -
        -
        -
        - -
        -
        - - - -
        -
        -
        - -

        Returns:

        -
          - -
        • - - - (Array) - - - -
        • - -
        - -
        - - - - -
        - - - - - - -
        -
        -
        -
        -14
        -15
        -16
        -17
        -18
        -
        -
        # File 'mrbgems/mruby-object-ext/src/object.c', line 14
        -
        -static mrb_value
        -nil_to_a(mrb_state *mrb, mrb_value obj)
        -{
        -  return mrb_ary_new(mrb);
        -}
        -
        -
        - -
        -

        - - #to_f0.0 - - - - - -

        -
        -

        Always returns zero.

        - - -
        -
        -
        - -
        -
        - - - -
        -
        -
        - -

        Returns:

        -
          - -
        • - - - (0.0) - - - -
        • - -
        - -
        - - - - -
        - - - - - - -
        -
        -
        -
        -28
        -29
        -30
        -31
        -32
        -
        -
        # File 'mrbgems/mruby-object-ext/src/object.c', line 28
        -
        -static mrb_value
        -nil_to_f(mrb_state *mrb, mrb_value obj)
        -{
        -  return mrb_float_value(mrb, 0.0);
        -}
        -
        -
        - -
        -

        - - #to_hObject - - - - - -

        -
        -

        Always returns an empty hash.

        - - -
        -
        -
        - - - - -
        - - - - - - -
        -
        -
        -
        -42
        -43
        -44
        -45
        -46
        -
        -
        # File 'mrbgems/mruby-object-ext/src/object.c', line 42
        -
        -static mrb_value
        -nil_to_h(mrb_state *mrb, mrb_value obj)
        -{
        -  return mrb_hash_new(mrb);
        -}
        -
        -
        - -
        -

        - - #to_i0 - - - - - -

        -
        -

        Always returns zero.

        - - -
        -
        -
        - -
        -
        - - - -
        -
        -
        - -

        Returns:

        -
          - -
        • - - - (0) - - - -
        • - -
        - -
        - - - - -
        - - - - - - -
        -
        -
        -
        -55
        -56
        -57
        -58
        -59
        -
        -
        # File 'mrbgems/mruby-object-ext/src/object.c', line 55
        -
        -static mrb_value
        -nil_to_i(mrb_state *mrb, mrb_value obj)
        -{
        -  return mrb_fixnum_value(0);
        -}
        -
        -
        - -
        -

        - - #to_sObject - - - - - -

        -
        -

        Always returns the empty string.

        - - -
        -
        -
        - - - - -
        - - - - - - -
        -
        -
        -
        -83
        -84
        -85
        -86
        -87
        -
        -
        # File 'src/object.c', line 83
        -
        -static mrb_value
        -nil_to_s(mrb_state *mrb, mrb_value obj)
        -{
        -  return mrb_str_new_frozen(mrb, 0, 0);
        -}
        -
        -
        - -
        -

        - - - #|(obj) ⇒ Boolean - - #|(obj) ⇒ Boolean - - - - - - -

        -
        -

        Or—Returns false if obj is -nil or false; true otherwise.

        - - -
        -
        -
        - -

        Overloads:

        -
          - - -
        • - #|(obj) ⇒ Boolean -
          -
          - - - -
          -
          -
          - -

          Returns:

          -
            - -
          • - - - (Boolean) - - - -
          • - -
          - -
          - - -
        • - - -
        • - #|(obj) ⇒ Boolean -
          -
          - - - -
          -
          -
          - -

          Returns:

          -
            - -
          • - - - (Boolean) - - - -
          • - -
          - -
          - - -
        • - -
        - - -
        - - - - - - -
        -
        -
        -
        -240
        -241
        -242
        -243
        -244
        -245
        -246
        -247
        -
        -
        # File 'src/object.c', line 240
        -
        -static mrb_value
        -false_or(mrb_state *mrb, mrb_value obj)
        -{
        -  mrb_bool obj2;
        -
        -  mrb_get_args(mrb, "b", &obj2);
        -  return mrb_bool_value(obj2);
        -}
        -
        -
        - -
        - -
        - - - -
        - - \ No newline at end of file diff --git a/docs/api/NoMemoryError.html b/docs/api/NoMemoryError.html deleted file mode 100644 index d310684..0000000 --- a/docs/api/NoMemoryError.html +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - - Exception: NoMemoryError - - — Documentation by YARD 0.9.20 - - - - - - - - - - - - - - - - - - - - - - - -
        - - -

        Exception: NoMemoryError - - - -

        -
        - -
        -
        Inherits:
        -
        - Exception - -
          -
        • Object
        • - - - - - -
        - show all - -
        -
        - - - - - - - - - - - -
        -
        Defined in:
        -
        src/error.c
        -
        - -
        - - - - - - - - - - - - - - - -

        Method Summary

        - -

        Methods inherited from Exception

        -

        #backtrace, #exception, #initialize, #inspect, #message, #set_backtrace, #to_s

        -
        -

        Constructor Details

        - -

        This class inherits a constructor from Exception

        - -
        - - -
        - - - -
        - - \ No newline at end of file diff --git a/docs/api/NoMethodError.html b/docs/api/NoMethodError.html index f23b1e6..8091070 100644 --- a/docs/api/NoMethodError.html +++ b/docs/api/NoMethodError.html @@ -6,17 +6,17 @@ Exception: NoMethodError - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -78,9 +78,7 @@
        • Object
        • - - - + @@ -111,7 +109,8 @@

          Overview

          -

          ISO 15.2.32

          + +

          ISO 15.2.32

          @@ -119,8 +118,8 @@

          Overview

          -
          - +
          + @@ -150,7 +149,8 @@

          Instance Attribute Summary collaps -

          Returns the value of attribute args.

          +
          +

          Returns the value of attribute args.

          @@ -193,7 +193,8 @@

          -

          A new instance of NoMethodError.

          +
          +

          A new instance of NoMethodError.

          @@ -209,23 +210,7 @@

          - - - - - - - - - - - - - - -

          Methods inherited from Exception

          -

          #backtrace, #exception, #inspect, #message, #set_backtrace, #to_s

          -
          +

          Constructor Details

          @@ -239,7 +224,8 @@

          -

          Returns a new instance of NoMethodError

          + +

          Returns a new instance of NoMethodError.

          @@ -247,21 +233,21 @@

          -
          - +

          +
           
           
          -38
          -39
          -40
          -41
          +55 +56 +57 +58
          -
          # File 'mrblib/10error.rb', line 38
          +      
          # File 'mrblib/10error.rb', line 55
           
           def initialize(message=nil, name=nil, args=nil)
             @args = args
          @@ -290,7 +276,8 @@ 

          -

          Returns the value of attribute args

          + +

          Returns the value of attribute args.

          @@ -298,20 +285,20 @@

          -
          - +

          +
           
           
          -36
          -37
          -38
          +53 +54 +55
          -
          # File 'mrblib/10error.rb', line 36
          +      
          # File 'mrblib/10error.rb', line 53
           
           def args
             @args
          @@ -326,11 +313,11 @@ 

          - + diff --git a/docs/api/NotImplementedError.html b/docs/api/NotImplementedError.html index 9a53b48..99a4f72 100644 --- a/docs/api/NotImplementedError.html +++ b/docs/api/NotImplementedError.html @@ -6,17 +6,17 @@ Exception: NotImplementedError - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -73,14 +73,12 @@
          Inherits:
          - ScriptError + ScriptError
          • Object
          • - - - + @@ -116,36 +114,14 @@ - - - - - - - - - - - -

            Method Summary

            - -

            Methods inherited from Exception

            -

            #backtrace, #exception, #initialize, #inspect, #message, #set_backtrace, #to_s

            -
            -

            Constructor Details

            - -

            This class inherits a constructor from Exception

            - -
            - - + diff --git a/docs/api/Numeric.html b/docs/api/Numeric.html index ee37454..5c5886b 100644 --- a/docs/api/Numeric.html +++ b/docs/api/Numeric.html @@ -6,17 +6,17 @@ Class: Numeric - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -104,7 +104,7 @@
            Defined in:
            mrblib/numeric.rb,
            - src/numeric.c,
            mrbgems/mruby-rational/mrblib/rational.rb,
            mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb
            + mrbgems/mruby-complex/mrblib/complex.rb,
            mrbgems/mruby-rational/mrblib/rational.rb,
            mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb
            @@ -112,7 +112,8 @@

            Overview

            -

            Numeric

            + +

            Numeric

            ISO 15.2.7

            @@ -122,11 +123,11 @@

            Overview

            -
            - +
            +

            Direct Known Subclasses

            -

            Complex, Float, Integer, Rational

            +

            Complex, Rational

            @@ -160,7 +161,8 @@

            -

            Returns the receiver simply.

            +
            +

            Returns the receiver simply.

            @@ -183,7 +185,8 @@

            -

            Returns the receiver’s value, negated.

            +
            +

            Returns the receiver’s value, negated.

            @@ -206,7 +209,8 @@

            -

            Returns the absolute value of the receiver.

            +
            +

            Returns the absolute value of the receiver.

            @@ -215,7 +219,7 @@

          • - #finite? ⇒ Boolean + #integer? ⇒ Boolean @@ -229,7 +233,8 @@

            -

            15.2.7.

            +
            +

            call-seq: num.integer? -> true or false.

          • @@ -238,7 +243,7 @@

          • - #infinite? ⇒ Boolean + #negative? ⇒ Boolean @@ -253,6 +258,7 @@

            +

            call-seq: negative? -> true or false.

          • @@ -261,7 +267,7 @@

          • - #negative? ⇒ Boolean + #nonzero? ⇒ Boolean @@ -276,6 +282,7 @@

            +

            call-seq: nonzero? -> self or nil.

          • @@ -284,7 +291,7 @@

          • - #nonzero? ⇒ Boolean + #positive? ⇒ Boolean @@ -299,6 +306,7 @@

            +

            call-seq: positive? -> true or false.

          • @@ -307,7 +315,7 @@

          • - #positive? ⇒ Boolean + #to_c ⇒ Object @@ -321,8 +329,7 @@

            -
            -
            +

          • @@ -344,8 +351,7 @@

            -
            -
            +
            @@ -368,6 +374,7 @@

            +

            call-seq: zero? -> true or false.

            @@ -404,7 +411,8 @@

            -

            Returns the receiver simply.

            + +

            Returns the receiver simply.

            ISO 15.2.7.4.1

            @@ -414,8 +422,8 @@

            -
            - +

            +
            @@ -448,7 +456,8 @@

            -

            Returns the receiver’s value, negated.

            + +

            Returns the receiver’s value, negated.

            ISO 15.2.7.4.2

            @@ -458,8 +467,8 @@

            -
            - +

            +
            @@ -492,7 +501,8 @@

            -

            Returns the absolute value of the receiver.

            + +

            Returns the absolute value of the receiver.

            ISO 15.2.7.4.3

            @@ -502,8 +512,8 @@

            -
            - +

            +
            @@ -534,9 +544,9 @@

            -

            +

            - #finite?Boolean + #integer?Boolean @@ -544,7 +554,12 @@

            -

            15.2.7

            + +

            call-seq: num.integer? -> true or false

            + +

            Returns true if num is an Integer.

            + +

            1.0.integer? #=> false 1.integer? #=> true

            @@ -565,37 +580,33 @@

            -

            - +
            +
             
             
            -1576
            -1577
            -1578
            -1579
            -1580
            +59 +60 +61
            -
            # File 'src/numeric.c', line 1576
            +      
            # File 'mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb', line 59
             
            -static mrb_value
            -num_finite_p(mrb_state *mrb, mrb_value self)
            -{
            -  return mrb_true_value();
            -}
            +def integer? + false +end
            -

            +

            - #infinite?Boolean + #negative?Boolean @@ -604,6 +615,9 @@

            +

            call-seq: negative? -> true or false

            + +

            Returns true if self is less than 0, false otherwise.

            @@ -624,37 +638,33 @@

            -

            - +
            +
             
             
            -1582
            -1583
            -1584
            -1585
            -1586
            +46 +47 +48
            -
            # File 'src/numeric.c', line 1582
            +      
            # File 'mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb', line 46
             
            -static mrb_value
            -num_infinite_p(mrb_state *mrb, mrb_value self)
            -{
            -  return mrb_false_value();
            -}
            +def negative? + self < 0 +end
            -

            +

            - #negative?Boolean + #nonzero?Boolean @@ -663,6 +673,9 @@

            +

            call-seq: nonzero? -> self or nil

            + +

            Returns self if self is not a zero value, nil otherwise; uses method zero? for the evaluation.

            @@ -683,23 +696,31 @@

            -

            - +
            + @@ -707,9 +728,9 @@

            -

            +

            - #nonzero?Boolean + #positive?Boolean @@ -718,6 +739,9 @@

            +

            call-seq: positive? -> true or false

            + +

            Returns true if self is greater than 0, false otherwise.

            @@ -738,31 +762,23 @@

            -

            - +
            +

             
             
            -18
            -19
            -20
            +22 +23 +24 +25 +26 +27 +28
            -
            # File 'mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb', line 18
            +      
            # File 'mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb', line 22
             
            -def negative?
            -  self < 0
            +def nonzero?
            +  if self == 0
            +    nil
            +  else
            +    self
            +  end
             end
            @@ -770,54 +786,29 @@

            -

            +

            - #positive?Boolean + #to_cObject -

            -
            - - - -
            -
            -
            - -

            Returns:

            -
              - -
            • - - - (Boolean) - - - -
            • - -
            - -
            - -

             
             
            -6
            -7
            -8
            -9
            -10
            -11
            -12
            +36 +37 +38
            -
            # File 'mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb', line 6
            +      
            # File 'mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb', line 36
             
            -def nonzero?
            -  if self == 0
            -    nil
            -  else
            -    self
            -  end
            +def positive?
            +  self > 0
             end
            +
            @@ -839,12 +830,12 @@

             
             
            -80
            -81
            -82
            +19 +20 +21

             
             
            -14
            -15
            -16
            +86 +87 +88
            -
            # File 'mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb', line 14
            +      
            # File 'mrbgems/mruby-complex/mrblib/complex.rb', line 86
             
            -def positive?
            -  self > 0
            +def to_c
            +  Complex(self, 0)
             end
            -
            # File 'mrbgems/mruby-rational/mrblib/rational.rb', line 80
            +      
            # File 'mrbgems/mruby-rational/mrblib/rational.rb', line 19
             
             def to_r
               Rational(self, 1)
            @@ -866,6 +857,11 @@ 

            +

            call-seq: zero? -> true or false

            + +

            Returns true if zero has a zero value, false otherwise.

            + +

            Of the Core and Standard Library classes, only Rational and Complex use this implementation.

            @@ -886,20 +882,20 @@

            -

            - + + @@ -362,7 +342,7 @@

            # File 'mrbgems/mruby-proc-ext/mrblib/proc.rb', line 46
             
             def >>(other)
            -  ->(*args, &block) { other.call(call(*args, &block)) }
            +  ->(*args, **opts, &block) { other.call(call(*args, **opts, &block)) }
             end
            @@ -423,7 +403,7 @@

            self_arity = self.arity if (self_arity >= 0 && arity != self_arity) || (self_arity < 0 && abs[self_arity] > arity) - raise ArgumentError, "wrong number of arguments (#{arity} for #{abs[self_arity]})" + raise ArgumentError, "wrong number of arguments (given #{arity}, expected #{abs[self_arity]})" end end @@ -509,11 +489,11 @@

            - + diff --git a/docs/api/Random.html b/docs/api/Random.html deleted file mode 100644 index ff3b93b..0000000 --- a/docs/api/Random.html +++ /dev/null @@ -1,381 +0,0 @@ - - - - - - - Class: Random - - — Documentation by YARD 0.9.20 - - - - - - - - - - - - - - - - - - - - - - - -
            - - -

            Class: Random - - - -

            -
            - -
            -
            Inherits:
            -
            - Object - -
              -
            • Object
            • - - - -
            - show all - -
            -
            - - - - - - - - - - - -
            -
            Defined in:
            -
            mrbgems/mruby-random/src/random.c
            -
            - -
            - - - - - - - - - -

            - Instance Method Summary - collapse -

            - - - - -
            -

            Constructor Details

            - -
            -

            - - #initializeObject - - - - - -

             
             
            -2
            -3
            -4
            +11 +12 +13
            -
            # File 'mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb', line 2
            +      
            # File 'mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb', line 11
             
             def zero?
               self == 0
            @@ -913,11 +909,11 @@ 

            - + diff --git a/docs/api/ObjectSpace.html b/docs/api/ObjectSpace.html index 53b4903..3b16984 100644 --- a/docs/api/ObjectSpace.html +++ b/docs/api/ObjectSpace.html @@ -6,17 +6,17 @@ Module: ObjectSpace - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -98,11 +98,11 @@ - + diff --git a/docs/api/Proc.html b/docs/api/Proc.html index ddaefdf..b8d6a84 100644 --- a/docs/api/Proc.html +++ b/docs/api/Proc.html @@ -6,17 +6,17 @@ Class: Proc - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -98,25 +98,11 @@
            Defined in:
            -
            src/class.c,
            - mrbgems/mruby-proc-ext/mrblib/proc.rb
            -
            +
            mrbgems/mruby-proc-ext/mrblib/proc.rb
            -

            Overview

            -
            -

            15.2.17

            - - -
            -
            -
            - - -
            - @@ -149,8 +135,7 @@

            -
            -
            +
            @@ -172,8 +157,7 @@

            -
            -
            +
            @@ -195,8 +179,7 @@

            -
            -
            +
            @@ -218,8 +201,7 @@

            -
            -
            +
            @@ -241,8 +223,7 @@

            -
            -
            +
            @@ -264,8 +245,7 @@

            -
            -
            +
            @@ -302,7 +282,7 @@

            # File 'mrbgems/mruby-proc-ext/mrblib/proc.rb', line 42
             
             def <<(other)
            -  ->(*args, &block) { call(other.call(*args, &block)) }
            +  ->(*args, **opts, &block) { call(other.call(*args, **opts, &block)) }
             end

            - - - - -
            -
            -
            -
            -157
            -158
            -159
            -160
            -161
            -162
            -163
            -164
            -165
            -166
            -167
            -168
            -169
            -170
            -171
            -172
            -173
            -174
            -
            -
            # File 'mrbgems/mruby-random/src/random.c', line 157
            -
            -static mrb_value
            -random_m_init(mrb_state *mrb, mrb_value self)
            -{
            -  mrb_value seed;
            -  rand_state *t;
            -
            -  seed = get_opt(mrb);
            -  /* avoid memory leaks */
            -  t = random_ptr(self);
            -  if (mrb_nil_p(seed)) {
            -    rand_init(t);
            -  }
            -  else {
            -    rand_seed(t, (uint32_t)mrb_fixnum(seed));
            -  }
            -
            -  return self;
            -}
            -
            - - - - - -
            -

            Instance Method Details

            - - -
            -

            - - #randObject - - - - - -

            - - - - -
            -
            -
            -
            -176
            -177
            -178
            -179
            -180
            -181
            -182
            -183
            -184
            -
            -
            # File 'mrbgems/mruby-random/src/random.c', line 176
            -
            -static mrb_value
            -random_m_rand(mrb_state *mrb, mrb_value self)
            -{
            -  mrb_value max;
            -  rand_state *t = random_ptr(self);
            -
            -  max = get_opt(mrb);
            -  return random_rand(mrb, t, max);
            -}
            -
            -
            - -
            -

            - - #srandObject - - - - - -

            - - - - -
            -
            -
            -
            -186
            -187
            -188
            -189
            -190
            -191
            -192
            -193
            -194
            -195
            -196
            -197
            -198
            -199
            -200
            -201
            -202
            -203
            -204
            -
            -
            # File 'mrbgems/mruby-random/src/random.c', line 186
            -
            -static mrb_value
            -random_m_srand(mrb_state *mrb, mrb_value self)
            -{
            -  uint32_t seed;
            -  uint32_t old_seed;
            -  mrb_value sv;
            -  rand_state *t = random_ptr(self);
            -
            -  sv = get_opt(mrb);
            -  if (mrb_nil_p(sv)) {
            -    seed = (uint32_t)time(NULL) + rand_uint32(t);
            -  }
            -  else {
            -    seed = (uint32_t)mrb_fixnum(sv);
            -  }
            -  old_seed = rand_seed(t, seed);
            -
            -  return mrb_fixnum_value((mrb_int)old_seed);
            -}
            -
            -
            - -
            - - - - - - - - \ No newline at end of file diff --git a/docs/api/Range.html b/docs/api/Range.html index cf56ad7..3b16602 100644 --- a/docs/api/Range.html +++ b/docs/api/Range.html @@ -6,17 +6,17 @@ Class: Range - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -104,7 +104,7 @@
            Defined in:
            mrblib/range.rb,
            - mrblib/range.rb,
            mrbgems/mruby-range-ext/mrblib/range.rb
            + mrbgems/mruby-range-ext/mrblib/range.rb
            @@ -112,9 +112,10 @@

            Overview

            -

            Range is enumerable

            + +

            Range

            -

            ISO 15.2.14.3

            +

            ISO 15.2.14

            @@ -122,8 +123,8 @@

            Overview

            -
            - +
            + @@ -162,7 +163,8 @@

            -

            Calls the given block for each element of +self+ and pass the respective element.

            +
            +

            Calls the given block for each element of self and pass the respective element.

            @@ -185,7 +187,8 @@

            -

            call-seq: rng.first -> obj rng.first(n) -> an_array.

            +
            +

            call-seq: rng.first -> obj rng.first(n) -> an_array.

            @@ -208,7 +211,8 @@

            -

            redefine #hash 15.3.1.3.15.

            +
            +

            redefine #hash 15.3.1.3.15.

            @@ -217,7 +221,7 @@

          • - #max(&block) ⇒ Object + #last(*args) ⇒ Object @@ -232,8 +236,31 @@

            +

            call-seq: rng.last -> obj rng.last(n) -> an_array.

            +

          • + + +
          • + + + #max(&block) ⇒ Object + + + + + + + + + + + + + +
            +
          • @@ -254,7 +281,56 @@

            +
            + + + + +
          • + + + #overlap?(other) ⇒ Boolean + + + + + + + + + + + + + +
            +

            Compare two ranges and see if they overlap each other (1..5).overlap?(4..6) # => true (1..5).overlap?(7..9) # => false.

            +
            + +
          • + + +
          • + + + #to_a ⇒ Object + + + + (also: #entries) + + + + + + + + + + +
            +

            call-seq: rng.to_a -> array rng.entries -> array.

          • @@ -273,7 +349,7 @@

            Methods included from Enumerable

            -

            __update_hash, #all?, #any?, #chain, #collect, #count, #cycle, #detect, #drop, #drop_while, #each_cons, #each_slice, #each_with_index, #each_with_object, #entries, #filter_map, #find_all, #find_index, #flat_map, #grep, #group_by, #include?, #inject, #lazy, #max_by, #min_by, #minmax, #minmax_by, #none?, #one?, #partition, #reject, #reverse_each, #sort, #sort_by, #take, #take_while, #tally, #to_h, #uniq, #zip

            +

            #all?, #any?, #chain, #chunk, #chunk_while, #collect, #count, #cycle, #detect, #drop, #drop_while, #each_cons, #each_entry, #each_slice, #each_with_index, #each_with_object, #filter_map, #find_all, #find_index, #flat_map, #grep, #grep_v, #group_by, #include?, #inject, #lazy, #max_by, #min_by, #minmax, #minmax_by, #none?, #one?, #partition, #reject, #reverse_each, #sort, #sort_by, #sum, #take, #take_while, #tally, #to_h, #uniq, #zip

            @@ -291,8 +367,8 @@

            -

            Calls the given block for each element of +self+ -and pass the respective element.

            + +

            Calls the given block for each element of self and pass the respective element.

            ISO 15.2.14.4.4

            @@ -315,19 +391,14 @@

            -

            - +
            +
             
             
            -12
            -13
            -14
            -15
            -16
             17
             18
             19
            @@ -362,18 +433,57 @@ 

            48 49 50 -51

            +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73
            -
            # File 'mrblib/range.rb', line 12
            +      
            # File 'mrblib/range.rb', line 17
             
             def each(&block)
               return to_enum :each unless block
             
            -  val = self.first
            -  last = self.last
            +  val = self.begin
            +  last = self.end
            +
            +  if val.kind_of?(Integer) && last.nil?
            +    i = val
            +    while true
            +      block.call(i)
            +      i += 1
            +    end
            +    return self
            +  end
            +
            +  if val.kind_of?(String) && last.nil?
            +    if val.respond_to? :__upto_endless
            +      return val.__upto_endless(&block)
            +    else
            +      str_each = true
            +    end
            +  end
             
            -  if val.kind_of?(Fixnum) && last.kind_of?(Fixnum) # fixnums are special
            +  if val.kind_of?(Integer) && last.kind_of?(Integer) # integers are special
                 lim = last
                 lim += 1 unless exclude_end?
                 i = val
            @@ -423,15 +533,12 @@ 

            -

            call-seq: - rng.first -> obj - rng.first(n) -> an_array

            + +

            call-seq: rng.first -> obj rng.first(n) -> an_array

            -

            Returns the first object in the range, or an array of the first +n+ -elements.

            +

            Returns the first object in the range, or an array of the first n elements.

            -

            (10..20).first #=> 10 - (10..20).first(3) #=> [10, 11, 12]

            +

            (10..20).first #=> 10 (10..20).first(3) #=> [10, 11, 12]

            @@ -444,7 +551,7 @@

          • - (ArgumentError) + (RangeError) @@ -452,8 +559,8 @@

            -

          • - + +
            @@ -474,12 +581,14 @@

            24 25 26 -27 +27 +28

            # File 'mrbgems/mruby-range-ext/mrblib/range.rb', line 13
             
             def first(*args)
            +  raise RangeError, "cannot get the first element of beginless range" if self.begin.nil?
               return self.begin if args.empty?
             
               raise ArgumentError, "wrong number of arguments (given #{args.length}, expected 1)" unless args.length == 1
            @@ -510,7 +619,8 @@ 

            -

            redefine #hash 15.3.1.3.15

            + +

            redefine #hash 15.3.1.3.15

            @@ -518,22 +628,22 @@

            -
            - +

            +
             
             
            -54
            -55
            -56
            -57
            -58
            +76 +77 +78 +79 +80
            -
            # File 'mrblib/range.rb', line 54
            +      
            # File 'mrblib/range.rb', line 76
             
             def hash
               h = first.hash ^ last.hash
            @@ -546,51 +656,155 @@ 

            -

            +

            - #max(&block) ⇒ Object + #last(*args) ⇒ Object -

            +
            +
            + +

            call-seq: rng.last -> obj rng.last(n) -> an_array

            + +

            Returns the last object in the range, or an array of the last n elements.

            + +

            Note that with no arguments last will return the object that defines the end of the range even if #exclude_end? is true.

            + +

            (10..20).last #=> 20 (10…20).last #=> 20 (10..20).last(3) #=> [18, 19, 20] (10…20).last(3) #=> [17, 18, 19]

            + + +
            +
            +
            + +

            Raises:

            + + +
            + +
            + + +
             
             
            -29
            -30
            -31
            -32
            -33
            -34
            -35
            -36
            -37
            -38
            -39
            -40
            -41
            -42
            -43
            -44
             45
             46
            -47
            +47 +48 +49 +50 +51 +52 +53 +54 +
            +
            # File 'mrbgems/mruby-range-ext/mrblib/range.rb', line 45
            +
            +def last(*args)
            +  raise RangeError, "cannot get the last element of endless range" if self.end.nil?
            +  return self.end if args.empty?
            +
            +  raise ArgumentError, "wrong number of arguments (given #{args.length}, expected 1)" unless args.length == 1
            +  nv = args[0]
            +  n = nv.__to_int
            +  raise ArgumentError, "negative array size (or size too big)" unless 0 <= n
            +  return self.to_a.last(nv)
            +end
            +
            +
            + +
            +

            + + #max(&block) ⇒ Object + + + + + +

            +
            + + +
            +
            +
            + +

            Raises:

            + + +
            + + + + @@ -622,31 +836,39 @@

             
             
            -49
            -50
            -51
            -52
            -53
            -54
            -55
            -56
            -57
            -58
            -59
            -60
            -61
            -62
            -63
            -64
            -65
            +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98

            + +
            +
            +
            +
            +56
            +57
            +58
            +59
            +60
            +61
            +62
            +63
            +64
            +65
            +66
            +67
            +68
            +69
            +70
            +71
            +72
            +73
            +74
            +75
            +76
            -
            # File 'mrbgems/mruby-range-ext/mrblib/range.rb', line 29
            +      
            # File 'mrbgems/mruby-range-ext/mrblib/range.rb', line 56
             
             def max(&block)
            -  val = self.first
            -  last = self.last
            -  return super if block
            +  val = self.begin
            +  last = self.end
            +  return super(&block) if block
            +
            +  raise RangeError, "cannot get the maximum of endless range" if last.nil?
             
               # fast path for numerics
               if val.kind_of?(Numeric) && last.kind_of?(Numeric)
            -    raise TypeError if exclude_end? && !last.kind_of?(Fixnum)
            +    raise TypeError if exclude_end? && !last.kind_of?(Integer)
                 return nil if val > last
                 return nil if val == last && exclude_end?
             
            @@ -600,7 +814,7 @@ 

            end # delegate to Enumerable - super + super() end

            -
            # File 'mrbgems/mruby-range-ext/mrblib/range.rb', line 49
            +      
            # File 'mrbgems/mruby-range-ext/mrblib/range.rb', line 78
             
             def min(&block)
            -  val = self.first
            -  last = self.last
            -  return super if block
            +  val = self.begin
            +  last = self.end
            +  if block
            +    raise RangeError, "cannot get the minimum of endless range with custom comparison method" if last.nil?
            +    return super(&block)
            +  end
            +  return val if last.nil?
             
               # fast path for numerics
               if val.kind_of?(Numeric) && last.kind_of?(Numeric)
            @@ -658,6 +880,166 @@ 

            end # delegate to Enumerable + super() +end

            +
            +
            + +
            +

            + + #overlap?(other) ⇒ Boolean + + + + + +

            +
            + +

            Compare two ranges and see if they overlap each other (1..5).overlap?(4..6) # => true (1..5).overlap?(7..9) # => false

            + + +
            +
            +
            + +

            Returns:

            +
              + +
            • + + + (Boolean) + + + +
            • + +
            +

            Raises:

            + + +
            + + + + + + +
            +
            +
            +
            +103
            +104
            +105
            +106
            +107
            +108
            +109
            +110
            +111
            +112
            +113
            +114
            +115
            +116
            +117
            +118
            +119
            +120
            +121
            +122
            +123
            +
            +
            # File 'mrbgems/mruby-range-ext/mrblib/range.rb', line 103
            +
            +def overlap?(other)
            +  raise TypeError, "argument must be a range" unless other.kind_of?(Range)
            +
            +  self_begin = self.begin
            +  other_end = other.end
            +  other_excl = other.exclude_end?
            +
            +  return false if __empty_range?(self_begin, other_end, other_excl)
            +
            +  other_begin = other.begin
            +  self_end = self.end
            +  self_excl = self.exclude_end?
            +
            +  return false if __empty_range?(other_begin, self_end, self_excl)
            +  return true if self_begin == other_begin
            +
            +  return false if __empty_range?(self_begin, self_end, self_excl)
            +  return false if __empty_range?(other_begin, other_end, other_excl)
            +
            +  true
            +end
            +
            +
            + +
            +

            + + #to_aObject + + + + Also known as: + entries + + + + +

            +
            + +

            call-seq: rng.to_a -> array rng.entries -> array

            + +

            Returns an array containing the items in the range.

            + +

            (1..7).to_a #=> [1, 2, 3, 4, 5, 6, 7] (1..).to_a #=> RangeError: cannot convert endless range to an array

            + + +
            +
            +
            + + +
            + + + + + @@ -669,11 +1051,11 @@

            - + diff --git a/docs/api/RangeError.html b/docs/api/RangeError.html index ef0a8f8..29a6f1b 100644 --- a/docs/api/RangeError.html +++ b/docs/api/RangeError.html @@ -6,17 +6,17 @@ Exception: RangeError - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -73,14 +73,12 @@
            Inherits:
            - StandardError + StandardError

            - -
            +
            +
            +
            +91
            +92
            +93
            +94
            +95
            +
            +
            # File 'mrblib/range.rb', line 91
            +
            +def to_a
            +  a = __num_to_a
            +  return a if a
               super
             end
            # File 'mrbgems/mruby-rational/mrblib/rational.rb', line 10
             
            -def *(rhs)
            -  if rhs.is_a? Rational
            -    Rational(numerator * rhs.numerator, denominator * rhs.denominator)
            -  elsif rhs.is_a? Integer
            -    Rational(numerator * rhs, denominator)
            -  elsif rhs.is_a? Numeric
            -    numerator * rhs / denominator
            -  end
            -end
            -
            -
            - -
            -

            - - #+(rhs) ⇒ Object - - - - - -

            - - - - -
            -
            -
            -
            -20
            -21
            -22
            -23
            -24
            -25
            -26
            -27
            -28
            -
            -
            # File 'mrbgems/mruby-rational/mrblib/rational.rb', line 20
            -
            -def +(rhs)
            -  if rhs.is_a? Rational
            -    Rational(numerator * rhs.denominator + rhs.numerator * denominator, denominator * rhs.denominator)
            -  elsif rhs.is_a? Integer
            -    Rational(numerator + rhs * denominator, denominator)
            -  elsif rhs.is_a? Numeric
            -    (numerator + rhs * denominator) / denominator
            -  end
            -end
            -
            -
            - -
            -

            - - #-(rhs) ⇒ Object - - - - - -

            - - - - -
            -
            -
            -
            -30
            -31
            -32
            -33
            -34
            -35
            -36
            -37
            -38
            -
            -
            # File 'mrbgems/mruby-rational/mrblib/rational.rb', line 30
            -
            -def -(rhs)
            -  if rhs.is_a? Rational
            -    Rational(numerator * rhs.denominator - rhs.numerator * denominator, denominator * rhs.denominator)
            -  elsif rhs.is_a? Integer
            -    Rational(numerator - rhs * denominator, denominator)
            -  elsif rhs.is_a? Numeric
            -    (numerator - rhs * denominator) / denominator
            -  end
            -end
            -
            -
            - -
            -

            - - #/(rhs) ⇒ Object - - - - - -

            - - - - -
            -
            -
            -
            -40
            -41
            -42
            -43
            -44
            -45
            -46
            -47
            -48
            -
            -
            # File 'mrbgems/mruby-rational/mrblib/rational.rb', line 40
            -
            -def /(rhs)
            -  if rhs.is_a? Rational
            -    Rational(numerator * rhs.denominator, denominator * rhs.numerator)
            -  elsif rhs.is_a? Integer
            -    Rational(numerator, denominator * rhs)
            -  elsif rhs.is_a? Numeric
            -    numerator / rhs / denominator
            -  end
            -end
            -
            -
            - -
            -

            - - #<=>(rhs) ⇒ Object - - - - - -

            - - - - -
            -
            -
            -
            -50
            -51
            -52
            -53
            -54
            -55
            -56
            -57
            -58
            -59
            -60
            -61
            -62
            -63
            -64
            -
            -
            # File 'mrbgems/mruby-rational/mrblib/rational.rb', line 50
            -
            -def <=>(rhs)
            -  if rhs.is_a?(Integral)
            -    return numerator <=> rhs if denominator == 1
            -    rhs = Rational(rhs)
            -  end
            -
            -  case rhs
            -  when Rational
            -    (numerator * rhs.denominator - denominator * rhs.numerator) <=> 0
            -  when Numeric
            -    (rhs <=> self)&.-@
            -  else
            -    nil
            -  end
            -end
            -
            -
            - -
            -

            - - #==(rhs) ⇒ Object - - - - - -

            - - - @@ -667,11 +317,11 @@

            - + diff --git a/docs/api/RegexpError.html b/docs/api/RegexpError.html index 5623683..797b4a3 100644 --- a/docs/api/RegexpError.html +++ b/docs/api/RegexpError.html @@ -6,17 +6,17 @@ Exception: RegexpError - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -73,14 +73,12 @@
            Inherits:
            - StandardError + StandardError

            -
            -
            -
            -66
            -67
            -68
            -69
            -70
            -71
            -72
            -73
            -74
            -75
            -76
            -
            -
            # File 'mrbgems/mruby-rational/mrblib/rational.rb', line 66
            -
            -def ==(rhs)
            -  return true if self.equal?(rhs)
            -  if rhs.is_a?(Integral) && denominator == 1
            -    return numerator == rhs
            -  end
            -  if rhs.is_a?(Rational)
            -    numerator * rhs.denominator == denominator * rhs.numerator
            -  else
            -    rhs == self
            -  end
            +def <=>(other)
            +  return nil unless other.kind_of?(Numeric)
            +  self.to_f <=> other.to_f
            +rescue
            +  nil
             end
            + + + + +
            +
            +
            +
            +22
            +23
            +24
            +25
            +26
            +27
            +28
            +29
            +30
            +31
            +32
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 22
            +
            +def initialize(enum = nil, &block)
            +  @hash ||= Hash.new
            +
            +  enum.nil? and return
            +
            +  if block_given?
            +    __do_with_enum(enum) { |o| add(block.call(o)) }
            +  else
            +    merge(enum)
            +  end
            +end
            +
            +
            + + + + +
            +

            Class Method Details

            + + +
            +

            + + .[](*ary) ⇒ Object + + + + + +

            + + + + +
            +
            +
            +
            +18
            +19
            +20
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 18
            +
            +def self.[](*ary)
            +  new(ary)
            +end
            +
            +
            + +
            + +
            +

            Instance Method Details

            + + +
            +

            + + #&(enum) ⇒ Object + + + + Also known as: + intersection + + + + +

            + + + + +
            +
            +
            +
            +241
            +242
            +243
            +244
            +245
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 241
            +
            +def &(enum)
            +  n = Set.new
            +  __do_with_enum(enum) { |o| n.add(o) if include?(o) }
            +  n
            +end
            +
            +
            + +
            +

            + + #-(enum) ⇒ Object + + + + Also known as: + difference + + + + +

            + + + + +
            +
            +
            +
            +236
            +237
            +238
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 236
            +
            +def -(enum)
            +  dup.subtract(enum)
            +end
            +
            +
            + +
            +

            + + #<=>(set) ⇒ Object + + + + + +

            + + + + +
            +
            +
            +
            +264
            +265
            +266
            +267
            +268
            +269
            +270
            +271
            +272
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 264
            +
            +def <=>(set)
            +  return unless set.is_a?(Set)
            +
            +  case size <=> set.size
            +  when -1 then -1 if proper_subset?(set)
            +  when +1 then +1 if proper_superset?(set)
            +  else 0 if self.==(set)
            +  end
            +end
            +
            +
            + +
            +

            + + #==(other) ⇒ Object + + + + + +

            + + + + +
            +
            +
            +
            +252
            +253
            +254
            +255
            +256
            +257
            +258
            +259
            +260
            +261
            +262
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 252
            +
            +def ==(other)
            +  if self.equal?(other)
            +    true
            +  elsif other.instance_of?(self.class) && self.size == other.size
            +    @hash == other.__get_hash
            +  elsif other.is_a?(self.class) && self.size == other.size
            +    other.all? { |o| include?(o) }
            +  else
            +    false
            +  end
            +end
            +
            +
            + +
            +

            + + #^(enum) ⇒ Object + + + + + +

            + + + + +
            +
            +
            +
            +248
            +249
            +250
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 248
            +
            +def ^(enum)
            +  (self | Set.new(enum)) - (self & Set.new(enum))
            +end
            +
            +
            + +
            +

            + + #__do_with_enum(enum, &block) ⇒ Object + + + + + +

            +
            + +

            internal method

            + + +
            +
            +
            + + +
            + + + + + + +
            +
            +
            +
            +5
            +6
            +7
            +8
            +9
            +10
            +11
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 5
            +
            +def __do_with_enum(enum, &block)
            +  if enum.respond_to?(:each)
            +    enum.each(&block)
            +  else
            +    raise ArgumentError, "value must be enumerable"
            +  end
            +end
            +
            +
            + +
            +

            + + #__get_hashObject + + + + + +

            +
            + +

            internal method to get internal hash

            + + +
            +
            +
            + + +
            + + + + + + +
            +
            +
            +
            +14
            +15
            +16
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 14
            +
            +def __get_hash
            +  @hash
            +end
            +
            +
            + +
            +

            + + #add(o) ⇒ Object + + + + Also known as: + << + + + + +

            + + + + +
            +
            +
            +
            +153
            +154
            +155
            +156
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 153
            +
            +def add(o)
            +  @hash[o] = true
            +  self
            +end
            +
            +
            + +
            +

            + + #add?(o) ⇒ Boolean + + + + + +

            +
            + + +
            +
            +
            + +

            Returns:

            +
              + +
            • + + + (Boolean) + + + +
            • + +
            + +
            + + + + + + +
            +
            +
            +
            +159
            +160
            +161
            +162
            +163
            +164
            +165
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 159
            +
            +def add?(o)
            +  if include?(o)
            +    nil
            +  else
            +    add(o)
            +  end
            +end
            +
            +
            + +
            +

            + + #classifyObject + + + + + +

            + + + + +
            +
            +
            +
            +283
            +284
            +285
            +286
            +287
            +288
            +289
            +290
            +291
            +292
            +293
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 283
            +
            +def classify
            +  return to_enum :classify unless block_given?
            +  h = {}
            +
            +  each { |i|
            +    x = yield(i)
            +    (h[x] ||= self.class.new).add(i)
            +  }
            +
            +  h
            +end
            +
            +
            + +
            +

            + + #clearObject + + + + + +

            + + + + +
            +
            +
            +
            +53
            +54
            +55
            +56
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 53
            +
            +def clear
            +  @hash.clear
            +  self
            +end
            +
            +
            + +
            +

            + + #collect!Object + + + + Also known as: + map! + + + + +

            + + + + +
            +
            +
            +
            +192
            +193
            +194
            +195
            +196
            +197
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 192
            +
            +def collect!
            +  return to_enum :collect! unless block_given?
            +  set = self.class.new
            +  each { |o| set << yield(o) }
            +  replace(set)
            +end
            +
            +
            + +
            +

            + + #delete(o) ⇒ Object + + + + + +

            + + + + +
            +
            +
            +
            +167
            +168
            +169
            +170
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 167
            +
            +def delete(o)
            +  @hash.delete(o)
            +  self
            +end
            +
            +
            + +
            +

            + + #delete?(o) ⇒ Boolean + + + + + +

            +
            + + +
            +
            +
            + +

            Returns:

            +
              + +
            • + + + (Boolean) + + + +
            • + +
            + +
            + + + + + + +
            +
            +
            +
            +172
            +173
            +174
            +175
            +176
            +177
            +178
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 172
            +
            +def delete?(o)
            +  if include?(o)
            +    delete(o)
            +  else
            +    nil
            +  end
            +end
            +
            +
            + +
            +

            + + #delete_ifObject + + + + + +

            + + + + +
            +
            +
            +
            +180
            +181
            +182
            +183
            +184
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 180
            +
            +def delete_if
            +  return to_enum :delete_if unless block_given?
            +  select { |o| yield o }.each { |o| @hash.delete(o) }
            +  self
            +end
            +
            +
            + +
            +

            + + #disjoint?(set) ⇒ Boolean + + + + + +

            +
            + + +
            +
            +
            + +

            Returns:

            +
              + +
            • + + + (Boolean) + + + +
            • + +
            + +
            + + + + + + +
            +
            +
            +
            +143
            +144
            +145
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 143
            +
            +def disjoint?(set)
            +  !intersect?(set)
            +end
            +
            +
            + +
            +

            + + #divide(&func) ⇒ Object + + + + + +

            + + + + +
            +
            +
            +
            +295
            +296
            +297
            +298
            +299
            +300
            +301
            +302
            +303
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 295
            +
            +def divide(&func)
            +  return to_enum :divide unless block_given?
            +
            +  if func.arity == 2
            +    raise NotImplementedError, "Set#divide with 2 arity block is not implemented."
            +  end
            +
            +  Set.new(classify(&func).values)
            +end
            +
            +
            + +
            +

            + + #each(&block) ⇒ Object + + + + + +

            + + + + +
            +
            +
            +
            +147
            +148
            +149
            +150
            +151
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 147
            +
            +def each(&block)
            +  return to_enum :each unless block_given?
            +  @hash.each_key(&block)
            +  self
            +end
            +
            +
            + +
            +

            + + #empty?Boolean + + + + + +

            +
            + + +
            +
            +
            + +

            Returns:

            +
              + +
            • + + + (Boolean) + + + +
            • + +
            + +
            + + + + + + +
            +
            +
            +
            +49
            +50
            +51
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 49
            +
            +def empty?
            +  @hash.empty?
            +end
            +
            +
            + +
            +

            + + #eql?(o) ⇒ Boolean + + + + + +

            +
            + + +
            +
            +
            + +

            Returns:

            +
              + +
            • + + + (Boolean) + + + +
            • + +
            + +
            + + + + + + +
            +
            +
            +
            +278
            +279
            +280
            +281
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 278
            +
            +def eql?(o)
            +  return false unless o.is_a?(Set)
            +  @hash.eql?(o.__get_hash)
            +end
            +
            +
            + +
            +

            + + #flattenObject + + + + + +

            + + + + +
            +
            +
            +
            +88
            +89
            +90
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 88
            +
            +def flatten
            +  self.class.new.flatten_merge(self)
            +end
            +
            +
            + +
            +

            + + #flatten!Object + + + + + +

            + + + + +
            +
            +
            +
            +92
            +93
            +94
            +95
            +96
            +97
            +98
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 92
            +
            +def flatten!
            +  if detect { |e| e.is_a?(Set) }
            +    replace(flatten())
            +  else
            +    nil
            +  end
            +end
            +
            +
            + +
            +

            + + #flatten_merge(set, seen = Set.new) ⇒ Object + + + + + +

            +
            + +

            def to_set end

            + + +
            +
            +
            + + +
            + + + + + + +
            +
            +
            +
            +70
            +71
            +72
            +73
            +74
            +75
            +76
            +77
            +78
            +79
            +80
            +81
            +82
            +83
            +84
            +85
            +86
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 70
            +
            +def flatten_merge(set, seen = Set.new)
            +  seen.add(set.object_id)
            +  set.each { |e|
            +    if e.is_a?(Set)
            +      if seen.include?(e_id = e.object_id)
            +        raise ArgumentError, "tried to flatten recursive Set"
            +      end
            +
            +      flatten_merge(e, seen)
            +    else
            +      add(e)
            +    end
            +  }
            +  seen.delete(set.object_id)
            +
            +  self
            +end
            +
            +
            + +
            +

            + + #hashObject + + + + + +

            + + + + +
            +
            +
            +
            +274
            +275
            +276
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 274
            +
            +def hash
            +  @hash.hash
            +end
            +
            +
            + +
            +

            + + #include?(o) ⇒ Boolean + + + + Also known as: + member?, === + + + + +

            +
            + + +
            +
            +
            + +

            Returns:

            +
              + +
            • + + + (Boolean) + + + +
            • + +
            + +
            + + + + + + +
            +
            +
            +
            +100
            +101
            +102
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 100
            +
            +def include?(o)
            +  @hash.include?(o)
            +end
            +
            +
            + +
            +

            + + #initialize_copy(orig) ⇒ Object + + + + + +

            + + + + +
            +
            +
            +
            +34
            +35
            +36
            +37
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 34
            +
            +def initialize_copy(orig)
            +  super
            +  @hash = orig.__get_hash.dup
            +end
            +
            +
            + +
            +

            + + #inspectObject + + + + Also known as: + to_s + + + + +

            + + + + +
            +
            +
            +
            +309
            +310
            +311
            +312
            +313
            +314
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 309
            +
            +def inspect
            +  return "#<#{self.class}: {}>" if empty?
            +  return "#<#{self.class}: {...}>" if self.__inspect_recursive?
            +  ary = map {|o| o.inspect }
            +  "#<#{self.class}: {#{ary.join(", ")}}>"
            +end
            +
            +
            + +
            +

            + + #intersect?(set) ⇒ Boolean + + + + + +

            +
            + + +
            +
            +
            + +

            Returns:

            +
              + +
            • + + + (Boolean) + + + +
            • + +
            +

            Raises:

            + + +
            + + + + + + +
            +
            +
            +
            +134
            +135
            +136
            +137
            +138
            +139
            +140
            +141
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 134
            +
            +def intersect?(set)
            +  raise ArgumentError, "value must be a set" unless set.is_a?(Set)
            +  if size < set.size
            +    any? { |o| set.include?(o) }
            +  else
            +    set.any? { |o| include?(o) }
            +  end
            +end
            +
            +
            + +
            +

            + + #join(separator = nil) ⇒ Object + + + + + +

            + + + + +
            +
            +
            +
            +305
            +306
            +307
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 305
            +
            +def join(separator = nil)
            +  to_a.join(separator)
            +end
            +
            +
            + +
            +

            + + #keep_ifObject + + + + + +

            + + + + +
            +
            +
            +
            +186
            +187
            +188
            +189
            +190
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 186
            +
            +def keep_if
            +  return to_enum :keep_if unless block_given?
            +  reject { |o| yield o }.each { |o| @hash.delete(o) }
            +  self
            +end
            +
            +
            + +
            +

            + + #merge(enum) ⇒ Object + + + + + +

            + + + + +
            +
            +
            +
            +215
            +216
            +217
            +218
            +219
            +220
            +221
            +222
            +223
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 215
            +
            +def merge(enum)
            +  if enum.instance_of?(self.class)
            +    @hash.merge!(enum.__get_hash)
            +  else
            +    __do_with_enum(enum) { |o| add(o) }
            +  end
            +
            +  self
            +end
            +
            +
            + +
            +

            + + #proper_subset?(set) ⇒ Boolean + + + + Also known as: + < + + + + +

            +
            + + +
            +
            +
            + +

            Returns:

            +
              + +
            • + + + (Boolean) + + + +
            • + +
            +

            Raises:

            + + +
            + + + + + + +
            +
            +
            +
            +127
            +128
            +129
            +130
            +131
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 127
            +
            +def proper_subset?(set)
            +  raise ArgumentError, "value must be a set" unless set.is_a?(Set)
            +  return false if set.size <= size
            +  all? { |o| set.include?(o) }
            +end
            +
            +
            + +
            +

            + + #proper_superset?(set) ⇒ Boolean + + + + Also known as: + > + + + + +

            +
            + + +
            +
            +
            + +

            Returns:

            +
              + +
            • + + + (Boolean) + + + +
            • + +
            +

            Raises:

            + + +
            + + + + + + +
            +
            +
            +
            +113
            +114
            +115
            +116
            +117
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 113
            +
            +def proper_superset?(set)
            +  raise ArgumentError, "value must be a set" unless set.is_a?(Set)
            +  return false if size <= set.size
            +  set.all? { |o| include?(o) }
            +end
            +
            +
            + +
            +

            + + #reject!(&block) ⇒ Object + + + + + +

            + + + + +
            +
            +
            +
            +200
            +201
            +202
            +203
            +204
            +205
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 200
            +
            +def reject!(&block)
            +  return to_enum :reject! unless block_given?
            +  n = size
            +  delete_if(&block)
            +  size == n ? nil : self
            +end
            +
            +
            + +
            +

            + + #replace(enum) ⇒ Object + + + + + +

            + + + + +
            +
            +
            +
            +58
            +59
            +60
            +61
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 58
            +
            +def replace(enum)
            +  clear
            +  merge(enum)
            +end
            +
            +
            + +
            +

            + + #resetObject + + + + + +

            + + + + +
            +
            +
            +
            +318
            +319
            +320
            +321
            +322
            +323
            +324
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 318
            +
            +def reset
            +  if frozen?
            +    raise FrozenError, "can't modify frozen Set"
            +  else
            +    @hash.rehash
            +  end
            +end
            +
            +
            + +
            +

            + + #select!(&block) ⇒ Object + + + + Also known as: + filter! + + + + +

            + + + + +
            +
            +
            +
            +207
            +208
            +209
            +210
            +211
            +212
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 207
            +
            +def select!(&block)
            +  return to_enum :select! unless block_given?
            +  n = size
            +  keep_if(&block)
            +  size == n ? nil : self
            +end
            +
            +
            + +
            +

            + + #sizeObject + + + + Also known as: + length + + + + +

            +
            + +

            def freeze @hash.freeze super end

            + + +
            +
            +
            + + +
            + + + + + + +
            +
            +
            +
            +44
            +45
            +46
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 44
            +
            +def size
            +  @hash.size
            +end
            +
            +
            + +
            +

            + + #subset?(set) ⇒ Boolean + + + + Also known as: + <= + + + + +

            +
            + + +
            +
            +
            + +

            Returns:

            +
              + +
            • + + + (Boolean) + + + +
            • + +
            +

            Raises:

            + + +
            + + + + + + +
            +
            +
            +
            +120
            +121
            +122
            +123
            +124
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 120
            +
            +def subset?(set)
            +  raise ArgumentError, "value must be a set" unless set.is_a?(Set)
            +  return false if set.size < size
            +  all? { |o| set.include?(o) }
            +end
            +
            +
            + +
            +

            + + #subtract(enum) ⇒ Object + + + + + +

            + + + + +
            +
            +
            +
            +225
            +226
            +227
            +228
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 225
            +
            +def subtract(enum)
            +  __do_with_enum(enum) { |o| delete(o) }
            +  self
            +end
            +
            +
            + +
            +

            + + #superset?(set) ⇒ Boolean + + + + Also known as: + >= + + + + +

            +
            + + +
            +
            +
            + +

            Returns:

            +
              + +
            • + + + (Boolean) + + + +
            • + +
            +

            Raises:

            + + +
            + + + + + + +
            +
            +
            +
            +106
            +107
            +108
            +109
            +110
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 106
            +
            +def superset?(set)
            +  raise ArgumentError, "value must be a set" unless set.is_a?(Set)
            +  return false if size < set.size
            +  set.all? { |o| include?(o) }
            +end
            +
            +
            + +
            +

            + + #to_aObject + + + + + +

            + + + + +
            +
            +
            +
            +63
            +64
            +65
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 63
            +
            +def to_a
            +  @hash.keys
            +end
            +
            +
            + +
            +

            + + #|(enum) ⇒ Object + + + + Also known as: + +, union + + + + +

            + + + + +
            +
            +
            +
            +230
            +231
            +232
            +
            +
            # File 'mrbgems/mruby-set/mrblib/set.rb', line 230
            +
            +def |(enum)
            +  dup.merge(enum)
            +end
            +
            +
            + +
            + + + + + + + + \ No newline at end of file diff --git a/docs/api/Socket.html b/docs/api/Socket.html index f93f74b..82ab76f 100644 --- a/docs/api/Socket.html +++ b/docs/api/Socket.html @@ -6,17 +6,17 @@ Class: Socket - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -95,11 +95,6 @@ -
            -
            Includes:
            -
            Constants
            -
            - @@ -107,45 +102,13 @@
            Defined in:
            -
            mrbgems/mruby-socket/src/socket.c,
            - mrbgems/mruby-socket/mrblib/socket.rb,
            mrbgems/mruby-socket/mrblib/socket.rb,
            mrbgems/mruby-socket/mrblib/socket.rb
            -
            +
            mrbgems/mruby-socket/mrblib/socket.rb
            -

            Overview

            -
            -

            recvfrom_nonblock

            - - -
            -
            -
            - - -
            - -

            Defined Under Namespace

            -

            - - - Modules: Constants - - - - Classes: Option - - -

            - -

            Constant Summary

            - -

            Constants inherited - from IO

            -

            IO::BUF_SIZE, IO::SEEK_CUR, IO::SEEK_END, IO::SEEK_SET

            @@ -181,7 +144,8 @@

            -

            def self.accept_loop.

            +
            +

            def self.accept_loop.

            @@ -204,7 +168,8 @@

            -

            def self.getnameinfo def self.ip_address_list.

            +
            +

            def self.getnameinfo def self.ip_address_list.

            @@ -229,8 +194,7 @@

            -
            -
            +
            @@ -252,7 +216,8 @@

            -

            def self.tcp def self.tcp_server_loop def self.tcp_server_sockets def self.udp_server_loop def self.udp_server_loop_on def self.udp_server_recv def self.udp_server_sockets def self.unix(path) def self.unix_server_loop def self.unix_server_socket.

            +
            +

            def self.tcp def self.tcp_server_loop def self.tcp_server_sockets def self.udp_server_loop def self.udp_server_loop_on def self.udp_server_recv def self.udp_server_sockets def self.unix(path) def self.unix_server_loop def self.unix_server_socket.

            @@ -275,8 +240,7 @@

            -
            -
            +
            @@ -307,8 +271,7 @@

            -
            -
            +
            @@ -330,8 +293,7 @@

            -
            -
            +
            @@ -353,8 +315,7 @@

            -
            -
            +
            @@ -376,8 +337,7 @@

            -
            -
            +
            @@ -399,8 +359,7 @@

            -
            -
            +
            @@ -424,7 +383,8 @@

            -

            A new instance of Socket.

            +
            +

            A new instance of Socket.

            @@ -447,7 +407,8 @@

            -

            def ipv6only!.

            +
            +

            def ipv6only!.

            @@ -470,8 +431,7 @@

            -
            -
            +
            @@ -493,8 +453,7 @@

            -
            -
            +
            @@ -516,8 +475,7 @@

            -
            -
            +
            @@ -534,14 +492,8 @@

            - - - - - -

            Methods inherited from BasicSocket

            -

            #_is_socket=, #_recvfrom, #_setnonblock, #close, do_not_reverse_lookup, do_not_reverse_lookup=, for_fd, #getpeereid, #getpeername, #getsockname, #getsockopt, #local_address, #recv, #recv_nonblock, #remote_address, #send, #setsockopt, #shutdown, #sysread, #sysseek, #syswrite

            +

            do_not_reverse_lookup, do_not_reverse_lookup=, for_fd, #local_address, #recv_nonblock, #remote_address

            @@ -552,7 +504,7 @@

            Methods inherited from Methods inherited from IO

            -

            #<<, #_check_readable, #_read_buf, #close, #close_on_exec=, #close_on_exec?, #close_write, #closed?, #each, #each_byte, #eof?, #fileno, #flush, #getc, #gets, #hash, #initialize_copy, #isatty, #pid, pipe, popen, #pos, #pos=, #print, #printf, #puts, read, #read, #readchar, #readline, #readlines, #rewind, #seek, #sync, #sync=, #sysread, #sysseek, #syswrite, #ungetc, #write

            +

            #<<, #each, #each_byte, #each_char, #hash, pipe, popen, #pos=, #print, #printf, #puts, read, #rewind, #ungetbyte

            Constructor Details

            @@ -567,7 +519,8 @@

            -

            Returns a new instance of Socket

            + +

            Returns a new instance of Socket.

            @@ -575,20 +528,20 @@

            -
            - +

            +
             
             
            +353
             354
            -355
            -356
            +355
            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 354
            +      
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 353
             
             def initialize(domain, type, protocol=0)
               super(Socket._socket(domain, type, protocol), "r+")
            @@ -616,7 +569,8 @@ 

            -

            def self.accept_loop

            + +

            def self.accept_loop

            @@ -624,14 +578,15 @@

            -
            - +

            +
             
             
            +359
             360
             361
             362
            @@ -640,11 +595,10 @@ 

            365 366 367 -368 -369

            +368
            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 360
            +      
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 359
             
             def self.getaddrinfo(nodename, servname, family=nil, socktype=nil, protocol=nil, flags=0)
               Addrinfo.getaddrinfo(nodename, servname, family, socktype, protocol, flags).map { |ai|
            @@ -672,8 +626,8 @@ 

            -

            def self.getnameinfo -def self.ip_address_list

            + +

            def self.getnameinfo def self.ip_address_list

            @@ -681,20 +635,20 @@

            -
            - +

            +
             
             
            +373
             374
            -375
            -376
            +375
            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 374
            +      
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 373
             
             def self.open(*args)
               new(args)
            @@ -723,13 +677,13 @@ 

             
             
            +377
             378
             379
            -380
            -381
            +380

            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 378
            +      
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 377
             
             def self.sockaddr_in(port, host)
               ai = Addrinfo.getaddrinfo(host, port, nil, Socket::SOCK_DGRAM)[0]
            @@ -751,16 +705,8 @@ 

            -

            def self.tcp -def self.tcp_server_loop -def self.tcp_server_sockets -def self.udp_server_loop -def self.udp_server_loop_on -def self.udp_server_recv -def self.udp_server_sockets -def self.unix(path) -def self.unix_server_loop -def self.unix_server_socket

            + +

            def self.tcp def self.tcp_server_loop def self.tcp_server_sockets def self.udp_server_loop def self.udp_server_loop_on def self.udp_server_recv def self.udp_server_sockets def self.unix(path) def self.unix_server_loop def self.unix_server_socket

            @@ -768,20 +714,20 @@

            -
            - +

            +
             
             
            +393
             394
            -395
            -396
            +395
            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 394
            +      
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 393
             
             def self.unpack_sockaddr_in(sa)
               Addrinfo.new(sa).ip_unpack.reverse
            @@ -806,12 +752,12 @@ 

             
             
            +397
             398
            -399
            -400
            +399

            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 398
            +      
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 397
             
             def self.unpack_sockaddr_un(sa)
               Addrinfo.new(sa).unix_path
            @@ -842,13 +788,13 @@ 

             
             
            +407
             408
             409
            -410
            -411
            +410

            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 408
            +      
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 407
             
             def accept
               fd, addr = self.sysaccept
            @@ -874,17 +820,17 @@ 

             
             
            +412
             413
             414
             415
             416
             417
             418
            -419
            -420
            +419

            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 413
            +      
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 412
             
             def accept_nonblock
               begin
            @@ -914,14 +860,14 @@ 

             
             
            +421
             422
             423
             424
            -425
            -426
            +425

            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 422
            +      
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 421
             
             def bind(sockaddr)
               sockaddr = sockaddr.to_sockaddr if sockaddr.is_a? Addrinfo
            @@ -948,14 +894,14 @@ 

             
             
            +427
             428
             429
             430
            -431
            -432
            +431

            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 428
            +      
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 427
             
             def connect(sockaddr)
               sockaddr = sockaddr.to_sockaddr if sockaddr.is_a? Addrinfo
            @@ -982,17 +928,17 @@ 

             
             
            +433
             434
             435
             436
             437
             438
             439
            -440
            -441
            +440

            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 434
            +      
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 433
             
             def connect_nonblock(sockaddr)
               begin
            @@ -1018,7 +964,8 @@ 

            -

            def ipv6only!

            + +

            def ipv6only!

            @@ -1026,21 +973,21 @@

            -
            - +

            +
             
             
            +444
             445
             446
            -447
            -448
            +447
            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 445
            +      
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 444
             
             def listen(backlog)
               Socket._listen(self.fileno, backlog)
            @@ -1066,14 +1013,14 @@ 

             
             
            +449
             450
             451
             452
            -453
            -454
            +453

            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 450
            +      
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 449
             
             def recvfrom(maxlen, flags=0)
               msg, sa = _recvfrom(maxlen, flags)
            @@ -1100,17 +1047,17 @@ 

             
             
            +455
             456
             457
             458
             459
             460
             461
            -462
            -463
            +462

            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 456
            +      
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 455
             
             def recvfrom_nonblock(*args)
               begin
            @@ -1140,12 +1087,12 @@ 

             
             
            +464
             465
            -466
            -467
            +466

            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 465
            +      
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 464
             
             def sysaccept
               Socket._accept2(self.fileno)
            @@ -1159,11 +1106,11 @@ 

            - + diff --git a/docs/api/Socket/Option.html b/docs/api/Socket/Option.html deleted file mode 100644 index 107c224..0000000 --- a/docs/api/Socket/Option.html +++ /dev/null @@ -1,957 +0,0 @@ - - - - - - - Class: Socket::Option - - — Documentation by YARD 0.9.20 - - - - - - - - - - - - - - - - - - - - - - - -
            - - -

            Class: Socket::Option - - - -

            -
            - -
            -
            Inherits:
            -
            - Object - -
              -
            • Object
            • - - - -
            - show all - -
            -
            - - - - - - - - - - - -
            -
            Defined in:
            -
            mrbgems/mruby-socket/mrblib/socket.rb
            -
            - -
            - - - - - -

            Instance Attribute Summary collapse

            -
              - -
            • - - - #data ⇒ Object - - - - - - - - - readonly - - - - - - - - - -

              def self.linger(family, level, optname, integer) end.

              -
              - -
            • - - -
            • - - - #family ⇒ Object - - - - - - - - - readonly - - - - - - - - - -

              def self.linger(family, level, optname, integer) end.

              -
              - -
            • - - -
            • - - - #level ⇒ Object - - - - - - - - - readonly - - - - - - - - - -

              def self.linger(family, level, optname, integer) end.

              -
              - -
            • - - -
            • - - - #optname ⇒ Object - - - - - - - - - readonly - - - - - - - - - -

              def self.linger(family, level, optname, integer) end.

              -
              - -
            • - - -
            - - - - - -

            - Class Method Summary - collapse -

            - - - -

            - Instance Method Summary - collapse -

            - - - - -
            -

            Constructor Details

            - -
            -

            - - #initialize(family, level, optname, data) ⇒ Option - - - - - -

            -
            -

            Returns a new instance of Option

            - - -
            -
            -
            - - -
            - - - - - - -
            -
            -
            -
            -579
            -580
            -581
            -582
            -583
            -584
            -
            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 579
            -
            -def initialize(family, level, optname, data)
            -  @family  = family
            -  @level   = level
            -  @optname = optname
            -  @data    = data
            -end
            -
            -
            - -
            - -
            -

            Instance Attribute Details

            - - - -
            -

            - - #dataObject (readonly) - - - - - -

            -
            -

            def self.linger(family, level, optname, integer) -end

            - - -
            -
            -
            - - -
            - - - - - - -
            -
            -
            -
            -597
            -598
            -599
            -
            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 597
            -
            -def data
            -  @data
            -end
            -
            -
            - - - -
            -

            - - #familyObject (readonly) - - - - - -

            -
            -

            def self.linger(family, level, optname, integer) -end

            - - -
            -
            -
            - - -
            - - - - - - -
            -
            -
            -
            -597
            -598
            -599
            -
            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 597
            -
            -def family
            -  @family
            -end
            -
            -
            - - - -
            -

            - - #levelObject (readonly) - - - - - -

            -
            -

            def self.linger(family, level, optname, integer) -end

            - - -
            -
            -
            - - -
            - - - - - - -
            -
            -
            -
            -597
            -598
            -599
            -
            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 597
            -
            -def level
            -  @level
            -end
            -
            -
            - - - -
            -

            - - #optnameObject (readonly) - - - - - -

            -
            -

            def self.linger(family, level, optname, integer) -end

            - - -
            -
            -
            - - -
            - - - - - - -
            -
            -
            -
            -597
            -598
            -599
            -
            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 597
            -
            -def optname
            -  @optname
            -end
            -
            -
            - -
            - - -
            -

            Class Method Details

            - - -
            -

            - - .bool(family, level, optname, bool) ⇒ Object - - - - - -

            - - - - -
            -
            -
            -
            -586
            -587
            -588
            -
            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 586
            -
            -def self.bool(family, level, optname, bool)
            -  self.new(family, level, optname, [(bool ? 1 : 0)].pack('i'))
            -end
            -
            -
            - -
            -

            - - .int(family, level, optname, integer) ⇒ Object - - - - - -

            - - - - -
            -
            -
            -
            -590
            -591
            -592
            -
            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 590
            -
            -def self.int(family, level, optname, integer)
            -  self.new(family, level, optname, [integer].pack('i'))
            -end
            -
            -
            - -
            - -
            -

            Instance Method Details

            - - -
            -

            - - #boolObject - - - - - -

            - - - - -
            -
            -
            -
            -599
            -600
            -601
            -
            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 599
            -
            -def bool
            -  @data.unpack('i')[0] != 0
            -end
            -
            -
            - -
            -

            - - #inspectObject - - - - - -

            - - - - -
            -
            -
            -
            -603
            -604
            -605
            -
            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 603
            -
            -def inspect
            -  "#<Socket::Option: family:#{@family} level:#{@level} optname:#{@optname} #{@data.inspect}>"
            -end
            -
            -
            - -
            -

            - - #intObject - - - - - -

            - - - - -
            -
            -
            -
            -607
            -608
            -609
            -
            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 607
            -
            -def int
            -  @data.unpack('i')[0]
            -end
            -
            -
            - -
            -

            - - #lingerObject - - - - - -

            -
            - - - -
            -
            -
            - -

            Raises:

            - - -
            - - - - - - -
            -
            -
            -
            -611
            -612
            -613
            -
            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 611
            -
            -def linger
            -  raise NotImplementedError.new
            -end
            -
            -
            - -
            -

            - - #unpack(template) ⇒ Object - - - - - -

            -
            - - - -
            -
            -
            - -

            Raises:

            - - -
            - - - - - - -
            -
            -
            -
            -615
            -616
            -617
            -
            -
            # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 615
            -
            -def unpack(template)
            -  raise NotImplementedError.new
            -end
            -
            -
            - -
            - -
            - - - -
            - - \ No newline at end of file diff --git a/docs/api/SocketError.html b/docs/api/SocketError.html index bc3ccc3..77b9349 100644 --- a/docs/api/SocketError.html +++ b/docs/api/SocketError.html @@ -6,17 +6,17 @@ Exception: SocketError - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -73,14 +73,12 @@
            Inherits:
            - StandardError + StandardError
            • Object
            • - - - + @@ -116,36 +114,14 @@ - - - - - - - - - - - -

              Method Summary

              - -

              Methods inherited from Exception

              -

              #backtrace, #exception, #initialize, #inspect, #message, #set_backtrace, #to_s

              -
              -

              Constructor Details

              - -

              This class inherits a constructor from Exception

              - -
              - - + diff --git a/docs/api/StandardError.html b/docs/api/StandardError.html deleted file mode 100644 index 2fadf13..0000000 --- a/docs/api/StandardError.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - Exception: StandardError - - — Documentation by YARD 0.9.20 - - - - - - - - - - - - - - - - - - - - - - - -
              - - -

              Exception: StandardError - - - -

              -
              - -
              -
              Inherits:
              -
              - Exception - -
                -
              • Object
              • - - - - - -
              - show all - -
              -
              - - - - - - - - - - - -
              -
              Defined in:
              -
              src/error.c
              -
              - -
              - -

              Overview

              -
              -

              15.2.23

              - - -
              -
              -
              - - -
              - - - - - - - - - - - - - - - - -

              Method Summary

              - -

              Methods inherited from Exception

              -

              #backtrace, #exception, #initialize, #inspect, #message, #set_backtrace, #to_s

              -
              -

              Constructor Details

              - -

              This class inherits a constructor from Exception

              - -
              - - -
              - - - -
              - - \ No newline at end of file diff --git a/docs/api/StopIteration.html b/docs/api/StopIteration.html index 16bdec3..5d4f5a6 100644 --- a/docs/api/StopIteration.html +++ b/docs/api/StopIteration.html @@ -6,17 +6,17 @@ Exception: StopIteration - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -78,9 +78,7 @@
              • Object
              • - - - + @@ -136,7 +134,8 @@

                Instance Attribute Summary collaps -

                Returns the value of attribute result.

                +
                +

                Returns the value of attribute result.

                @@ -155,28 +154,6 @@

                Instance Attribute Summary collaps - - - - - - - - - - - -

                Method Summary

                - -

                Methods inherited from Exception

                -

                #backtrace, #exception, #initialize, #inspect, #message, #set_backtrace, #to_s

                -
                -

                Constructor Details

                - -

                This class inherits a constructor from Exception

                - -
                -

                Instance Attribute Details

                @@ -193,7 +170,8 @@

                -

                Returns the value of attribute result

                + +

                Returns the value of attribute result.

                @@ -201,20 +179,20 @@

                -
                - +

                +
                 
                 
                -58
                -59
                -60
                +75 +76 +77
                -
                # File 'mrblib/10error.rb', line 58
                +      
                # File 'mrblib/10error.rb', line 75
                 
                 def result
                   @result
                @@ -229,11 +207,11 @@ 

                - + diff --git a/docs/api/String.html b/docs/api/String.html index a47a1e4..34b7ccb 100644 --- a/docs/api/String.html +++ b/docs/api/String.html @@ -6,17 +6,17 @@ Class: String - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -104,7 +104,7 @@
                Defined in:
                mrblib/string.rb,
                - src/string.c,
                mrbgems/mruby-sprintf/mrblib/string.rb,
                mrbgems/mruby-string-ext/mrblib/string.rb
                + mrbgems/mruby-sprintf/mrblib/string.rb,
                mrbgems/mruby-string-ext/mrblib/string.rb
                @@ -112,7 +112,8 @@

                Overview

                -

                String

                + +

                String

                ISO 15.2.10

                @@ -122,8 +123,8 @@

                Overview

                -
                - +
                + @@ -156,8 +157,7 @@

                -
                -
                +
                @@ -165,7 +165,7 @@

              • - #*(integer) ⇒ String + #__upto_endless(&block) ⇒ Object @@ -179,8 +179,7 @@

                -

                Copy—Returns a new String containing integer copies of the receiver.

                -
                +

              • @@ -188,7 +187,7 @@

              • - #+(other_str) ⇒ String + #center(width, padstr = ' ') ⇒ Object @@ -202,7 +201,8 @@

                -

                Concatenation—Returns a new String containing other_str concatenated to str.

                +
                +

                call-seq: str.center(width, padstr=‘ ’) -> new_str.

              • @@ -211,7 +211,7 @@

              • - #<< ⇒ Object + #chars(&block) ⇒ Object @@ -225,8 +225,7 @@

                -

                Append—Concatenates the given object to str.

                -
                +

              • @@ -234,7 +233,7 @@

              • - #<=>(other_str) ⇒ -1, ... + #clear ⇒ Object @@ -248,7 +247,8 @@

                -

                Comparison—Returns -1 if other_str is less than, 0 if other_str is equal to, and +1 if other_str is greater than str.

                +
                +

                call-seq: string.clear -> string.

              • @@ -257,10 +257,12 @@

              • - #==(obj) ⇒ Boolean + #codepoints(&block) ⇒ Object + (also: #each_codepoint) + @@ -271,8 +273,7 @@

                -

                Equality— If obj is not a String, returns false.

                -
                +

              • @@ -280,7 +281,7 @@

              • - #[] ⇒ Object + #each_byte(&block) ⇒ Object @@ -294,7 +295,8 @@

                -

                Element Reference—If passed a single Fixnum, returns the code of the character at that position.

                +
                +

                Call the given block for each byte of self.

              • @@ -303,7 +305,7 @@

              • - #[]= ⇒ Object + #each_char(&block) ⇒ Object @@ -317,7 +319,8 @@

                -

                Modify +self+ by replacing the content of +self+.

                +
                +

                Call the given block for each character of self.

              • @@ -326,7 +329,7 @@

              • - #__lines ⇒ Object + #each_line(separator = "\n", &block) ⇒ Object @@ -341,6 +344,7 @@

                +

                Calls the given block for each line and pass the respective line.

              • @@ -349,7 +353,7 @@

              • - #__sub_replace(pre, m, post) ⇒ Object + #gsub(*args, &block) ⇒ Object @@ -363,7 +367,8 @@

                -

                private method for gsub/sub.

                +
                +

                Replace all matches of pattern with replacement.

              • @@ -372,7 +377,7 @@

              • - #bytes ⇒ Object + #gsub!(*args, &block) ⇒ Object @@ -386,7 +391,8 @@

                -

                Returns an array of bytes in str.

                +
                +

                Replace all matches of pattern with replacement.

              • @@ -395,7 +401,7 @@

              • - #bytesize ⇒ Object + #insert(idx, str) ⇒ Object @@ -410,6 +416,7 @@

                +

                call-seq: str.insert(index, other_str) -> str.

              • @@ -418,7 +425,7 @@

              • - #byteslice ⇒ Object + #lines(&blk) ⇒ Object @@ -432,7 +439,8 @@

                -

                Byte Reference—If passed a single Integer, returns a substring of one byte at that position.

                +
                +

                call-seq: string.lines -> array of string string.lines {|s| block} -> array of string.

              • @@ -441,7 +449,7 @@

              • - #capitalize ⇒ String + #ljust(idx, padstr = ' ') ⇒ Object @@ -455,7 +463,8 @@

                -

                Returns a copy of str with the first character converted to uppercase and the remainder to lowercase.

                +
                +

                call-seq: str.ljust(integer, padstr=‘ ’) -> new_str.

              • @@ -464,7 +473,7 @@

              • - #capitalize! ⇒ String? + #lstrip ⇒ Object @@ -478,7 +487,8 @@

                -

                Modifies str by converting the first character to uppercase and the remainder to lowercase.

                +
                +

                call-seq: str.lstrip -> new_str.

              • @@ -487,7 +497,7 @@

              • - #casecmp(str) ⇒ Object + #lstrip! ⇒ Object @@ -501,7 +511,8 @@

                -

                call-seq: str.casecmp(other_str) -> -1, 0, +1 or nil.

                +
                +

                call-seq: str.lstrip! -> self or nil.

              • @@ -510,7 +521,7 @@

              • - #casecmp?(str) ⇒ Boolean + #partition(sep) ⇒ Object @@ -524,8 +535,7 @@

                -

                call-seq: str.casecmp?(other) -> true, false, or nil.

                -
                +

              • @@ -533,7 +543,7 @@

              • - #chars(&block) ⇒ Object + #prepend(*args) ⇒ Object @@ -548,6 +558,7 @@

                +

                call-seq: str.prepend(other_str) -> str.

              • @@ -556,7 +567,7 @@

              • - #chomp(separator = "\n") ⇒ String + #rjust(idx, padstr = ' ') ⇒ Object @@ -570,7 +581,8 @@

                -

                Returns a new String with the given record separator removed from the end of str (if present).

                +
                +

                call-seq: str.rjust(integer, padstr=‘ ’) -> new_str.

              • @@ -579,7 +591,7 @@

              • - #chomp!(separator = "\n") ⇒ String? + #rpartition(sep) ⇒ Object @@ -593,8 +605,7 @@

                -

                Modifies str in place as described for String#chomp, returning str, or nil if no modifications were made.

                -
                +

              • @@ -602,7 +613,7 @@

              • - #chop ⇒ String + #rstrip ⇒ Object @@ -616,7 +627,8 @@

                -

                Returns a new String with the last character removed.

                +
                +

                call-seq: str.rstrip -> new_str.

              • @@ -625,7 +637,7 @@

              • - #chop! ⇒ String? + #rstrip! ⇒ Object @@ -639,7 +651,8 @@

                -

                Processes str as for String#chop, returning str, or nil if str is the empty string.

                +
                +

                call-seq: str.rstrip! -> self or nil.

              • @@ -648,7 +661,7 @@

              • - #chr ⇒ String + #slice!(arg1, arg2 = nil) ⇒ Object @@ -662,7 +675,8 @@

                -

                Returns a one-character string at the beginning of the string.

                +
                +

                call-seq: str.slice!(fixnum) -> new_str or nil str.slice!(fixnum, fixnum) -> new_str or nil str.slice!(range) -> new_str or nil str.slice!(other_str) -> new_str or nil.

              • @@ -671,7 +685,7 @@

              • - #clear ⇒ Object + #strip ⇒ Object @@ -685,7 +699,8 @@

                -

                call-seq: string.clear -> string.

                +
                +

                call-seq: str.strip -> new_str.

              • @@ -694,12 +709,10 @@

              • - #codepoints(&block) ⇒ Object + #strip! ⇒ Object - (also: #each_codepoint) - @@ -711,6 +724,7 @@

                +

                call-seq: str.strip! -> str or nil.

              • @@ -719,7 +733,7 @@

              • - #concat ⇒ Object + #sub(*args, &block) ⇒ Object @@ -733,7 +747,8 @@

                -

                Append—Concatenates the given object to str.

                +
                +

                Replace only the first match of pattern with replacement.

              • @@ -742,7 +757,7 @@

              • - #count ⇒ Object + #sub!(*args, &block) ⇒ Object @@ -756,7 +771,8 @@

                -

                call_seq: str.count([other_str]) -> integer.

                +
                +

                Replace only the first match of pattern with replacement.

              • @@ -765,7 +781,7 @@

              • - #cover?(obj) ⇒ Boolean + #upto(max, exclusive = false, &block) ⇒ Object @@ -779,9514 +795,343 @@

                -

                Returns true if +obj+ is between the begin and end of the range.

                +
                +

                call-seq: str.upto(other_str, exclusive=false) {|s| block } -> str str.upto(other_str, exclusive=false) -> an_enumerator.

              • -
              • - - - #delete ⇒ Object - - - - + + + - -
                -
                -
              • +

                Methods included from Comparable

                +

                #<, #<=, #==, #>, #>=, #between?, #clamp

                - -
              • - - - #delete! ⇒ Object - + +
                +

                Instance Method Details

                - - - - - - +
                +

                + #%(args) ⇒ Object -
                -
                + -

              • + + + + + +
                +
                 
                -      
                -        
              • - - - #delete_prefix(prefix) ⇒ String - +2 +3 +4 +5 +6 +7 +8
              • +
                +
                # File 'mrbgems/mruby-sprintf/mrblib/string.rb', line 2
                +
                +def %(args)
                +  if args.is_a? Array
                +    sprintf(self, *args)
                +  else
                +    sprintf(self, args)
                +  end
                +end
                +
                +
                - - - - - - +
                +

                + #__upto_endless(&block) ⇒ Object -

                Returns a copy of str with leading prefix deleted.

                -
                + - +

                + + + + +
                +
                 
                -      
                -        
              • - - - #delete_prefix!(prefix) ⇒ self? - +442 +443 +444 +445 +446 +447 +448 +449 +450 +451 +452 +453 +454 +455 +456 +457 +458 +459 +460 +461
              • +
                +
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 442
                +
                +def __upto_endless(&block)
                +  len = self.length
                +  # both edges are all digits
                +  bi = self.to_i(10)
                +  if bi > 0 or bi == "0"*len
                +    while true
                +      s = bi.to_s
                +      s = s.rjust(len, "0") if s.length < len
                +      yield s
                +      bi += 1
                +    end
                +    return self
                +  end
                +  bs = self
                +  while true
                +    yield bs
                +    bs = bs.succ
                +  end
                +  self
                +end
                +
                +
                - - - - - - +
                +

                + #center(width, padstr = ' ') ⇒ Object -

                Deletes leading prefix from str, returning nil if no change was made.

                -
                - - - -
              • - - - #delete_suffix(suffix) ⇒ String + +
              • +
                +

                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.

                - -

                Returns a copy of str with leading suffix deleted.

                -
                - - +
                "hello".center(4)         #=> "hello"
                +"hello".center(20)        #=> "       hello        "
                +"hello".center(20, '123') #=> "1231231hello12312312"
                +
                - -
              • - - - #delete_suffix!(suffix) ⇒ self? - - - - - - - +
              • +
                +
                +

                Raises:

                + - -

                Deletes trailing suffix from str, returning nil if no change was made.

                -
                - - +
                - -
              • - - - #downcase ⇒ String - + + + + + +
                +
                 
                +
                +283
                +284
                +285
                +286
                +287
                +288
                +289
                +290
                +
                +
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 283
                +
                +def center(width, padstr = ' ')
                +  raise ArgumentError, 'zero width padding' if padstr == ''
                +  return self if width <= self.size
                +  width -= self.size
                +  pad1 = width / 2
                +  pad2 = width - pad1
                +  (padstr*pad1)[0,pad1] + self + (padstr*pad2)[0,pad2]
                +end
                +
                +
              • - +
                +

                + #chars(&block) ⇒ Object + + - - - - - -

                Returns a copy of str with all uppercase letters replaced with their lowercase counterparts.

                -
                - - - - -
              • - - - #downcase! ⇒ String? - - - - - - - - - - - - - -

                Downcases the contents of str, returning nil if no changes were made.

                -
                - -
              • - - -
              • - - - #dump ⇒ String - - - - - - - - - - - - - -

                Produces a version of str with all nonprinting characters replaced by \nnn notation and all special characters escaped.

                -
                - -
              • - - -
              • - - - #each_byte(&block) ⇒ Object - - - - - - - - - - - - - -

                Call the given block for each byte of +self+.

                -
                - -
              • - - -
              • - - - #each_char(&block) ⇒ Object - - - - - - - - - - - - - -

                Call the given block for each character of +self+.

                -
                - -
              • - - -
              • - - - #each_line(separator = "\n", &block) ⇒ Object - - - - - - - - - - - - - -

                Calls the given block for each line and pass the respective line.

                -
                - -
              • - - -
              • - - - #empty? ⇒ Boolean - - - - - - - - - - - - - -

                Returns true if str has a length of zero.

                -
                - -
              • - - -
              • - - - #end_with?([suffixes]) ⇒ Boolean - - - - - - - - - - - - - -

                Returns true if +str+ ends with one of the +suffixes+ given.

                -
                - -
              • - - -
              • - - - #eql?(other) ⇒ Boolean - - - - - - - - - - - - - -

                Two strings are equal if the have the same length and content.

                -
                - -
              • - - -
              • - - - #getbyte(index) ⇒ 0 .. 255 - - - - - - - - - - - - - -

                returns the indexth byte as an integer.

                -
                - -
              • - - -
              • - - - #gsub(*args, &block) ⇒ Object - - - - - - - - - - - - - -

                Replace all matches of +pattern+ with +replacement+.

                -
                - -
              • - - -
              • - - - #gsub!(*args, &block) ⇒ Object - - - - - - - - - - - - - -

                Replace all matches of +pattern+ with +replacement+.

                -
                - -
              • - - -
              • - - - #hash ⇒ Fixnum - - - - - - - - - - - - - -

                Return a hash based on the string’s length and content.

                -
                - -
              • - - -
              • - - - #hex ⇒ Object - - - - - - - - - - - - - -
                -
                - -
              • - - -
              • - - - #include? ⇒ Object - - - - - - - - - - - - - -

                Returns true if str contains the given string or character.

                -
                - -
              • - - -
              • - - - #index(substring[, offset]) ⇒ Fixnum? - - - - - - - - - - - - - -

                Returns the index of the first occurrence of the given substring.

                -
                - -
              • - - -
              • - - - #new(str = "") ⇒ String - - - - - - - constructor - - - - - - - - -

                Returns a new string object containing a copy of str.

                -
                - -
              • - - -
              • - - - #replace(other_str) ⇒ String - - - - - - - - - - - - - -

                s = “hello” #=> “hello” s.replace “world” #=> “world”.

                -
                - -
              • - - -
              • - - - #insert(idx, str) ⇒ Object - - - - - - - - - - - - - -

                call-seq: str.insert(index, other_str) -> str.

                -
                - -
              • - - -
              • - - - #inspect ⇒ String - - - - - - - - - - - - - -

                Returns a printable version of str, surrounded by quote marks, with special characters escaped.

                -
                - -
              • - - -
              • - - - #intern ⇒ Object - - - - - - - - - - - - - -

                Returns the Symbol corresponding to str, creating the symbol if it did not previously exist.

                -
                - -
              • - - -
              • - - - #last ⇒ Object - - - - - - - - - - - - - -

                Returns the last object in the range, or an array of the last +n+ elements.

                -
                - -
              • - - -
              • - - - #length ⇒ Integer - - - - - - - - - - - - - -

                Same as sym.to_s.length.

                -
                - -
              • - - -
              • - - - #lines(&blk) ⇒ Object - - - - - - - - - - - - - -
                - - - - - - -
                call-seq: string.lines -> array of string string.lines sblock -> array of string.
                -
                - -
              • - - -
              • - - - #ljust(idx, padstr = ' ') ⇒ Object - - - - - - - - - - - - - -

                call-seq: str.ljust(integer, padstr=’ ‘) -> new_str.

                -
                - -
              • - - -
              • - - - #lstrip ⇒ Object - - - - - - - - - - - - - -

                call-seq: str.lstrip -> new_str.

                -
                - -
              • - - -
              • - - - #lstrip! ⇒ Object - - - - - - - - - - - - - -

                call-seq: str.lstrip! -> self or nil.

                -
                - -
              • - - -
              • - - - #next ⇒ Object - - - - - - - - - - - - - -
                -
                - -
              • - - -
              • - - - #succ ⇒ String - - - - - - - - - - - - - -

                Returns next sequence of the string;.

                -
                - -
              • - - -
              • - - - #oct ⇒ Object - - - - - - - - - - - - - -
                -
                - -
              • - - -
              • - - - #ord ⇒ Object - - - - - - - - - - - - - -
                -
                - -
              • - - -
              • - - - #partition(sep) ⇒ Object - - - - - - - - - - - - - -
                -
                - -
              • - - -
              • - - - #prepend(arg) ⇒ Object - - - - - - - - - - - - - -

                call-seq: str.prepend(other_str) -> str.

                -
                - -
              • - - -
              • - - - #replace(other_str) ⇒ String - - - - - - - - - - - - - -

                s = “hello” #=> “hello” s.replace “world” #=> “world”.

                -
                - -
              • - - -
              • - - - #reverse ⇒ String - - - - - - - - - - - - - -

                Returns a new string with the characters from str in reverse order.

                -
                - -
              • - - -
              • - - - #reverse! ⇒ String - - - - - - - - - - - - - -

                Reverses str in place.

                -
                - -
              • - - -
              • - - - #rindex(substring[, offset]) ⇒ Fixnum? - - - - - - - - - - - - - -

                Returns the index of the last occurrence of the given substring.

                -
                - -
              • - - -
              • - - - #rjust(idx, padstr = ' ') ⇒ Object - - - - - - - - - - - - - -

                call-seq: str.rjust(integer, padstr=’ ‘) -> new_str.

                -
                - -
              • - - -
              • - - - #rpartition(sep) ⇒ Object - - - - - - - - - - - - - -
                -
                - -
              • - - -
              • - - - #rstrip ⇒ Object - - - - - - - - - - - - - -

                call-seq: str.rstrip -> new_str.

                -
                - -
              • - - -
              • - - - #rstrip! ⇒ Object - - - - - - - - - - - - - -

                call-seq: str.rstrip! -> self or nil.

                -
                - -
              • - - -
              • - - - #setbyte(index, integer) ⇒ Integer - - - - - - - - - - - - - -

                modifies the indexth byte as integer.

                -
                - -
              • - - -
              • - - - #length ⇒ Integer - - - - - - - - - - - - - -

                Same as sym.to_s.length.

                -
                - -
              • - - -
              • - - - #slice ⇒ Object - - - - - - - - - - - - - -

                Element Reference—If passed a single Fixnum, returns the code of the character at that position.

                -
                - -
              • - - -
              • - - - #slice!(arg1, arg2 = nil) ⇒ Object - - - - - - - - - - - - - -

                call-seq: str.slice!(fixnum) -> new_str or nil str.slice!(fixnum, fixnum) -> new_str or nil str.slice!(range) -> new_str or nil str.slice!(other_str) -> new_str or nil.

                -
                - -
              • - - -
              • - - - #split(pattern = "\n", [limit]) ⇒ Array - - - - - - - - - - - - - -

                Divides str into substrings based on a delimiter, returning an array of these substrings.

                -
                - -
              • - - -
              • - - - #squeeze([other_str]) ⇒ String - - - - - - - - - - - - - -

                Builds a set of characters from the other_str parameter(s) using the procedure described for String#count.

                -
                - -
              • - - -
              • - - - #squeeze!([other_str]) ⇒ String? - - - - - - - - - - - - - -

                Squeezes str in place, returning either str, or nil if no changes were made.

                -
                - -
              • - - -
              • - - - #start_with?([prefixes]) ⇒ Boolean - - - - - - - - - - - - - -

                Returns true if +str+ starts with one of the +prefixes+ given.

                -
                - -
              • - - -
              • - - - #strip ⇒ Object - - - - - - - - - - - - - -

                call-seq: str.strip -> new_str.

                -
                - -
              • - - -
              • - - - #strip! ⇒ Object - - - - - - - - - - - - - -

                call-seq: str.strip! -> str or nil.

                -
                - -
              • - - -
              • - - - #sub(*args, &block) ⇒ Object - - - - - - - - - - - - - -

                Replace only the first match of +pattern+ with +replacement+.

                -
                - -
              • - - -
              • - - - #sub!(*args, &block) ⇒ Object - - - - - - - - - - - - - -

                Replace only the first match of +pattern+ with +replacement+.

                -
                - -
              • - - -
              • - - - #succ ⇒ Object - - - - - - - - - - - - - -
                -
                - -
              • - - -
              • - - - #succ ⇒ String - - - - - - - - - - - - - -

                Returns next sequence of the string;.

                -
                - -
              • - - -
              • - - - #swapcase ⇒ String - - - - - - - - - - - - - -

                Returns a copy of str with uppercase alphabetic characters converted to lowercase and lowercase characters converted to uppercase.

                -
                - -
              • - - -
              • - - - #swapcase! ⇒ String? - - - - - - - - - - - - - -

                Equivalent to String#swapcase, but modifies the receiver in place, returning str, or nil if no changes were made.

                -
                - -
              • - - -
              • - - - #to_f ⇒ Float - - - - - - - - - - - - - -

                Returns the result of interpreting leading characters in str as a floating point number.

                -
                - -
              • - - -
              • - - - #to_i(base = 10) ⇒ Integer - - - - - - - - - - - - - -

                Returns the result of interpreting leading characters in str as an integer base base (between 2 and 36).

                -
                - -
              • - - -
              • - - - #to_s ⇒ String - - - - - - - - - - - - - -

                Returns the receiver.

                -
                - -
              • - - -
              • - - - #to_s ⇒ String - - - - - - - - - - - - - -

                Returns the receiver.

                -
                - -
              • - - -
              • - - - #to_sym ⇒ Object - - - - - - - - - - - - - -

                Returns the Symbol corresponding to str, creating the symbol if it did not previously exist.

                -
                - -
              • - - -
              • - - - #tr(from_str, to_str) ⇒ String - - - - - - - - - - - - - -

                Returns a copy of str with the characters in from_str replaced by the corresponding characters in to_str.

                -
                - -
              • - - -
              • - - - #tr!(from_str, to_str) ⇒ String? - - - - - - - - - - - - - -

                Translates str in place, using the same rules as String#tr.

                -
                - -
              • - - -
              • - - - #tr_s(from_str, to_str) ⇒ String - - - - - - - - - - - - - -

                Processes a copy of str as described under String#tr, then removes duplicate characters in regions that were affected by the translation.

                -
                - -
              • - - -
              • - - - #tr_s!(from_str, to_str) ⇒ String? - - - - - - - - - - - - - -

                Performs String#tr_s processing on str in place, returning str, or nil if no changes were made.

                -
                - -
              • - - -
              • - - - #upcase ⇒ String - - - - - - - - - - - - - -

                Returns a copy of str with all lowercase letters replaced with their uppercase counterparts.

                -
                - -
              • - - -
              • - - - #upcase! ⇒ String? - - - - - - - - - - - - - -

                Upcases the contents of str, returning nil if no changes were made.

                -
                - -
              • - - -
              • - - - #upto(max, exclusive = false, &block) ⇒ Object - - - - - - - - - - - - - -
                - - - - - - - -
                call-seq: str.upto(other_str, exclusive=false) {sblock } -> str str.upto(other_str, exclusive=false) -> an_enumerator.
                -
                - -
              • - - - - - - - - - - - - - - -

                Methods included from Comparable

                -

                #<, #<=, #>, #>=, #between?, #clamp

                -
                -

                Constructor Details

                - -
                -

                - - #new(str = "") ⇒ String - - - - - -

                -
                -

                Returns a new string object containing a copy of str.

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -1901
                -1902
                -1903
                -1904
                -1905
                -1906
                -1907
                -1908
                -1909
                -1910
                -1911
                -1912
                -
                -
                # File 'src/string.c', line 1901
                -
                -static mrb_value
                -mrb_str_init(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_value str2;
                -
                -  if (mrb_get_args(mrb, "|S", &str2) == 0) {
                -    struct RString *s = str_new(mrb, 0, 0);
                -    str2 = mrb_obj_value(s);
                -  }
                -  str_replace(mrb, mrb_str_ptr(self), mrb_str_ptr(str2));
                -  return self;
                -}
                -
                -
                - -
                - - -
                -

                Instance Method Details

                - - -
                -

                - - #%(args) ⇒ Object - - - - - -

                - - - - -
                -
                -
                -
                -2
                -3
                -4
                -5
                -6
                -7
                -8
                -
                -
                # File 'mrbgems/mruby-sprintf/mrblib/string.rb', line 2
                -
                -def %(args)
                -  if args.is_a? Array
                -    sprintf(self, *args)
                -  else
                -    sprintf(self, args)
                -  end
                -end
                -
                -
                - -
                -

                - - #*(integer) ⇒ String - - - - - -

                -
                -

                Copy—Returns a new String containing integer copies of -the receiver.

                - -

                “Ho! “ * 3 #=> “Ho! Ho! Ho! “

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (String) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -941
                -942
                -943
                -944
                -945
                -946
                -947
                -948
                -949
                -950
                -951
                -952
                -953
                -954
                -955
                -956
                -957
                -958
                -959
                -960
                -961
                -962
                -963
                -964
                -965
                -966
                -967
                -968
                -969
                -970
                -971
                -972
                -973
                -
                -
                # File 'src/string.c', line 941
                -
                -static mrb_value
                -mrb_str_times(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_int n,len,times;
                -  struct RString *str2;
                -  char *p;
                -
                -  mrb_get_args(mrb, "i", &times);
                -  if (times < 0) {
                -    mrb_raise(mrb, E_ARGUMENT_ERROR, "negative argument");
                -  }
                -  if (times && MRB_INT_MAX / times < RSTRING_LEN(self)) {
                -    mrb_raise(mrb, E_ARGUMENT_ERROR, "argument too big");
                -  }
                -
                -  len = RSTRING_LEN(self)*times;
                -  str2 = str_new(mrb, 0, len);
                -  str_with_class(str2, self);
                -  p = RSTR_PTR(str2);
                -  if (len > 0) {
                -    n = RSTRING_LEN(self);
                -    memcpy(p, RSTRING_PTR(self), n);
                -    while (n <= len/2) {
                -      memcpy(p + n, p, n);
                -      n *= 2;
                -    }
                -    memcpy(p + n, p, len-n);
                -  }
                -  p[RSTR_LEN(str2)] = '\0';
                -  RSTR_COPY_ASCII_FLAG(str2, mrb_str_ptr(self));
                -
                -  return mrb_obj_value(str2);
                -}
                -
                -
                - -
                -

                - - #+(other_str) ⇒ String - - - - - -

                -
                -

                Concatenation—Returns a new String containing -other_str concatenated to str.

                - -

                “Hello from “ + self.to_s #=> “Hello from main”

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (String) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -900
                -901
                -902
                -903
                -904
                -905
                -906
                -907
                -
                -
                # File 'src/string.c', line 900
                -
                -static mrb_value
                -mrb_str_plus_m(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_value str;
                -
                -  mrb_get_args(mrb, "S", &str);
                -  return mrb_str_plus(mrb, self, str);
                -}
                -
                -
                - -
                -

                - - - #<<(integer) ⇒ String - - #concat(integer) ⇒ String - - #<<(obj) ⇒ String - - #concat(obj) ⇒ String - - - - - - -

                -
                -

                Append—Concatenates the given object to str. If the object is a -Integer, it is considered as a codepoint, and is converted -to a character before concatenation -(equivalent to str.concat(integer.chr(__ENCODING__))).

                - -

                a = “hello “ - a « “world” #=> “hello world” - a.concat(33) #=> “hello world!”

                - - -
                -
                -
                - -

                Overloads:

                -
                  - - -
                • - #<<(integer) ⇒ String -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #concat(integer) ⇒ String -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #<<(obj) ⇒ String -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #concat(obj) ⇒ String -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String) - - - -
                  • - -
                  - -
                  - - -
                • - -
                - - -
                - - - - - - -
                -
                -
                -
                -164
                -165
                -166
                -167
                -168
                -169
                -170
                -171
                -172
                -173
                -174
                -175
                -176
                -177
                -178
                -179
                -180
                -
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 164
                -
                -static mrb_value
                -mrb_str_concat_m(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_value str;
                -
                -  mrb_get_args(mrb, "o", &str);
                -  if (mrb_fixnum_p(str) || mrb_float_p(str))
                -#ifdef MRB_UTF8_STRING
                -    str = int_chr_utf8(mrb, str);
                -#else
                -    str = int_chr_binary(mrb, str);
                -#endif
                -  else
                -    mrb_ensure_string_type(mrb, str);
                -  mrb_str_cat_str(mrb, self, str);
                -  return self;
                -}
                -
                -
                - -
                -

                - - #<=>(other_str) ⇒ -1, ... - - - - - -

                -
                -

                Comparison—Returns -1 if other_str is less than, 0 if -other_str is equal to, and +1 if other_str is greater than -str. 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. If the variable $= is -false, the comparison is based on comparing the binary values -of each character in the string. In older versions of Ruby, setting -$= allowed case-insensitive comparisons; this is now deprecated -in favor of using String#casecmp.

                - -

                <=> 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

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (-1, 0, +1) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -1031
                -1032
                -1033
                -1034
                -1035
                -1036
                -1037
                -1038
                -1039
                -1040
                -1041
                -1042
                -1043
                -1044
                -1045
                -
                -
                # File 'src/string.c', line 1031
                -
                -static mrb_value
                -mrb_str_cmp_m(mrb_state *mrb, mrb_value str1)
                -{
                -  mrb_value str2;
                -  mrb_int result;
                -
                -  mrb_get_args(mrb, "o", &str2);
                -  if (!mrb_string_p(str2)) {
                -    return mrb_nil_value();
                -  }
                -  else {
                -    result = mrb_str_cmp(mrb, str1, str2);
                -  }
                -  return mrb_fixnum_value(result);
                -}
                -
                -
                - -
                -

                - - #==(obj) ⇒ Boolean - - - - - -

                -
                -

                Equality— -If obj is not a String, returns false. -Otherwise, returns false or true

                - -

                caution:if str <=> obj returns zero.

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (Boolean) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -1076
                -1077
                -1078
                -1079
                -1080
                -1081
                -1082
                -1083
                -1084
                -
                -
                # File 'src/string.c', line 1076
                -
                -static mrb_value
                -mrb_str_equal_m(mrb_state *mrb, mrb_value str1)
                -{
                -  mrb_value str2;
                -
                -  mrb_get_args(mrb, "o", &str2);
                -
                -  return mrb_bool_value(mrb_str_equal(mrb, str1, str2));
                -}
                -
                -
                - -
                -

                - - - #[](fixnum) ⇒ Fixnum? - - #[](fixnum, fixnum) ⇒ String? - - #[](range) ⇒ String? - - #[](regexp) ⇒ String? - - #[](regexp, fixnum) ⇒ String? - - #[](other_str) ⇒ String? - - #slice(fixnum) ⇒ Fixnum? - - #slice(fixnum, fixnum) ⇒ String? - - #slice(range) ⇒ String? - - #slice(other_str) ⇒ String? - - - - - - -

                -
                -

                Element Reference—If passed a single Fixnum, returns the code -of the character at that position. If passed two Fixnum -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 -characters 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.

                - -

                If a String is given, that string is returned if it occurs in -str. In both cases, nil is returned if there is no -match.

                - -

                a = “hello there” - a[1] #=> 101(1.8.7) “e”(1.9.2) - a[1.1] #=> “e”(1.9.2) - a[1,3] #=> “ell” - a[1..3] #=> “ell” - a[-3,2] #=> “er” - a[-4..-2] #=> “her” - a[12..-1] #=> nil - a[-2..-4] #=> “” - a[“lo”] #=> “lo” - a[“bye”] #=> nil

                - - -
                -
                -
                - -

                Overloads:

                -
                  - - -
                • - #[](fixnum) ⇒ Fixnum? -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (Fixnum, nil) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #[](fixnum, fixnum) ⇒ String? -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String, nil) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #[](range) ⇒ String? -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String, nil) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #[](regexp) ⇒ String? -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String, nil) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #[](regexp, fixnum) ⇒ String? -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String, nil) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #[](other_str) ⇒ String? -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String, nil) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #slice(fixnum) ⇒ Fixnum? -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (Fixnum, nil) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #slice(fixnum, fixnum) ⇒ String? -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String, nil) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #slice(range) ⇒ String? -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String, nil) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #slice(other_str) ⇒ String? -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String, nil) - - - -
                  • - -
                  - -
                  - - -
                • - -
                - - -
                - - - - - - -
                -
                -
                -
                -1259
                -1260
                -1261
                -1262
                -1263
                -1264
                -1265
                -1266
                -1267
                -1268
                -1269
                -
                -
                # File 'src/string.c', line 1259
                -
                -static mrb_value
                -mrb_str_aref_m(mrb_state *mrb, mrb_value str)
                -{
                -  mrb_value a1, a2;
                -
                -  if (mrb_get_args(mrb, "o|o", &a1, &a2) == 1) {
                -    a2 = mrb_undef_value();
                -  }
                -
                -  return mrb_str_aref(mrb, str, a1, a2);
                -}
                -
                -
                - -
                -

                - - - #[]=(fixnum) ⇒ Object - - #[]=(fixnum, fixnum) ⇒ Object - - #[]=(range) ⇒ Object - - #[]=(regexp) ⇒ Object - - #[]=(regexp, fixnum) ⇒ Object - - #[]=(other_str) ⇒ Object - - - - - - -

                -
                -

                Modify +self+ by replacing the content of +self+. -The portion of the string affected is determined using the same criteria as +String#[]+.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -1442
                -1443
                -1444
                -1445
                -1446
                -1447
                -1448
                -1449
                -1450
                -1451
                -1452
                -1453
                -1454
                -1455
                -1456
                -1457
                -
                -
                # File 'src/string.c', line 1442
                -
                -static mrb_value
                -mrb_str_aset_m(mrb_state *mrb, mrb_value str)
                -{
                -  mrb_value indx, alen, replace;
                -
                -  switch (mrb_get_args(mrb, "oo|S!", &indx, &alen, &replace)) {
                -    case 2:
                -      replace = alen;
                -      alen = mrb_undef_value();
                -      break;
                -    case 3:
                -      break;
                -  }
                -  mrb_str_aset(mrb, str, indx, alen, replace);
                -  return str;
                -}
                -
                -
                - -
                -

                - - #__linesObject - - - - - -

                - - - - -
                -
                -
                -
                -1174
                -1175
                -1176
                -1177
                -1178
                -1179
                -1180
                -1181
                -1182
                -1183
                -1184
                -1185
                -1186
                -1187
                -1188
                -1189
                -1190
                -1191
                -1192
                -1193
                -1194
                -1195
                -
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 1174
                -
                -static mrb_value
                -mrb_str_lines(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_value result;
                -  int ai;
                -  mrb_int len;
                -  char *b = RSTRING_PTR(self);
                -  char *p = b, *t;
                -  char *e = b + RSTRING_LEN(self);
                -
                -  result = mrb_ary_new(mrb);
                -  ai = mrb_gc_arena_save(mrb);
                -  while (p < e) {
                -    t = p;
                -    while (p < e && *p != '\n') p++;
                -    if (*p == '\n') p++;
                -    len = (mrb_int) (p - t);
                -    mrb_ary_push(mrb, result, mrb_str_new(mrb, t, len));
                -    mrb_gc_arena_restore(mrb, ai);
                -  }
                -  return result;
                -}
                -
                -
                - -
                -

                - - #__sub_replace(pre, m, post) ⇒ Object - - - - - -

                -
                -

                private method for gsub/sub

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -55
                -56
                -57
                -58
                -59
                -60
                -61
                -62
                -63
                -64
                -65
                -66
                -67
                -68
                -69
                -70
                -71
                -72
                -73
                -74
                -75
                -76
                -77
                -78
                -
                -
                # File 'mrblib/string.rb', line 55
                -
                -def __sub_replace(pre, m, post)
                -  s = ""
                -  i = 0
                -  while j = index("\\", i)
                -    break if j == length-1
                -    t = case self[j+1]
                -        when "\\"
                -          "\\"
                -        when "`"
                -          pre
                -        when "&", "0"
                -          m
                -        when "'"
                -          post
                -        when "1", "2", "3", "4", "5", "6", "7", "8", "9"
                -          ""
                -        else
                -          self[j, 2]
                -        end
                -    s += self[i, j-i] + t
                -    i = j + 2
                -  end
                -  s + self[i, length-i]
                -end
                -
                -
                - -
                -

                - - #bytesObject - - - - - -

                -
                -

                Returns an array of bytes in str.

                - -

                str = “hello” - str.bytes #=> [104, 101, 108, 108, 111]

                - - -
                -
                -
                - - - - -
                - - - - - - -
                -
                -
                -
                -2765
                -2766
                -2767
                -2768
                -2769
                -2770
                -2771
                -2772
                -2773
                -2774
                -2775
                -2776
                -2777
                -
                -
                # File 'src/string.c', line 2765
                -
                -static mrb_value
                -mrb_str_bytes(mrb_state *mrb, mrb_value str)
                -{
                -  struct RString *s = mrb_str_ptr(str);
                -  mrb_value a = mrb_ary_new_capa(mrb, RSTR_LEN(s));
                -  unsigned char *p = (unsigned char *)(RSTR_PTR(s)), *pend = p + RSTR_LEN(s);
                -
                -  while (p < pend) {
                -    mrb_ary_push(mrb, a, mrb_fixnum_value(p[0]));
                -    p++;
                -  }
                -  return a;
                -}
                -
                -
                - -
                -

                - - #bytesizeObject - - - - - -

                - - - - -
                -
                -
                -
                -924
                -925
                -926
                -927
                -928
                -929
                -
                -
                # File 'src/string.c', line 924
                -
                -static mrb_value
                -mrb_str_bytesize(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_int len = RSTRING_LEN(self);
                -  return mrb_fixnum_value(len);
                -}
                -
                -
                - -
                -

                - - - #byteslice(integer) ⇒ String? - - #byteslice(integer, integer) ⇒ String? - - #byteslice(range) ⇒ String? - - - - - - -

                -
                -

                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”

                - - -
                -
                -
                - -

                Overloads:

                -
                  - - -
                • - #byteslice(integer) ⇒ String? -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String, nil) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #byteslice(integer, integer) ⇒ String? -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String, nil) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #byteslice(range) ⇒ String? -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String, nil) - - - -
                  • - -
                  - -
                  - - -
                • - -
                - - -
                - - - - - - -
                -
                -
                -
                -2847
                -2848
                -2849
                -2850
                -2851
                -2852
                -2853
                -2854
                -2855
                -2856
                -2857
                -2858
                -2859
                -2860
                -2861
                -2862
                -2863
                -2864
                -2865
                -2866
                -2867
                -2868
                -2869
                -2870
                -2871
                -2872
                -2873
                -2874
                -2875
                -
                -
                # File 'src/string.c', line 2847
                -
                -static mrb_value
                -mrb_str_byteslice(mrb_state *mrb, mrb_value str)
                -{
                -  mrb_value a1, a2;
                -  mrb_int str_len = RSTRING_LEN(str), beg, len;
                -  mrb_bool empty = TRUE;
                -
                -  if (mrb_get_args(mrb, "o|o", &a1, &a2) == 2) {
                -    beg = mrb_fixnum(mrb_to_int(mrb, a1));
                -    len = mrb_fixnum(mrb_to_int(mrb, a2));
                -  }
                -  else if (mrb_range_p(a1)) {
                -    if (mrb_range_beg_len(mrb, a1, &beg, &len, str_len, TRUE) != MRB_RANGE_OK) {
                -      return mrb_nil_value();
                -    }
                -  }
                -  else {
                -    beg = mrb_fixnum(mrb_to_int(mrb, a1));
                -    len = 1;
                -    empty = FALSE;
                -  }
                -
                -  if (mrb_str_beg_len(str_len, &beg, &len) && (empty || len != 0)) {
                -    return mrb_str_byte_subseq(mrb, str, beg, len);
                -  }
                -  else {
                -    return mrb_nil_value();
                -  }
                -}
                -
                -
                - -
                -

                - - #capitalizeString - - - - - -

                -
                -

                Returns a copy of str with the first character converted to uppercase -and the remainder to lowercase.

                - -

                “hello”.capitalize #=> “Hello” - “HELLO”.capitalize #=> “Hello” - “123ABC”.capitalize #=> “123abc”

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (String) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -1508
                -1509
                -1510
                -1511
                -1512
                -1513
                -1514
                -1515
                -1516
                -
                -
                # File 'src/string.c', line 1508
                -
                -static mrb_value
                -mrb_str_capitalize(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_value str;
                -
                -  str = mrb_str_dup(mrb, self);
                -  mrb_str_capitalize_bang(mrb, str);
                -  return str;
                -}
                -
                -
                - -
                -

                - - #capitalize!String? - - - - - -

                -
                -

                Modifies str by converting the first character to uppercase and the -remainder to lowercase. Returns nil if no changes are made.

                - -

                a = “hello” - a.capitalize! #=> “Hello” - a #=> “Hello” - a.capitalize! #=> nil

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (String, nil) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -1472
                -1473
                -1474
                -1475
                -1476
                -1477
                -1478
                -1479
                -1480
                -1481
                -1482
                -1483
                -1484
                -1485
                -1486
                -1487
                -1488
                -1489
                -1490
                -1491
                -1492
                -1493
                -1494
                -
                -
                # File 'src/string.c', line 1472
                -
                -static mrb_value
                -mrb_str_capitalize_bang(mrb_state *mrb, mrb_value str)
                -{
                -  char *p, *pend;
                -  mrb_bool modify = FALSE;
                -  struct RString *s = mrb_str_ptr(str);
                -
                -  mrb_str_modify_keep_ascii(mrb, s);
                -  if (RSTR_LEN(s) == 0 || !RSTR_PTR(s)) return mrb_nil_value();
                -  p = RSTR_PTR(s); pend = RSTR_PTR(s) + RSTR_LEN(s);
                -  if (ISLOWER(*p)) {
                -    *p = TOUPPER(*p);
                -    modify = TRUE;
                -  }
                -  while (++p < pend) {
                -    if (ISUPPER(*p)) {
                -      *p = TOLOWER(*p);
                -      modify = TRUE;
                -    }
                -  }
                -  if (modify) return str;
                -  return mrb_nil_value();
                -}
                -
                -
                - -
                -

                - - #casecmp(str) ⇒ Object - - - - - -

                -
                -

                call-seq: - str.casecmp(other_str) -> -1, 0, +1 or nil

                - -

                Case-insensitive version of String#<=>.

                - -

                “abcdef”.casecmp(“abcde”) #=> 1 - “aBcDeF”.casecmp(“abcdef”) #=> 0 - “abcdef”.casecmp(“abcdefg”) #=> -1 - “abcdef”.casecmp(“ABCDEF”) #=> 0

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -125
                -126
                -127
                -128
                -129
                -
                -
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 125
                -
                -def casecmp(str)
                -  self.downcase <=> str.__to_str.downcase
                -rescue NoMethodError
                -  nil
                -end
                -
                -
                - -
                -

                - - #casecmp?(str) ⇒ Boolean - - - - - -

                -
                -

                call-seq: - str.casecmp?(other) -> true, false, or nil

                - -

                Returns true if str and other_str are equal after case folding, -false if they are not equal, and nil if other_str is not a string.

                - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (Boolean) - - - -
                • - -
                - -
                - - - - - - -
                -
                -
                -
                -138
                -139
                -140
                -141
                -142
                -
                -
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 138
                -
                -def casecmp?(str)
                -  c = self.casecmp(str)
                -  return nil if c.nil?
                -  return c == 0
                -end
                -
                -
                - -
                -

                - - #chars(&block) ⇒ Object - - - - - -

                - - - - -
                -
                -
                -
                -302
                -303
                -304
                -305
                -306
                -307
                -308
                -309
                -310
                -311
                -
                -
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 302
                -
                -def chars(&block)
                -  if block_given?
                -    self.split('').each do |i|
                -      block.call(i)
                -    end
                -    self
                -  else
                -    self.split('')
                -  end
                -end
                -
                -
                - -
                -

                - - #chomp(separator = "\n") ⇒ String - - - - - -

                -
                -

                Returns a new String with the given record separator removed -from the end of str (if present). chomp also removes -carriage return characters (that is it will remove \n, -\r, and \r\n).

                - -

                “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”

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (String) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -1612
                -1613
                -1614
                -1615
                -1616
                -1617
                -1618
                -1619
                -1620
                -
                -
                # File 'src/string.c', line 1612
                -
                -static mrb_value
                -mrb_str_chomp(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_value str;
                -
                -  str = mrb_str_dup(mrb, self);
                -  mrb_str_chomp_bang(mrb, str);
                -  return str;
                -}
                -
                -
                - -
                -

                - - #chomp!(separator = "\n") ⇒ String? - - - - - -

                -
                -

                Modifies str in place as described for String#chomp, -returning str, or nil if no modifications were made.

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (String, nil) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -1526
                -1527
                -1528
                -1529
                -1530
                -1531
                -1532
                -1533
                -1534
                -1535
                -1536
                -1537
                -1538
                -1539
                -1540
                -1541
                -1542
                -1543
                -1544
                -1545
                -1546
                -1547
                -1548
                -1549
                -1550
                -1551
                -1552
                -1553
                -1554
                -1555
                -1556
                -1557
                -1558
                -1559
                -1560
                -1561
                -1562
                -1563
                -1564
                -1565
                -1566
                -1567
                -1568
                -1569
                -1570
                -1571
                -1572
                -1573
                -1574
                -1575
                -1576
                -1577
                -1578
                -1579
                -1580
                -1581
                -1582
                -1583
                -1584
                -1585
                -1586
                -1587
                -1588
                -1589
                -1590
                -1591
                -1592
                -
                -
                # File 'src/string.c', line 1526
                -
                -static mrb_value
                -mrb_str_chomp_bang(mrb_state *mrb, mrb_value str)
                -{
                -  mrb_value rs;
                -  mrb_int newline;
                -  char *p, *pp;
                -  mrb_int rslen;
                -  mrb_int len;
                -  mrb_int argc;
                -  struct RString *s = mrb_str_ptr(str);
                -
                -  argc = mrb_get_args(mrb, "|S", &rs);
                -  mrb_str_modify_keep_ascii(mrb, s);
                -  len = RSTR_LEN(s);
                -  if (argc == 0) {
                -    if (len == 0) return mrb_nil_value();
                -  smart_chomp:
                -    if (RSTR_PTR(s)[len-1] == '\n') {
                -      RSTR_SET_LEN(s, RSTR_LEN(s) - 1);
                -      if (RSTR_LEN(s) > 0 &&
                -          RSTR_PTR(s)[RSTR_LEN(s)-1] == '\r') {
                -        RSTR_SET_LEN(s, RSTR_LEN(s) - 1);
                -      }
                -    }
                -    else if (RSTR_PTR(s)[len-1] == '\r') {
                -      RSTR_SET_LEN(s, RSTR_LEN(s) - 1);
                -    }
                -    else {
                -      return mrb_nil_value();
                -    }
                -    RSTR_PTR(s)[RSTR_LEN(s)] = '\0';
                -    return str;
                -  }
                -
                -  if (len == 0 || mrb_nil_p(rs)) return mrb_nil_value();
                -  p = RSTR_PTR(s);
                -  rslen = RSTRING_LEN(rs);
                -  if (rslen == 0) {
                -    while (len>0 && p[len-1] == '\n') {
                -      len--;
                -      if (len>0 && p[len-1] == '\r')
                -        len--;
                -    }
                -    if (len < RSTR_LEN(s)) {
                -      RSTR_SET_LEN(s, len);
                -      p[len] = '\0';
                -      return str;
                -    }
                -    return mrb_nil_value();
                -  }
                -  if (rslen > len) return mrb_nil_value();
                -  newline = RSTRING_PTR(rs)[rslen-1];
                -  if (rslen == 1 && newline == '\n')
                -    newline = RSTRING_PTR(rs)[rslen-1];
                -  if (rslen == 1 && newline == '\n')
                -    goto smart_chomp;
                -
                -  pp = p + len - rslen;
                -  if (p[len-1] == newline &&
                -     (rslen <= 1 ||
                -     memcmp(RSTRING_PTR(rs), pp, rslen) == 0)) {
                -    RSTR_SET_LEN(s, len - rslen);
                -    p[RSTR_LEN(s)] = '\0';
                -    return str;
                -  }
                -  return mrb_nil_value();
                -}
                -
                -
                - -
                -

                - - #chopString - - - - - -

                -
                -

                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 #=> “”

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (String) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -1681
                -1682
                -1683
                -1684
                -1685
                -1686
                -1687
                -1688
                -
                -
                # File 'src/string.c', line 1681
                -
                -static mrb_value
                -mrb_str_chop(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_value str;
                -  str = mrb_str_dup(mrb, self);
                -  mrb_str_chop_bang(mrb, str);
                -  return str;
                -}
                -
                -
                - -
                -

                - - #chop!String? - - - - - -

                -
                -

                Processes str as for String#chop, returning str, -or nil if str is the empty string. See also -String#chomp!.

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (String, nil) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -1631
                -1632
                -1633
                -1634
                -1635
                -1636
                -1637
                -1638
                -1639
                -1640
                -1641
                -1642
                -1643
                -1644
                -1645
                -1646
                -1647
                -1648
                -1649
                -1650
                -1651
                -1652
                -1653
                -1654
                -1655
                -1656
                -1657
                -1658
                -1659
                -1660
                -1661
                -1662
                -
                -
                # File 'src/string.c', line 1631
                -
                -static mrb_value
                -mrb_str_chop_bang(mrb_state *mrb, mrb_value str)
                -{
                -  struct RString *s = mrb_str_ptr(str);
                -
                -  mrb_str_modify_keep_ascii(mrb, s);
                -  if (RSTR_LEN(s) > 0) {
                -    mrb_int len;
                -#ifdef MRB_UTF8_STRING
                -    const char* t = RSTR_PTR(s), *p = t;
                -    const char* e = p + RSTR_LEN(s);
                -    while (p<e) {
                -      mrb_int clen = utf8len(p, e);
                -      if (p + clen>=e) break;
                -      p += clen;
                -    }
                -    len = p - t;
                -#else
                -    len = RSTR_LEN(s) - 1;
                -#endif
                -    if (RSTR_PTR(s)[len] == '\n') {
                -      if (len > 0 &&
                -          RSTR_PTR(s)[len-1] == '\r') {
                -        len--;
                -      }
                -    }
                -    RSTR_SET_LEN(s, len);
                -    RSTR_PTR(s)[len] = '\0';
                -    return str;
                -  }
                -  return mrb_nil_value();
                -}
                -
                -
                - -
                -

                - - #chrString - - - - - -

                -
                -

                Returns a one-character string at the beginning of the string.

                - -

                a = “abcde” - a.chr #=> “a”

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (String) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -855
                -856
                -857
                -858
                -859
                -
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 855
                -
                -static mrb_value
                -mrb_str_chr(mrb_state *mrb, mrb_value self)
                -{
                -  return mrb_str_substr(mrb, self, 0, 1);
                -}
                -
                -
                - -
                -

                - - #clearObject - - - - - -

                -
                -

                call-seq: - string.clear -> string

                - -

                Makes string empty.

                - -

                a = “abcde” - a.clear #=> “”

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -12
                -13
                -14
                -
                -
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 12
                -
                -def clear
                -  self.replace("")
                -end
                -
                -
                - -
                -

                - - #codepoints(&block) ⇒ Object - - - - Also known as: - each_codepoint - - - - -

                - - - - -
                -
                -
                -
                -326
                -327
                -328
                -329
                -330
                -331
                -332
                -333
                -334
                -335
                -336
                -337
                -
                -
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 326
                -
                -def codepoints(&block)
                -  len = self.size
                -
                -  if block_given?
                -    self.split('').each do|x|
                -      block.call(x.ord)
                -    end
                -    self
                -  else
                -    self.split('').map{|x| x.ord}
                -  end
                -end
                -
                -
                - -
                -

                - - - #<<(integer) ⇒ String - - #concat(integer) ⇒ String - - #<<(obj) ⇒ String - - #concat(obj) ⇒ String - - - - - - -

                -
                -

                Append—Concatenates the given object to str. If the object is a -Integer, it is considered as a codepoint, and is converted -to a character before concatenation -(equivalent to str.concat(integer.chr(__ENCODING__))).

                - -

                a = “hello “ - a « “world” #=> “hello world” - a.concat(33) #=> “hello world!”

                - - -
                -
                -
                - -

                Overloads:

                -
                  - - -
                • - #<<(integer) ⇒ String -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #concat(integer) ⇒ String -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #<<(obj) ⇒ String -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #concat(obj) ⇒ String -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String) - - - -
                  • - -
                  - -
                  - - -
                • - -
                - - -
                - - - - - - -
                -
                -
                -
                -164
                -165
                -166
                -167
                -168
                -169
                -170
                -171
                -172
                -173
                -174
                -175
                -176
                -177
                -178
                -179
                -180
                -
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 164
                -
                -static mrb_value
                -mrb_str_concat_m(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_value str;
                -
                -  mrb_get_args(mrb, "o", &str);
                -  if (mrb_fixnum_p(str) || mrb_float_p(str))
                -#ifdef MRB_UTF8_STRING
                -    str = int_chr_utf8(mrb, str);
                -#else
                -    str = int_chr_binary(mrb, str);
                -#endif
                -  else
                -    mrb_ensure_string_type(mrb, str);
                -  mrb_str_cat_str(mrb, self, str);
                -  return self;
                -}
                -
                -
                - -
                -

                - - #countObject - - - - - -

                -
                -

                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.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -810
                -811
                -812
                -813
                -814
                -815
                -816
                -817
                -818
                -819
                -820
                -821
                -822
                -823
                -824
                -825
                -826
                -827
                -828
                -829
                -830
                -831
                -832
                -
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 810
                -
                -static mrb_value
                -mrb_str_count(mrb_state *mrb, mrb_value str)
                -{
                -  mrb_value v_pat = mrb_nil_value();
                -  mrb_int i;
                -  char *s;
                -  mrb_int len;
                -  mrb_int count = 0;
                -  struct tr_pattern pat = STATIC_TR_PATTERN;
                -  uint8_t bitmap[32];
                -
                -  mrb_get_args(mrb, "S", &v_pat);
                -  tr_parse_pattern(mrb, &pat, v_pat, TRUE);
                -  tr_compile_pattern(&pat, v_pat, bitmap);
                -  tr_free_pattern(mrb, &pat);
                -
                -  s = RSTRING_PTR(str);
                -  len = RSTRING_LEN(str);
                -  for (i = 0; i < len; i++) {
                -    if (tr_bitmap_detect(bitmap, s[i])) count++;
                -  }
                -  return mrb_fixnum_value(count);
                -}
                -
                -
                - -
                -

                - - #cover?(obj) ⇒ Boolean - - - - - -

                -
                -

                Returns true if +obj+ is between the begin and end of -the range.

                - -

                This tests begin <= obj <= end when #exclude_end? is +false+ -and begin <= obj < end when #exclude_end? is +true+.

                - -

                (“a”..”z”).cover?(“c”) #=> true - (“a”..”z”).cover?(“5”) #=> false - (“a”..”z”).cover?(“cc”) #=> true

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (Boolean) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -34
                -35
                -36
                -37
                -38
                -39
                -40
                -41
                -42
                -43
                -44
                -45
                -46
                -47
                -48
                -49
                -50
                -51
                -52
                -53
                -54
                -55
                -56
                -57
                -58
                -
                -
                # File 'mrbgems/mruby-range-ext/src/range.c', line 34
                -
                -static mrb_value
                -range_cover(mrb_state *mrb, mrb_value range)
                -{
                -  mrb_value val;
                -  struct RRange *r = mrb_range_ptr(mrb, range);
                -  mrb_value beg, end;
                -
                -  mrb_get_args(mrb, "o", &val);
                -
                -  beg = RANGE_BEG(r);
                -  end = RANGE_END(r);
                -
                -  if (r_le(mrb, beg, val)) {
                -    if (RANGE_EXCL(r)) {
                -      if (r_lt(mrb, val, end))
                -        return mrb_true_value();
                -    }
                -    else {
                -      if (r_le(mrb, val, end))
                -        return mrb_true_value();
                -    }
                -  }
                -
                -  return mrb_false_value();
                -}
                -
                -
                - -
                -

                - - #deleteObject - - - - - -

                - - - - -
                -
                -
                -
                -775
                -776
                -777
                -778
                -779
                -780
                -781
                -782
                -783
                -784
                -785
                -
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 775
                -
                -static mrb_value
                -mrb_str_delete(mrb_state *mrb, mrb_value str)
                -{
                -  mrb_value pat;
                -  mrb_value dup;
                -
                -  mrb_get_args(mrb, "S", &pat);
                -  dup = mrb_str_dup(mrb, str);
                -  str_delete(mrb, dup, pat);
                -  return dup;
                -}
                -
                -
                - -
                -

                - - #delete!Object - - - - - -

                - - - - -
                -
                -
                -
                -787
                -788
                -789
                -790
                -791
                -792
                -793
                -794
                -795
                -796
                -797
                -
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 787
                -
                -static mrb_value
                -mrb_str_delete_bang(mrb_state *mrb, mrb_value str)
                -{
                -  mrb_value pat;
                -
                -  mrb_get_args(mrb, "S", &pat);
                -  if (str_delete(mrb, str, pat)) {
                -    return str;
                -  }
                -  return mrb_nil_value();
                -}
                -
                -
                - -
                -

                - - #delete_prefix(prefix) ⇒ String - - - - - -

                -
                -

                Returns a copy of str with leading prefix deleted.

                - -

                “hello”.delete_prefix(“hel”) #=> “lo” - “hello”.delete_prefix(“llo”) #=> “hello”

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (String) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -1105
                -1106
                -1107
                -1108
                -1109
                -1110
                -1111
                -1112
                -1113
                -1114
                -1115
                -1116
                -1117
                -
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 1105
                -
                -static mrb_value
                -mrb_str_del_prefix(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_int plen, slen;
                -  char *ptr;
                -
                -  mrb_get_args(mrb, "s", &ptr, &plen);
                -  slen = RSTRING_LEN(self);
                -  if (plen > slen) return mrb_str_dup(mrb, self);
                -  if (memcmp(RSTRING_PTR(self), ptr, plen) != 0)
                -    return mrb_str_dup(mrb, self);
                -  return mrb_str_substr(mrb, self, plen, slen-plen);
                -}
                -
                -
                - -
                -

                - - #delete_prefix!(prefix) ⇒ self? - - - - - -

                -
                -

                Deletes leading prefix from str, returning -nil if no change was made.

                - -

                “hello”.delete_prefix!(“hel”) #=> “lo” - “hello”.delete_prefix!(“llo”) #=> nil

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (self, nil) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -1072
                -1073
                -1074
                -1075
                -1076
                -1077
                -1078
                -1079
                -1080
                -1081
                -1082
                -1083
                -1084
                -1085
                -1086
                -1087
                -1088
                -1089
                -1090
                -1091
                -1092
                -1093
                -1094
                -
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 1072
                -
                -static mrb_value
                -mrb_str_del_prefix_bang(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_int plen, slen;
                -  char *ptr, *s;
                -  struct RString *str = RSTRING(self);
                -
                -  mrb_get_args(mrb, "s", &ptr, &plen);
                -  slen = RSTR_LEN(str);
                -  if (plen > slen) return mrb_nil_value();
                -  s = RSTR_PTR(str);
                -  if (memcmp(s, ptr, plen) != 0) return mrb_nil_value();
                -  if (!mrb_frozen_p(str) && (RSTR_SHARED_P(str) || RSTR_FSHARED_P(str))) {
                -    str->as.heap.ptr += plen;
                -  }
                -  else {
                -    mrb_str_modify(mrb, str);
                -    s = RSTR_PTR(str);
                -    memmove(s, s+plen, slen-plen);
                -  }
                -  RSTR_SET_LEN(str, slen-plen);
                -  return self;
                -}
                -
                -
                - -
                -

                - - #delete_suffix(suffix) ⇒ String - - - - - -

                -
                -

                Returns a copy of str with leading suffix deleted.

                - -

                “hello”.delete_suffix(“hel”) #=> “lo” - “hello”.delete_suffix(“llo”) #=> “hello”

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (String) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -1160
                -1161
                -1162
                -1163
                -1164
                -1165
                -1166
                -1167
                -1168
                -1169
                -1170
                -1171
                -1172
                -
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 1160
                -
                -static mrb_value
                -mrb_str_del_suffix(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_int plen, slen;
                -  char *ptr;
                -
                -  mrb_get_args(mrb, "s", &ptr, &plen);
                -  slen = RSTRING_LEN(self);
                -  if (plen > slen) return mrb_str_dup(mrb, self);
                -  if (memcmp(RSTRING_PTR(self)+slen-plen, ptr, plen) != 0)
                -    return mrb_str_dup(mrb, self);
                -  return mrb_str_substr(mrb, self, 0, slen-plen);
                -}
                -
                -
                - -
                -

                - - #delete_suffix!(suffix) ⇒ self? - - - - - -

                -
                -

                Deletes trailing suffix from str, returning -nil if no change was made.

                - -

                “hello”.delete_suffix!(“llo”) #=> “he” - “hello”.delete_suffix!(“hel”) #=> nil

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (self, nil) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -1129
                -1130
                -1131
                -1132
                -1133
                -1134
                -1135
                -1136
                -1137
                -1138
                -1139
                -1140
                -1141
                -1142
                -1143
                -1144
                -1145
                -1146
                -1147
                -1148
                -1149
                -
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 1129
                -
                -static mrb_value
                -mrb_str_del_suffix_bang(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_int plen, slen;
                -  char *ptr, *s;
                -  struct RString *str = RSTRING(self);
                -
                -  mrb_get_args(mrb, "s", &ptr, &plen);
                -  slen = RSTR_LEN(str);
                -  if (plen > slen) return mrb_nil_value();
                -  s = RSTR_PTR(str);
                -  if (memcmp(s+slen-plen, ptr, plen) != 0) return mrb_nil_value();
                -  if (!mrb_frozen_p(str) && (RSTR_SHARED_P(str) || RSTR_FSHARED_P(str))) {
                -    /* no need to modify string */
                -  }
                -  else {
                -    mrb_str_modify(mrb, str);
                -  }
                -  RSTR_SET_LEN(str, slen-plen);
                -  return self;
                -}
                -
                -
                - -
                -

                - - #downcaseString - - - - - -

                -
                -

                Returns a copy of str with all uppercase letters replaced with their -lowercase counterparts. The operation is locale insensitive—only -characters ‘A’ to ‘Z’ are affected.

                - -

                “hEllO”.downcase #=> “hello”

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (String) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -1731
                -1732
                -1733
                -1734
                -1735
                -1736
                -1737
                -1738
                -1739
                -
                -
                # File 'src/string.c', line 1731
                -
                -static mrb_value
                -mrb_str_downcase(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_value str;
                -
                -  str = mrb_str_dup(mrb, self);
                -  mrb_str_downcase_bang(mrb, str);
                -  return str;
                -}
                -
                -
                - -
                -

                - - #downcase!String? - - - - - -

                -
                -

                Downcases the contents of str, returning nil if no -changes were made.

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (String, nil) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -1698
                -1699
                -1700
                -1701
                -1702
                -1703
                -1704
                -1705
                -1706
                -1707
                -1708
                -1709
                -1710
                -1711
                -1712
                -1713
                -1714
                -1715
                -1716
                -1717
                -1718
                -
                -
                # File 'src/string.c', line 1698
                -
                -static mrb_value
                -mrb_str_downcase_bang(mrb_state *mrb, mrb_value str)
                -{
                -  char *p, *pend;
                -  mrb_bool modify = FALSE;
                -  struct RString *s = mrb_str_ptr(str);
                -
                -  mrb_str_modify_keep_ascii(mrb, s);
                -  p = RSTR_PTR(s);
                -  pend = RSTR_PTR(s) + RSTR_LEN(s);
                -  while (p < pend) {
                -    if (ISUPPER(*p)) {
                -      *p = TOLOWER(*p);
                -      modify = TRUE;
                -    }
                -    p++;
                -  }
                -
                -  if (modify) return str;
                -  return mrb_nil_value();
                -}
                -
                -
                - -
                -

                - - #dumpString - - - - - -

                -
                -

                Produces a version of str with all nonprinting characters replaced by -\nnn notation and all special characters escaped.

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (String) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -2666
                -2667
                -2668
                -2669
                -2670
                -
                -
                # File 'src/string.c', line 2666
                -
                -mrb_value
                -mrb_str_dump(mrb_state *mrb, mrb_value str)
                -{
                -  return str_escape(mrb, str, FALSE);
                -}
                -
                -
                - -
                -

                - - #each_byte(&block) ⇒ Object - - - - - -

                -
                -

                Call the given block for each byte of +self+.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -194
                -195
                -196
                -197
                -198
                -199
                -200
                -201
                -202
                -203
                -
                -
                # File 'mrblib/string.rb', line 194
                -
                -def each_byte(&block)
                -  return to_enum(:each_byte, &block) unless block
                -  bytes = self.bytes
                -  pos = 0
                -  while pos < bytes.size
                -    block.call(bytes[pos])
                -    pos += 1
                -  end
                -  self
                -end
                -
                -
                - -
                -

                - - #each_char(&block) ⇒ Object - - - - - -

                -
                -

                Call the given block for each character of -+self+.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -316
                -317
                -318
                -319
                -320
                -321
                -322
                -323
                -324
                -
                -
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 316
                -
                -def each_char(&block)
                -  return to_enum :each_char unless block
                -  pos = 0
                -  while pos < self.size
                -    block.call(self[pos])
                -    pos += 1
                -  end
                -  self
                -end
                -
                -
                - -
                -

                - - #each_line(separator = "\n", &block) ⇒ Object - - - - - -

                -
                -

                Calls the given block for each line -and pass the respective line.

                - -

                ISO 15.2.10.5.15

                - - -
                -
                -
                - -

                Raises:

                - - -
                - - - - - - -
                -
                -
                -
                -14
                -15
                -16
                -17
                -18
                -19
                -20
                -21
                -22
                -23
                -24
                -25
                -26
                -27
                -28
                -29
                -30
                -31
                -32
                -33
                -34
                -35
                -36
                -37
                -38
                -39
                -40
                -41
                -42
                -43
                -44
                -45
                -46
                -47
                -48
                -49
                -50
                -51
                -52
                -
                -
                # File 'mrblib/string.rb', line 14
                -
                -def each_line(separator = "\n", &block)
                -  return to_enum(:each_line, separator) unless block
                -
                -  if separator.nil?
                -    block.call(self)
                -    return self
                -  end
                -  raise TypeError unless separator.is_a?(String)
                -
                -  paragraph_mode = false
                -  if separator.empty?
                -    paragraph_mode = true
                -    separator = "\n\n"
                -  end
                -  start = 0
                -  string = dup
                -  self_len = length
                -  sep_len = separator.length
                -  should_yield_subclass_instances = self.class != String
                -
                -  while (pointer = string.index(separator, start))
                -    pointer += sep_len
                -    pointer += 1 while paragraph_mode && string[pointer] == "\n"
                -    if should_yield_subclass_instances
                -      block.call(self.class.new(string[start, pointer - start]))
                -    else
                -      block.call(string[start, pointer - start])
                -    end
                -    start = pointer
                -  end
                -  return self if start == self_len
                -
                -  if should_yield_subclass_instances
                -    block.call(self.class.new(string[start, self_len - start]))
                -  else
                -    block.call(string[start, self_len - start])
                -  end
                -  self
                -end
                -
                -
                - -
                -

                - - #empty?Boolean - - - - - -

                -
                -

                Returns true if str has a length of zero.

                - -

                “hello”.empty? #=> false - ““.empty? #=> true

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (Boolean) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -1751
                -1752
                -1753
                -1754
                -1755
                -1756
                -1757
                -
                -
                # File 'src/string.c', line 1751
                -
                -static mrb_value
                -mrb_str_empty_p(mrb_state *mrb, mrb_value self)
                -{
                -  struct RString *s = mrb_str_ptr(self);
                -
                -  return mrb_bool_value(RSTR_LEN(s) == 0);
                -}
                -
                -
                - -
                -

                - - #end_with?([suffixes]) ⇒ Boolean - - - - - -

                -
                -

                Returns true if +str+ ends with one of the +suffixes+ given.

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (Boolean) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -224
                -225
                -226
                -227
                -228
                -229
                -230
                -231
                -232
                -233
                -234
                -235
                -236
                -237
                -238
                -239
                -240
                -241
                -242
                -243
                -244
                -245
                -246
                -247
                -
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 224
                -
                -static mrb_value
                -mrb_str_end_with(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_value *argv, sub;
                -  mrb_int argc, i;
                -  mrb_get_args(mrb, "*", &argv, &argc);
                -
                -  for (i = 0; i < argc; i++) {
                -    size_t len_l, len_r;
                -    int ai = mrb_gc_arena_save(mrb);
                -    sub = mrb_ensure_string_type(mrb, argv[i]);
                -    mrb_gc_arena_restore(mrb, ai);
                -    len_l = RSTRING_LEN(self);
                -    len_r = RSTRING_LEN(sub);
                -    if (len_l >= len_r) {
                -      if (memcmp(RSTRING_PTR(self) + (len_l - len_r),
                -                 RSTRING_PTR(sub),
                -                 len_r) == 0) {
                -        return mrb_true_value();
                -      }
                -    }
                -  }
                -  return mrb_false_value();
                -}
                -
                -
                - -
                -

                - - #eql?(other) ⇒ Boolean - - - - - -

                -
                -

                Two strings are equal if the have the same length and content.

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (Boolean) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -1766
                -1767
                -1768
                -1769
                -1770
                -1771
                -1772
                -1773
                -1774
                -1775
                -1776
                -
                -
                # File 'src/string.c', line 1766
                -
                -static mrb_value
                -mrb_str_eql(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_value str2;
                -  mrb_bool eql_p;
                -
                -  mrb_get_args(mrb, "o", &str2);
                -  eql_p = (mrb_string_p(str2)) && str_eql(mrb, self, str2);
                -
                -  return mrb_bool_value(eql_p);
                -}
                -
                -
                - -
                -

                - - #getbyte(index) ⇒ 0 .. 255 - - - - - -

                -
                -

                returns the indexth byte as an integer.

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (0 .. 255) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -2785
                -2786
                -2787
                -2788
                -2789
                -2790
                -2791
                -2792
                -2793
                -2794
                -2795
                -2796
                -2797
                -
                -
                # File 'src/string.c', line 2785
                -
                -static mrb_value
                -mrb_str_getbyte(mrb_state *mrb, mrb_value str)
                -{
                -  mrb_int pos;
                -  mrb_get_args(mrb, "i", &pos);
                -
                -  if (pos < 0)
                -    pos += RSTRING_LEN(str);
                -  if (pos < 0 ||  RSTRING_LEN(str) <= pos)
                -    return mrb_nil_value();
                -
                -  return mrb_fixnum_value((unsigned char)RSTRING_PTR(str)[pos]);
                -}
                -
                -
                - -
                -

                - - #gsub(*args, &block) ⇒ Object - - - - - -

                -
                -

                Replace all matches of +pattern+ with +replacement+. -Call block (if given) for each match and replace -+pattern+ with the value of the block. Return the -final value.

                - -

                ISO 15.2.10.5.18

                - - -
                -
                -
                - -

                Raises:

                - - -
                - - - - - - -
                -
                -
                -
                -87
                -88
                -89
                -90
                -91
                -92
                -93
                -94
                -95
                -96
                -97
                -98
                -99
                -100
                -101
                -102
                -103
                -104
                -105
                -106
                -107
                -108
                -109
                -110
                -111
                -112
                -113
                -114
                -115
                -116
                -
                -
                # File 'mrblib/string.rb', line 87
                -
                -def gsub(*args, &block)
                -  return to_enum(:gsub, *args) if args.length == 1 && !block
                -  raise ArgumentError, "wrong number of arguments" unless (1..2).include?(args.length)
                -
                -  pattern, replace = *args
                -  plen = pattern.length
                -  if args.length == 2 && block
                -    block = nil
                -  end
                -  if !replace.nil? || !block
                -    replace.__to_str
                -  end
                -  offset = 0
                -  result = []
                -  while found = index(pattern, offset)
                -    result << self[offset, found - offset]
                -    offset = found + plen
                -    result << if block
                -      block.call(pattern).to_s
                -    else
                -      replace.__sub_replace(self[0, found], pattern, self[offset..-1] || "")
                -    end
                -    if plen == 0
                -      result << self[offset, 1]
                -      offset += 1
                -    end
                -  end
                -  result << self[offset..-1] if offset < length
                -  result.join
                -end
                -
                -
                - -
                -

                - - #gsub!(*args, &block) ⇒ Object - - - - - -

                -
                -

                Replace all matches of +pattern+ with +replacement+. -Call block (if given) for each match and replace -+pattern+ with the value of the block. Modify -+self+ with the final value.

                - -

                ISO 15.2.10.5.19

                - - -
                -
                -
                - -

                Raises:

                - - -
                - - - - - - -
                -
                -
                -
                -125
                -126
                -127
                -128
                -129
                -130
                -131
                -
                -
                # File 'mrblib/string.rb', line 125
                -
                -def gsub!(*args, &block)
                -  raise FrozenError, "can't modify frozen String" if frozen?
                -  return to_enum(:gsub!, *args) if args.length == 1 && !block
                -  str = self.gsub(*args, &block)
                -  return nil unless self.index(args[0])
                -  self.replace(str)
                -end
                -
                -
                - -
                -

                - - #hashFixnum - - - - - -

                -
                -

                Return a hash based on the string’s length and content.

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (Fixnum) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -1807
                -1808
                -1809
                -1810
                -1811
                -1812
                -
                -
                # File 'src/string.c', line 1807
                -
                -static mrb_value
                -mrb_str_hash_m(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_int key = mrb_str_hash(mrb, self);
                -  return mrb_fixnum_value(key);
                -}
                -
                -
                - -
                -

                - - #hexObject - - - - - -

                - - - - -
                -
                -
                -
                -834
                -835
                -836
                -837
                -838
                -
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 834
                -
                -static mrb_value
                -mrb_str_hex(mrb_state *mrb, mrb_value self)
                -{
                -  return mrb_str_to_inum(mrb, self, 16, FALSE);
                -}
                -
                -
                - -
                -

                - - - #include?(other_str) ⇒ Boolean - - #include?(fixnum) ⇒ Boolean - - - - - - -

                -
                -

                Returns true if str contains the given string or -character.

                - -

                “hello”.include? “lo” #=> true - “hello”.include? “ol” #=> false - “hello”.include? ?h #=> true

                - - -
                -
                -
                - -

                Overloads:

                -
                  - - -
                • - #include?(other_str) ⇒ Boolean -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (Boolean) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #include?(fixnum) ⇒ Boolean -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (Boolean) - - - -
                  • - -
                  - -
                  - - -
                • - -
                - - -
                - - - - - - -
                -
                -
                -
                -1827
                -1828
                -1829
                -1830
                -1831
                -1832
                -1833
                -1834
                -1835
                -1836
                -
                -
                # File 'src/string.c', line 1827
                -
                -static mrb_value
                -mrb_str_include(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_value str2;
                -
                -  mrb_get_args(mrb, "S", &str2);
                -  if (str_index_str(mrb, self, str2, 0) < 0)
                -    return mrb_bool_value(FALSE);
                -  return mrb_bool_value(TRUE);
                -}
                -
                -
                - -
                -

                - - #index(substring[, offset]) ⇒ Fixnum? - - - - - -

                -
                -

                Returns the index of the first occurrence of the given -substring. Returns nil if not found. -If the second parameter is present, it -specifies the position in the string to begin the search.

                - -

                “hello”.index(‘l’) #=> 2 - “hello”.index(‘lo’) #=> 3 - “hello”.index(‘a’) #=> nil - “hello”.index(‘l’, -2) #=> 3

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (Fixnum, nil) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -1853
                -1854
                -1855
                -1856
                -1857
                -1858
                -1859
                -1860
                -1861
                -1862
                -1863
                -1864
                -1865
                -1866
                -1867
                -1868
                -1869
                -1870
                -1871
                -1872
                -1873
                -1874
                -
                -
                # File 'src/string.c', line 1853
                -
                -static mrb_value
                -mrb_str_index_m(mrb_state *mrb, mrb_value str)
                -{
                -  mrb_value sub;
                -  mrb_int pos;
                -
                -  if (mrb_get_args(mrb, "S|i", &sub, &pos) == 1) {
                -    pos = 0;
                -  }
                -  else if (pos < 0) {
                -    mrb_int clen = RSTRING_CHAR_LEN(str);
                -    pos += clen;
                -    if (pos < 0) {
                -      return mrb_nil_value();
                -    }
                -  }
                -  pos = str_index_str_by_char(mrb, str, sub, pos);
                -
                -  if (pos == -1) return mrb_nil_value();
                -  BYTES_ALIGN_CHECK(pos);
                -  return mrb_fixnum_value(pos);
                -}
                -
                -
                - -
                -

                - - #replace(other_str) ⇒ String - - - - - -

                -
                -

                s = “hello” #=> “hello” - s.replace “world” #=> “world”

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (String) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -1885
                -1886
                -1887
                -1888
                -1889
                -1890
                -1891
                -1892
                -
                -
                # File 'src/string.c', line 1885
                -
                -static mrb_value
                -mrb_str_replace(mrb_state *mrb, mrb_value str)
                -{
                -  mrb_value str2;
                -
                -  mrb_get_args(mrb, "S", &str2);
                -  return str_replace(mrb, mrb_str_ptr(str), mrb_str_ptr(str2));
                -}
                -
                -
                - -
                -

                - - #insert(idx, str) ⇒ Object - - - - - -

                -
                -

                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"
                -
                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -254
                -255
                -256
                -257
                -258
                -259
                -260
                -261
                -262
                -
                -
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 254
                -
                -def insert(idx, str)
                -  if idx == -1
                -    return self << str
                -  elsif idx < 0
                -    idx += 1
                -  end
                -  self[idx, 0] = str
                -  self
                -end
                -
                -
                - -
                -

                - - #inspectString - - - - - -

                -
                -

                Returns a printable version of str, surrounded by quote marks, -with special characters escaped.

                - -

                str = “hello” - str[3] = “\b” - str.inspect #=> “"hel\bo"”

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (String) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -2750
                -2751
                -2752
                -2753
                -2754
                -
                -
                # File 'src/string.c', line 2750
                -
                -mrb_value
                -mrb_str_inspect(mrb_state *mrb, mrb_value str)
                -{
                -  return str_escape(mrb, str, TRUE);
                -}
                -
                -
                - -
                -

                - - - #internObject - - #to_symObject - - - - - - -

                -
                -

                Returns the Symbol corresponding to str, creating the -symbol if it did not previously exist. See Symbol#id2name.

                - -

                “Koala”.intern #=> :Koala - s = ‘cat’.to_sym #=> :cat - s == :cat #=> true - s = ‘@cat’.to_sym #=> :@cat - s == :@cat #=> true

                - -

                This can also be used to create symbols that cannot be represented using the -:xxx notation.

                - -

                ‘cat and dog’.to_sym #=> :”cat and dog”

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -1935
                -1936
                -1937
                -1938
                -1939
                -
                -
                # File 'src/string.c', line 1935
                -
                -MRB_API mrb_value
                -mrb_str_intern(mrb_state *mrb, mrb_value self)
                -{
                -  return mrb_symbol_value(mrb_intern_str(mrb, self));
                -}
                -
                -
                - -
                -

                - - - #lastObject - - #last(n) ⇒ Array - - - - - - -

                -
                -

                Returns the last object in the range, -or an array of the last +n+ elements.

                - -

                Note that with no arguments +last+ will return the object that defines -the end of the range even if #exclude_end? is +true+.

                - -

                (10..20).last #=> 20 - (10…20).last #=> 20 - (10..20).last(3) #=> [18, 19, 20] - (10…20).last(3) #=> [17, 18, 19]

                - - -
                -
                -
                - -

                Overloads:

                -
                  - - -
                • - #lastObject -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (Object) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #last(n) ⇒ Array -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (Array) - - - -
                  • - -
                  - -
                  - - -
                • - -
                - - -
                - - - - - - -
                -
                -
                -
                -76
                -77
                -78
                -79
                -80
                -81
                -82
                -83
                -84
                -85
                -86
                -87
                -88
                -
                -
                # File 'mrbgems/mruby-range-ext/src/range.c', line 76
                -
                -static mrb_value
                -range_last(mrb_state *mrb, mrb_value range)
                -{
                -  mrb_value num;
                -  mrb_value array;
                -
                -  if (mrb_get_args(mrb, "|o", &num) == 0) {
                -    return mrb_range_end(mrb, range);
                -  }
                -
                -  array = mrb_funcall(mrb, range, "to_a", 0);
                -  return mrb_funcall(mrb, array, "last", 1, mrb_to_int(mrb, num));
                -}
                -
                -
                - -
                -

                - - #lengthInteger - - - - - -

                -
                -

                Same as sym.to_s.length.

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                - - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -917
                -918
                -919
                -920
                -921
                -922
                -
                -
                # File 'src/string.c', line 917
                -
                -static mrb_value
                -mrb_str_size(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_int len = RSTRING_CHAR_LEN(self);
                -  return mrb_fixnum_value(len);
                -}
                -
                -
                - -
                -

                - - #lines(&blk) ⇒ Object - - - - - -

                -
                -

                call-seq: - string.lines -> array of string - string.lines {|s| block} -> array of string

                - -

                Returns strings per line;

                - -

                a = “abc\ndef” - a.lines #=> [“abc\n”, “def”]

                - -

                If a block is given, it works the same as each_line.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -365
                -366
                -367
                -368
                -369
                -370
                -371
                -372
                -373
                -
                -
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 365
                -
                -def lines(&blk)
                -  lines = self.__lines
                -  if blk
                -    lines.each do |line|
                -      blk.call(line)
                -    end
                -  end
                -  lines
                -end
                -
                -
                - -
                -

                - - #ljust(idx, padstr = ' ') ⇒ Object - - - - - -

                -
                -

                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"
                -
                - - -
                -
                -
                - -

                Raises:

                - - -
                - - - - - - -
                -
                -
                -
                -275
                -276
                -277
                -278
                -279
                -280
                -281
                -
                -
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 275
                -
                -def ljust(idx, padstr = ' ')
                -  raise ArgumentError, 'zero width padding' if padstr == ''
                -  return self if idx <= self.size
                -  pad_repetitions = (idx / padstr.length).ceil
                -  padding = (padstr * pad_repetitions)[0...(idx - self.length)]
                -  self + padding
                -end
                -
                -
                - -
                -

                - - #lstripObject - - - - - -

                -
                -

                call-seq: - str.lstrip -> new_str

                - -

                Returns a copy of str with leading whitespace removed. See also -String#rstrip and String#strip.

                - -

                ” hello “.lstrip #=> “hello “ - “hello”.lstrip #=> “hello”

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -26
                -27
                -28
                -29
                -30
                -31
                -
                -
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 26
                -
                -def lstrip
                -  a = 0
                -  z = self.size - 1
                -  a += 1 while a <= z and " \f\n\r\t\v".include?(self[a])
                -  (z >= 0) ? self[a..z] : ""
                -end
                -
                -
                - -
                -

                - - #lstrip!Object - - - - - -

                -
                -

                call-seq: - str.lstrip! -> self or nil

                - -

                Removes leading whitespace from str, returning nil if no -change was made. See also String#rstrip! and -String#strip!.

                - -

                ” hello “.lstrip #=> “hello “ - “hello”.lstrip! #=> nil

                - - -
                -
                -
                - -

                Raises:

                - - -
                - - - - - - -
                -
                -
                -
                -78
                -79
                -80
                -81
                -82
                -
                -
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 78
                -
                -def lstrip!
                -  raise FrozenError, "can't modify frozen String" if frozen?
                -  s = self.lstrip
                -  (s == self) ? nil : self.replace(s)
                -end
                -
                -
                - -
                -

                - - #nextObject - - - - - -

                - - - - -
                -
                -
                -
                -986
                -987
                -988
                -989
                -990
                -991
                -992
                -993
                -994
                -
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 986
                -
                -static mrb_value
                -mrb_str_succ(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_value str;
                -
                -  str = mrb_str_dup(mrb, self);
                -  mrb_str_succ_bang(mrb, str);
                -  return str;
                -}
                -
                -
                - -
                -

                - - #succString - - - - - -

                -
                -

                Returns next sequence of the string;

                - -

                a = “abc” - a.succ #=> “abd”

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (String) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -908
                -909
                -910
                -911
                -912
                -913
                -914
                -915
                -916
                -917
                -918
                -919
                -920
                -921
                -922
                -923
                -924
                -925
                -926
                -927
                -928
                -929
                -930
                -931
                -932
                -933
                -934
                -935
                -936
                -937
                -938
                -939
                -940
                -941
                -942
                -943
                -944
                -945
                -946
                -947
                -948
                -949
                -950
                -951
                -952
                -953
                -954
                -955
                -956
                -957
                -958
                -959
                -960
                -961
                -962
                -963
                -964
                -965
                -966
                -967
                -968
                -969
                -970
                -971
                -972
                -973
                -974
                -975
                -976
                -977
                -978
                -979
                -980
                -981
                -982
                -983
                -984
                -
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 908
                -
                -static mrb_value
                -mrb_str_succ_bang(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_value result;
                -  unsigned char *p, *e, *b, *t;
                -  const char *prepend;
                -  struct RString *s = mrb_str_ptr(self);
                -  mrb_int l;
                -
                -  if (RSTRING_LEN(self) == 0)
                -    return self;
                -
                -  mrb_str_modify(mrb, s);
                -  l = RSTRING_LEN(self);
                -  b = p = (unsigned char*) RSTRING_PTR(self);
                -  t = e = p + l;
                -  *(e--) = 0;
                -
                -  // find trailing ascii/number
                -  while (e >= b) {
                -    if (ISALNUM(*e))
                -      break;
                -    e--;
                -  }
                -  if (e < b) {
                -    e = p + l - 1;
                -    result = mrb_str_new_lit(mrb, "");
                -  }
                -  else {
                -    // find leading letter of the ascii/number
                -    b = e;
                -    while (b > p) {
                -      if (!ISALNUM(*b) || (ISALNUM(*b) && *b != '9' && *b != 'z' && *b != 'Z'))
                -        break;
                -      b--;
                -    }
                -    if (!ISALNUM(*b))
                -      b++;
                -    result = mrb_str_new(mrb, (char*) p, b - p);
                -  }
                -
                -  while (e >= b) {
                -    if (!ISALNUM(*e)) {
                -      if (*e == 0xff) {
                -        mrb_str_cat_lit(mrb, result, "\x01");
                -        (*e) = 0;
                -      }
                -      else
                -        (*e)++;
                -      break;
                -    }
                -    prepend = NULL;
                -    if (*e == '9') {
                -      if (e == b) prepend = "1";
                -      *e = '0';
                -    }
                -    else if (*e == 'z') {
                -      if (e == b) prepend = "a";
                -      *e = 'a';
                -    }
                -    else if (*e == 'Z') {
                -      if (e == b) prepend = "A";
                -      *e = 'A';
                -    }
                -    else {
                -      (*e)++;
                -      break;
                -    }
                -    if (prepend) mrb_str_cat_cstr(mrb, result, prepend);
                -    e--;
                -  }
                -  result = mrb_str_cat(mrb, result, (char*) b, t - b);
                -  l = RSTRING_LEN(result);
                -  mrb_str_resize(mrb, self, l);
                -  memcpy(RSTRING_PTR(self), RSTRING_PTR(result), l);
                -  return self;
                -}
                -
                -
                - -
                -

                - - #octObject - - - - - -

                - - - - -
                -
                -
                -
                -840
                -841
                -842
                -843
                -844
                -
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 840
                -
                -static mrb_value
                -mrb_str_oct(mrb_state *mrb, mrb_value self)
                -{
                -  return mrb_str_to_inum(mrb, self, 8, FALSE);
                -}
                -
                -
                - -
                -

                - - #ordObject - - - - - -

                - - - - -
                -
                -
                -
                -1053
                -1054
                -1055
                -1056
                -1057
                -1058
                -1059
                -
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 1053
                -
                -static mrb_value
                -mrb_str_ord(mrb_state* mrb, mrb_value str)
                -{
                -  if (RSTRING_LEN(str) == 0)
                -    mrb_raise(mrb, E_ARGUMENT_ERROR, "empty string");
                -  return mrb_fixnum_value((unsigned char)RSTRING_PTR(str)[0]);
                -}
                -
                -
                - -
                -

                - - #partition(sep) ⇒ Object - - - - - -

                -
                - - - -
                -
                -
                - -

                Raises:

                - - -
                - - - - - - -
                -
                -
                -
                -144
                -145
                -146
                -147
                -148
                -149
                -150
                -151
                -152
                -153
                -
                -
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 144
                -
                -def partition(sep)
                -  raise TypeError, "type mismatch: #{sep.class} given" unless sep.is_a? String
                -  n = index(sep)
                -  unless n.nil?
                -    m = n + sep.size
                -    [ slice(0, n), sep, slice(m, size - m) ]
                -  else
                -    [ self, "", "" ]
                -  end
                -end
                -
                -
                - -
                -

                - - #prepend(arg) ⇒ Object - - - - - -

                -
                -

                call-seq: - str.prepend(other_str) -> str

                - -

                Prepend—Prepend the given string to str.

                - -

                a = “world” - a.prepend(“hello “) #=> “hello world” - a #=> “hello world”

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -349
                -350
                -351
                -352
                -
                -
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 349
                -
                -def prepend(arg)
                -  self[0, 0] = arg
                -  self
                -end
                -
                -
                - -
                -

                - - #replace(other_str) ⇒ String - - - - - -

                -
                -

                s = “hello” #=> “hello” - s.replace “world” #=> “world”

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (String) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -1885
                -1886
                -1887
                -1888
                -1889
                -1890
                -1891
                -1892
                -
                -
                # File 'src/string.c', line 1885
                -
                -static mrb_value
                -mrb_str_replace(mrb_state *mrb, mrb_value str)
                -{
                -  mrb_value str2;
                -
                -  mrb_get_args(mrb, "S", &str2);
                -  return str_replace(mrb, mrb_str_ptr(str), mrb_str_ptr(str2));
                -}
                -
                -
                - -
                -

                - - #reverseString - - - - - -

                -
                -

                Returns a new string with the characters from str in reverse order.

                - -

                “stressed”.reverse #=> “desserts”

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (String) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -2051
                -2052
                -2053
                -2054
                -2055
                -2056
                -2057
                -
                -
                # File 'src/string.c', line 2051
                -
                -static mrb_value
                -mrb_str_reverse(mrb_state *mrb, mrb_value str)
                -{
                -  mrb_value str2 = mrb_str_dup(mrb, str);
                -  mrb_str_reverse_bang(mrb, str2);
                -  return str2;
                -}
                -
                -
                - -
                -

                - - #reverse!String - - - - - -

                -
                -

                Reverses str in place.

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (String) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -2004
                -2005
                -2006
                -2007
                -2008
                -2009
                -2010
                -2011
                -2012
                -2013
                -2014
                -2015
                -2016
                -2017
                -2018
                -2019
                -2020
                -2021
                -2022
                -2023
                -2024
                -2025
                -2026
                -2027
                -2028
                -2029
                -2030
                -2031
                -2032
                -2033
                -2034
                -2035
                -2036
                -2037
                -2038
                -2039
                -
                -
                # File 'src/string.c', line 2004
                -
                -static mrb_value
                -mrb_str_reverse_bang(mrb_state *mrb, mrb_value str)
                -{
                -  struct RString *s = mrb_str_ptr(str);
                -  char *p, *e;
                -
                -#ifdef MRB_UTF8_STRING
                -  mrb_int utf8_len = RSTRING_CHAR_LEN(str);
                -  mrb_int len = RSTR_LEN(s);
                -
                -  if (utf8_len < 2) return str;
                -  if (utf8_len < len) {
                -    mrb_str_modify(mrb, s);
                -    p = RSTR_PTR(s);
                -    e = p + RSTR_LEN(s);
                -    while (p<e) {
                -      mrb_int clen = utf8len(p, e);
                -      str_reverse(p, p + clen - 1);
                -      p += clen;
                -    }
                -    goto bytes;
                -  }
                -#endif
                -
                -  if (RSTR_LEN(s) > 1) {
                -    mrb_str_modify(mrb, s);
                -    goto bytes;
                -  }
                -  return str;
                -
                - bytes:
                -  p = RSTR_PTR(s);
                -  e = p + RSTR_LEN(s) - 1;
                -  str_reverse(p, e);
                -  return str;
                -}
                -
                -
                - -
                -

                - - #rindex(substring[, offset]) ⇒ Fixnum? - - - - - -

                -
                -

                Returns the index of the last occurrence of the given substring. -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(‘l’, 2) #=> 2

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (Fixnum, nil) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -2074
                -2075
                -2076
                -2077
                -2078
                -2079
                -2080
                -2081
                -2082
                -2083
                -2084
                -2085
                -2086
                -2087
                -2088
                -2089
                -2090
                -2091
                -2092
                -2093
                -2094
                -2095
                -2096
                -2097
                -2098
                -2099
                -2100
                -
                -
                # File 'src/string.c', line 2074
                -
                -static mrb_value
                -mrb_str_rindex(mrb_state *mrb, mrb_value str)
                -{
                -  mrb_value sub;
                -  mrb_int pos, len = RSTRING_CHAR_LEN(str);
                -
                -  if (mrb_get_args(mrb, "S|i", &sub, &pos) == 1) {
                -    pos = len;
                -  }
                -  else {
                -    if (pos < 0) {
                -      pos += len;
                -      if (pos < 0) {
                -        return mrb_nil_value();
                -      }
                -    }
                -    if (pos > len) pos = len;
                -  }
                -  pos = chars2bytes(str, 0, pos);
                -  pos = str_rindex(mrb, str, sub, pos);
                -  if (pos >= 0) {
                -    pos = bytes2chars(RSTRING_PTR(str), RSTRING_LEN(str), pos);
                -    BYTES_ALIGN_CHECK(pos);
                -    return mrb_fixnum_value(pos);
                -  }
                -  return mrb_nil_value();
                -}
                -
                -
                - -
                -

                - - #rjust(idx, padstr = ' ') ⇒ Object - - - - - -

                -
                -

                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"
                -
                - - -
                -
                -
                - -

                Raises:

                - - -
                - - - - - - -
                -
                -
                -
                -294
                -295
                -296
                -297
                -298
                -299
                -300
                -
                -
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 294
                -
                -def rjust(idx, padstr = ' ')
                -  raise ArgumentError, 'zero width padding' if padstr == ''
                -  return self if idx <= self.size
                -  pad_repetitions = (idx / padstr.length).ceil
                -  padding = (padstr * pad_repetitions)[0...(idx - self.length)]
                -  padding + self
                -end
                -
                -
                - -
                -

                - - #rpartition(sep) ⇒ Object - - - - - -

                -
                - - - -
                -
                -
                - -

                Raises:

                - - -
                - - - - - - -
                -
                -
                -
                -155
                -156
                -157
                -158
                -159
                -160
                -161
                -162
                -163
                -164
                -
                -
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 155
                -
                -def rpartition(sep)
                -  raise TypeError, "type mismatch: #{sep.class} given" unless sep.is_a? String
                -  n = rindex(sep)
                -  unless n.nil?
                -    m = n + sep.size
                -    [ slice(0, n), sep, slice(m, size - m) ]
                -  else
                -    [ "", "", self ]
                -  end
                -end
                -
                -
                - -
                -

                - - #rstripObject - - - - - -

                -
                -

                call-seq: - str.rstrip -> new_str

                - -

                Returns a copy of str with trailing whitespace removed. See also -String#lstrip and String#strip.

                - -

                ” hello “.rstrip #=> “ hello” - “hello”.rstrip #=> “hello”

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -43
                -44
                -45
                -46
                -47
                -48
                -
                -
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 43
                -
                -def rstrip
                -  a = 0
                -  z = self.size - 1
                -  z -= 1 while a <= z and " \f\n\r\t\v\0".include?(self[z])
                -  (z >= 0) ? self[a..z] : ""
                -end
                -
                -
                - -
                -

                - - #rstrip!Object - - - - - -

                -
                -

                call-seq: - str.rstrip! -> self or nil

                - -

                Removes trailing whitespace from str, returning nil if -no change was made. See also String#lstrip! and -String#strip!.

                - -

                ” hello “.rstrip #=> “ hello” - “hello”.rstrip! #=> nil

                - - -
                -
                -
                - -

                Raises:

                - - -
                - - - - - - -
                -
                -
                -
                -95
                -96
                -97
                -98
                -99
                -
                -
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 95
                -
                -def rstrip!
                -  raise FrozenError, "can't modify frozen String" if frozen?
                -  s = self.rstrip
                -  (s == self) ? nil : self.replace(s)
                -end
                -
                -
                - -
                -

                - - #setbyte(index, integer) ⇒ Integer - - - - - -

                -
                -

                modifies the indexth byte as integer.

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                - - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -2805
                -2806
                -2807
                -2808
                -2809
                -2810
                -2811
                -2812
                -2813
                -2814
                -2815
                -2816
                -2817
                -2818
                -2819
                -2820
                -2821
                -2822
                -2823
                -
                -
                # File 'src/string.c', line 2805
                -
                -static mrb_value
                -mrb_str_setbyte(mrb_state *mrb, mrb_value str)
                -{
                -  mrb_int pos, byte;
                -  mrb_int len;
                -
                -  mrb_get_args(mrb, "ii", &pos, &byte);
                -
                -  len = RSTRING_LEN(str);
                -  if (pos < -len || len <= pos)
                -    mrb_raisef(mrb, E_INDEX_ERROR, "index %i out of string", pos);
                -  if (pos < 0)
                -    pos += len;
                -
                -  mrb_str_modify(mrb, mrb_str_ptr(str));
                -  byte &= 0xff;
                -  RSTRING_PTR(str)[pos] = (unsigned char)byte;
                -  return mrb_fixnum_value((unsigned char)byte);
                -}
                -
                -
                - -
                -

                - - #lengthInteger - - - - - -

                -
                -

                Same as sym.to_s.length.

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                - - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -917
                -918
                -919
                -920
                -921
                -922
                -
                -
                # File 'src/string.c', line 917
                -
                -static mrb_value
                -mrb_str_size(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_int len = RSTRING_CHAR_LEN(self);
                -  return mrb_fixnum_value(len);
                -}
                -
                -
                - -
                -

                - - - #[](fixnum) ⇒ Fixnum? - - #[](fixnum, fixnum) ⇒ String? - - #[](range) ⇒ String? - - #[](regexp) ⇒ String? - - #[](regexp, fixnum) ⇒ String? - - #[](other_str) ⇒ String? - - #slice(fixnum) ⇒ Fixnum? - - #slice(fixnum, fixnum) ⇒ String? - - #slice(range) ⇒ String? - - #slice(other_str) ⇒ String? - - - - - - -

                -
                -

                Element Reference—If passed a single Fixnum, returns the code -of the character at that position. If passed two Fixnum -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 -characters 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.

                - -

                If a String is given, that string is returned if it occurs in -str. In both cases, nil is returned if there is no -match.

                - -

                a = “hello there” - a[1] #=> 101(1.8.7) “e”(1.9.2) - a[1.1] #=> “e”(1.9.2) - a[1,3] #=> “ell” - a[1..3] #=> “ell” - a[-3,2] #=> “er” - a[-4..-2] #=> “her” - a[12..-1] #=> nil - a[-2..-4] #=> “” - a[“lo”] #=> “lo” - a[“bye”] #=> nil

                - - -
                -
                -
                - -

                Overloads:

                -
                  - - -
                • - #[](fixnum) ⇒ Fixnum? -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (Fixnum, nil) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #[](fixnum, fixnum) ⇒ String? -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String, nil) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #[](range) ⇒ String? -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String, nil) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #[](regexp) ⇒ String? -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String, nil) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #[](regexp, fixnum) ⇒ String? -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String, nil) - - - -
                  • - -
                  - -
                  - + + + + + +
                  +
                   
                  -      
                  -    
                  -      
                  -      
                • - #[](other_str) ⇒ String? -
                  -
                  - +292 +293 +294 +295 +296 +297 +298 +299 +300 +301
                • +
                  +
                  # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 292
                   
                  -  
                  +def chars(&block)
                  +  if block_given?
                  +    self.split('').each do |i|
                  +      block.call(i)
                  +    end
                  +    self
                  +  else
                  +    self.split('')
                  +  end
                  +end
                  +
                -
                - -

                Returns:

                -
                  - -
                • - - - (String, nil) - - - -
                • - -
                - -
                - - - - -
              • - #slice(fixnum) ⇒ Fixnum? -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  +
                  +

                  -
                • - - - (Fixnum, nil) - - - -
                • + #clearObject -

                -
                - - -
              • - - -
              • - #slice(fixnum, fixnum) ⇒ String? -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (String, nil) - - - -
                • -
                -
                - - -
              • - - -
              • - #slice(range) ⇒ String? -
                + +
                +

                call-seq: string.clear -> string

                +

                Makes string empty.

                -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (String, nil) - - - -
                • - -
                - -
                - - -
              • - - -
              • - #slice(other_str) ⇒ String? -
                -
                - +

                a = “abcde” a.clear #=> “”

                -

                Returns:

                -
                  - -
                • - - - (String, nil) - - - -
                • - -
                - -
                - - -
              • - - +
                -
                -
                 
                 
                -1259
                -1260
                -1261
                -1262
                -1263
                -1264
                -1265
                -1266
                -1267
                -1268
                -1269
                +12 +13 +14
                -
                # File 'src/string.c', line 1259
                -
                -static mrb_value
                -mrb_str_aref_m(mrb_state *mrb, mrb_value str)
                -{
                -  mrb_value a1, a2;
                -
                -  if (mrb_get_args(mrb, "o|o", &a1, &a2) == 1) {
                -    a2 = mrb_undef_value();
                -  }
                +      
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 12
                 
                -  return mrb_str_aref(mrb, str, a1, a2);
                -}
                +def clear + self.replace("") +end
                -

                +

                - #slice!(arg1, arg2 = nil) ⇒ Object + #codepoints(&block) ⇒ Object - + Also known as: + each_codepoint + -

                -
                -

                call-seq: - str.slice!(fixnum) -> new_str or nil - str.slice!(fixnum, fixnum) -> new_str or nil - str.slice!(range) -> 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!(“r”) #=> “r” - string #=> “thsa sting”

                - - -
                -
                -
                - -

                Raises:

                - - -
                - - +
                - + @@ -10294,9 +1139,9 @@

                -

                +

                - #split(pattern = "\n", [limit]) ⇒ Array + #each_byte(&block) ⇒ Object @@ -10304,308 +1149,54 @@

                -

                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 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 is omitted, 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 -fields will be returned (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.

                - -

                ” 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”] - “hello”.split(//) #=> [“h”, “e”, “l”, “l”, “o”] - “hello”.split(//, 3) #=> [“h”, “e”, “llo”]

                - -

                “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”, “”, “”]

                - - -
                -
                -
                - -
                -
                +

                Call the given block for each byte of self.

                -

                Returns:

                -
                  - -
                • - - - (Array) - - - -
                • - -
                - -
                - - +
                -
                -

                 
                 
                -182
                -183
                -184
                -185
                -186
                -187
                -188
                -189
                -190
                -191
                -192
                -193
                -194
                -195
                -196
                -197
                -198
                -199
                -200
                -201
                -202
                -203
                -204
                -205
                -206
                -207
                -208
                -209
                -210
                -211
                -212
                -213
                -214
                -215
                -216
                -217
                -218
                -219
                -220
                -221
                -222
                -223
                -224
                -225
                -226
                -227
                -228
                -229
                -230
                -231
                -232
                -233
                -234
                -235
                -236
                -
                -
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 182
                -
                -def slice!(arg1, arg2=nil)
                -  raise FrozenError, "can't modify frozen String" if frozen?
                -  raise "wrong number of arguments (for 1..2)" if arg1.nil? && arg2.nil?
                -
                -  if !arg1.nil? && !arg2.nil?
                -    idx = arg1
                -    idx += self.size if arg1 < 0
                -    if idx >= 0 && idx <= self.size && arg2 > 0
                -      str = self[idx, arg2]
                -    else
                -      return nil
                -    end
                -  else
                -    validated = false
                -    if arg1.kind_of?(Range)
                -      beg = arg1.begin
                -      ed = arg1.end
                -      beg += self.size if beg < 0
                -      ed += self.size if ed < 0
                -      ed -= 1 if arg1.exclude_end?
                -      validated = true
                -    elsif arg1.kind_of?(String)
                -      validated = true
                -    else
                -      idx = arg1
                -      idx += self.size if arg1 < 0
                -      validated = true if idx >=0 && arg1 < self.size
                -    end
                -    if validated
                -      str = self[arg1]
                -    else
                -      return nil
                -    end
                -  end
                -  unless str.nil? || str == ""
                -    if !arg1.nil? && !arg2.nil?
                -      idx = arg1 >= 0 ? arg1 : self.size+arg1
                -      str2 = self[0...idx] + self[idx+arg2..-1].to_s
                -    else
                -      if arg1.kind_of?(Range)
                -        idx = beg >= 0 ? beg : self.size+beg
                -        idx2 = ed>= 0 ? ed : self.size+ed
                -        str2 = self[0...idx] + self[idx2+1..-1].to_s
                -      elsif arg1.kind_of?(String)
                -        idx = self.index(arg1)
                -        str2 = self[0...idx] + self[idx+arg1.size..-1] unless idx.nil?
                -      else
                -        idx = arg1 >= 0 ? arg1 : self.size+arg1
                -        str2 = self[0...idx] + self[idx+1..-1].to_s
                -      end
                +316
                +317
                +318
                +319
                +320
                +321
                +322
                +323
                +324
                +325
                +326
                +
                +
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 316
                +
                +def codepoints(&block)
                +  cp = __codepoints()
                +  if block_given?
                +    cp.each do|x|
                +      block.call(x)
                     end
                -    self.replace(str2) unless str2.nil?
                +    self
                +  else
                +    cp
                   end
                -  str
                 end
                 
                 
                -2143
                -2144
                -2145
                -2146
                -2147
                -2148
                -2149
                -2150
                -2151
                -2152
                -2153
                -2154
                -2155
                -2156
                -2157
                -2158
                -2159
                -2160
                -2161
                -2162
                -2163
                -2164
                -2165
                -2166
                -2167
                -2168
                -2169
                -2170
                -2171
                -2172
                -2173
                -2174
                -2175
                -2176
                -2177
                -2178
                -2179
                -2180
                -2181
                -2182
                -2183
                -2184
                -2185
                -2186
                -2187
                -2188
                -2189
                -2190
                -2191
                -2192
                -2193
                -2194
                -2195
                -2196
                -2197
                -2198
                -2199
                -2200
                -2201
                -2202
                -2203
                -2204
                -2205
                -2206
                -2207
                -2208
                -2209
                -2210
                -2211
                -2212
                -2213
                -2214
                -2215
                -2216
                -2217
                -2218
                -2219
                -2220
                -2221
                -2222
                -2223
                -2224
                -2225
                -2226
                -2227
                -2228
                -2229
                -2230
                -2231
                -2232
                -2233
                -2234
                -2235
                -2236
                -2237
                -2238
                -2239
                -2240
                -2241
                -2242
                -2243
                -2244
                -2245
                -2246
                -2247
                -2248
                -2249
                +151 +152 +153 +154 +155 +156 +157 +158 +159
                -
                # File 'src/string.c', line 2143
                -
                -static mrb_value
                -mrb_str_split_m(mrb_state *mrb, mrb_value str)
                -{
                -  mrb_int argc;
                -  mrb_value spat = mrb_nil_value();
                -  enum {awk, string, regexp} split_type = string;
                -  mrb_int i = 0;
                -  mrb_int beg;
                -  mrb_int end;
                -  mrb_int lim = 0;
                -  mrb_bool lim_p;
                -  mrb_value result, tmp;
                -
                -  argc = mrb_get_args(mrb, "|oi", &spat, &lim);
                -  lim_p = (lim > 0 && argc == 2);
                -  if (argc == 2) {
                -    if (lim == 1) {
                -      if (RSTRING_LEN(str) == 0)
                -        return mrb_ary_new_capa(mrb, 0);
                -      return mrb_ary_new_from_values(mrb, 1, &str);
                -    }
                -    i = 1;
                -  }
                -
                -  if (argc == 0 || mrb_nil_p(spat)) {
                -    split_type = awk;
                -  }
                -  else if (!mrb_string_p(spat)) {
                -    mrb_raise(mrb, E_TYPE_ERROR, "expected String");
                -  }
                -  else if (RSTRING_LEN(spat) == 1 && RSTRING_PTR(spat)[0] == ' ') {
                -    split_type = awk;
                -  }
                -
                -  result = mrb_ary_new(mrb);
                -  beg = 0;
                -  if (split_type == awk) {
                -    mrb_bool skip = TRUE;
                -    mrb_int idx = 0;
                -    mrb_int str_len = RSTRING_LEN(str);
                -    unsigned int c;
                -    int ai = mrb_gc_arena_save(mrb);
                -
                -    idx = end = beg;
                -    while (idx < str_len) {
                -      c = (unsigned char)RSTRING_PTR(str)[idx++];
                -      if (skip) {
                -        if (ISSPACE(c)) {
                -          beg = idx;
                -        }
                -        else {
                -          end = idx;
                -          skip = FALSE;
                -          if (lim_p && lim <= i) break;
                -        }
                -      }
                -      else if (ISSPACE(c)) {
                -        mrb_ary_push(mrb, result, mrb_str_byte_subseq(mrb, str, beg, end-beg));
                -        mrb_gc_arena_restore(mrb, ai);
                -        skip = TRUE;
                -        beg = idx;
                -        if (lim_p) ++i;
                -      }
                -      else {
                -        end = idx;
                -      }
                -    }
                -  }
                -  else {                        /* split_type == string */
                -    mrb_int str_len = RSTRING_LEN(str);
                -    mrb_int pat_len = RSTRING_LEN(spat);
                -    mrb_int idx = 0;
                -    int ai = mrb_gc_arena_save(mrb);
                -
                -    while (idx < str_len) {
                -      if (pat_len > 0) {
                -        end = mrb_memsearch(RSTRING_PTR(spat), pat_len, RSTRING_PTR(str)+idx, str_len - idx);
                -        if (end < 0) break;
                -      }
                -      else {
                -        end = chars2bytes(str, idx, 1);
                -      }
                -      mrb_ary_push(mrb, result, mrb_str_byte_subseq(mrb, str, idx, end));
                -      mrb_gc_arena_restore(mrb, ai);
                -      idx += end + pat_len;
                -      if (lim_p && lim <= ++i) break;
                -    }
                -    beg = idx;
                -  }
                -  if (RSTRING_LEN(str) > 0 && (lim_p || RSTRING_LEN(str) > beg || lim < 0)) {
                -    if (RSTRING_LEN(str) == beg) {
                -      tmp = mrb_str_new_empty(mrb, str);
                -    }
                -    else {
                -      tmp = mrb_str_byte_subseq(mrb, str, beg, RSTRING_LEN(str)-beg);
                -    }
                -    mrb_ary_push(mrb, result, tmp);
                -  }
                -  if (!lim_p && lim == 0) {
                -    mrb_int len;
                -    while ((len = RARRAY_LEN(result)) > 0 &&
                -           (tmp = RARRAY_PTR(result)[len-1], RSTRING_LEN(tmp) == 0))
                -      mrb_ary_pop(mrb, result);
                -  }
                -
                -  return result;
                -}
                +
                # File 'mrblib/string.rb', line 151
                +
                +def each_byte(&block)
                +  return to_enum(:each_byte, &block) unless block
                +  pos = 0
                +  while pos < bytesize
                +    block.call(getbyte(pos))
                +    pos += 1
                +  end
                +  self
                +end
                -

                +

                - #squeeze([other_str]) ⇒ String + #each_char(&block) ⇒ Object @@ -10613,92 +1204,54 @@

                -

                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”

                - - -
                -
                -
                - -
                -
                +

                Call the given block for each character of self.

                -

                Returns:

                -
                  - -
                • - - - (String) - - - -
                • - -
                - -
                - - +
                -
                -
                 
                 
                -712
                -713
                -714
                -715
                -716
                -717
                -718
                -719
                -720
                -721
                -722
                +306 +307 +308 +309 +310 +311 +312 +313 +314
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 712
                -
                -static mrb_value
                -mrb_str_squeeze(mrb_state *mrb, mrb_value str)
                -{
                -  mrb_value pat = mrb_nil_value();
                -  mrb_value dup;
                -
                -  mrb_get_args(mrb, "|S", &pat);
                -  dup = mrb_str_dup(mrb, str);
                -  str_squeeze(mrb, dup, pat);
                -  return dup;
                -}
                +
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 306
                +
                +def each_char(&block)
                +  return to_enum :each_char unless block
                +  pos = 0
                +  while pos < self.size
                +    block.call(self[pos])
                +    pos += 1
                +  end
                +  self
                +end
                -

                +

                - #squeeze!([other_str]) ⇒ String? + #each_line(separator = "\n", &block) ⇒ Object @@ -10706,30 +1259,23 @@

                -

                Squeezes str in place, returning either str, or nil if no -changes were made.

                - - -
                -
                -
                - -
                -
                +

                Calls the given block for each line and pass the respective line.

                + +

                ISO 15.2.10.5.15

                -

                Returns:

                -
                - - - +
                -
                -
                 
                 
                -731
                -732
                -733
                -734
                -735
                -736
                -737
                -738
                -739
                -740
                -741
                +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 731
                -
                -static mrb_value
                -mrb_str_squeeze_bang(mrb_state *mrb, mrb_value str)
                -{
                -  mrb_value pat = mrb_nil_value();
                -
                -  mrb_get_args(mrb, "|S", &pat);
                -  if (str_squeeze(mrb, str, pat)) {
                -    return str;
                -  }
                -  return mrb_nil_value();
                -}
                +
                # File 'mrblib/string.rb', line 14
                +
                +def each_line(separator = "\n", &block)
                +  return to_enum(:each_line, separator) unless block
                +
                +  if separator.nil?
                +    block.call(self)
                +    return self
                +  end
                +  raise TypeError unless separator.is_a?(String)
                +
                +  paragraph_mode = false
                +  if separator.empty?
                +    paragraph_mode = true
                +    separator = "\n\n"
                +  end
                +  start = 0
                +  string = dup
                +  self_len = self.bytesize
                +  sep_len = separator.bytesize
                +
                +  while (pointer = string.byteindex(separator, start))
                +    pointer += sep_len
                +    pointer += 1 while paragraph_mode && string.getbyte(pointer) == 10 # 10 == \n
                +    block.call(string.byteslice(start, pointer - start))
                +    start = pointer
                +  end
                +  return self if start == self_len
                +
                +  block.call(string.byteslice(start, self_len - start))
                +  self
                +end
                -

                +

                - #start_with?([prefixes]) ⇒ Boolean + #gsub(*args, &block) ⇒ Object @@ -10792,36 +1371,23 @@

                -

                Returns true if +str+ starts with one of the +prefixes+ given.

                - -

                “hello”.start_with?(“hell”) #=> true

                - -

                # returns true if one of the prefixes matches. - “hello”.start_with?(“heaven”, “hell”) #=> true - “hello”.start_with?(“heaven”, “paradise”) #=> false - “h”.start_with?(“heaven”, “hell”) #=> false

                - - -
                -
                -
                - -
                -
                +

                Replace all matches of pattern with replacement. Call block (if given) for each match and replace pattern with the value of the block. Return the final value.

                + +

                ISO 15.2.10.5.18

                -

                Returns:

                -
                  +

                  Raises:

                  + -
                - - - - -
                - - - - - - -
                -
                -
                -
                -195
                -196
                -197
                -198
                -199
                -200
                -201
                -202
                -203
                -204
                -205
                -206
                -207
                -208
                -209
                -210
                -211
                -212
                -213
                -214
                -215
                -216
                -
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 195
                -
                -static mrb_value
                -mrb_str_start_with(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_value *argv, sub;
                -  mrb_int argc, i;
                -  mrb_get_args(mrb, "*", &argv, &argc);
                -
                -  for (i = 0; i < argc; i++) {
                -    size_t len_l, len_r;
                -    int ai = mrb_gc_arena_save(mrb);
                -    sub = mrb_ensure_string_type(mrb, argv[i]);
                -    mrb_gc_arena_restore(mrb, ai);
                -    len_l = RSTRING_LEN(self);
                -    len_r = RSTRING_LEN(sub);
                -    if (len_l >= len_r) {
                -      if (memcmp(RSTRING_PTR(self), RSTRING_PTR(sub), len_r) == 0) {
                -        return mrb_true_value();
                -      }
                -    }
                -  }
                -  return mrb_false_value();
                -}
                -
                -
                - -
                -

                - - #stripObject - - - - - -

                -
                -

                call-seq: - str.strip -> new_str

                - -

                Returns a copy of str with leading and trailing whitespace removed.

                - -

                ” hello “.strip #=> “hello” - “\tgoodbye\r\n”.strip #=> “goodbye”

                - - -
                -
                - -
                - @@ -10952,9 +1467,9 @@

                -

                +

                - #strip!Object + #gsub!(*args, &block) ⇒ Object @@ -10962,11 +1477,10 @@

                -

                call-seq: - str.strip! -> str or nil

                + +

                Replace all matches of pattern with replacement. Call block (if given) for each match and replace pattern with the value of the block. Modify self with the final value.

                -

                Removes leading and trailing whitespace from str. Returns - nil if str was not altered.

                +

                ISO 15.2.10.5.19

                @@ -10987,27 +1501,31 @@

                -

                - +
                +

                 
                 
                +52
                +53
                +54
                +55
                +56
                +57
                +58
                 59
                 60
                 61
                 62
                 63
                 64
                -65
                +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78
                -
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 59
                -
                -def strip
                -  a = 0
                -  z = self.size - 1
                -  a += 1 while a <= z and " \f\n\r\t\v".include?(self[a])
                -  z -= 1 while a <= z and " \f\n\r\t\v\0".include?(self[z])
                -  (z >= 0) ? self[a..z] : ""
                +      
                # File 'mrblib/string.rb', line 52
                +
                +def gsub(*args, &block)
                +  return to_enum(:gsub, *args) if args.length == 1 && !block
                +  raise ArgumentError, "wrong number of arguments (given #{args.length}, expected 1..2)" unless (1..2).include?(args.length)
                +
                +  pattern, replace = *args
                +  plen = pattern.length
                +  if args.length == 2 && block
                +    block = nil
                +  end
                +  offset = 0
                +  result = []
                +  while found = self.byteindex(pattern, offset)
                +    result << self.byteslice(offset, found - offset)
                +    offset = found + plen
                +    result << if block
                +      block.call(pattern).to_s
                +    else
                +      self.__sub_replace(replace, pattern, found)
                +    end
                +    if plen == 0
                +      result << self.byteslice(offset, 1)
                +      offset += 1
                +    end
                +  end
                +  result << self.byteslice(offset..-1) if offset < length
                +  result.join
                 end
                @@ -11015,9 +1533,9 @@

                -

                +

                - #sub(*args, &block) ⇒ Object + #insert(idx, str) ⇒ Object @@ -11025,12 +1543,17 @@

                -

                Replace only the first match of +pattern+ with -+replacement+. Call block (if given) for each -match and replace +pattern+ with the value of the -block. Return the final value.

                + +

                call-seq: str.insert(index, other_str) -> str

                -

                ISO 15.2.10.5.36

                +

                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"
                +
                @@ -11038,71 +1561,35 @@

                -
                - +

                +

                 
                 
                -108
                -109
                -110
                -111
                -112
                +87 +88 +89 +90 +91 +92 +93
                -
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 108
                +      
                # File 'mrblib/string.rb', line 87
                 
                -def strip!
                +def gsub!(*args, &block)
                   raise FrozenError, "can't modify frozen String" if frozen?
                -  s = self.strip
                -  (s == self) ? nil : self.replace(s)
                +  return to_enum(:gsub!, *args) if args.length == 1 && !block
                +  str = self.gsub(*args, &block)
                +  return nil unless self.index(args[0])
                +  self.replace(str)
                 end
                @@ -11110,9 +1597,9 @@

                -

                +

                - #sub!(*args, &block) ⇒ Object + #lines(&blk) ⇒ Object @@ -11120,107 +1607,60 @@

                -

                Replace only the first match of +pattern+ with -+replacement+. Call block (if given) for each -match and replace +pattern+ with the value of the -block. Modify +self+ with the final value.

                + +

                call-seq: string.lines -> array of string string.lines {|s| block} -> array of string

                -

                ISO 15.2.10.5.37

                +

                Returns strings per line;

                + +

                a = “abcndef” a.lines #=> [“abcn”, “def”]

                + +

                If a block is given, it works the same as each_line.

                -

                Raises:

                - -
                - -

                 
                 
                -150
                -151
                -152
                -153
                -154
                -155
                -156
                -157
                -158
                -159
                -160
                -161
                -162
                -163
                -164
                -165
                -166
                -167
                -168
                -169
                -170
                -171
                -172
                -173
                -174
                -175
                -176
                +224 +225 +226 +227 +228 +229 +230 +231 +232
                -
                # File 'mrblib/string.rb', line 150
                -
                -def sub(*args, &block)
                -  unless (1..2).include?(args.length)
                -    raise ArgumentError, "wrong number of arguments (given #{args.length}, expected 2)"
                -  end
                +      
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 224
                 
                -  pattern, replace = *args
                -  pattern.__to_str
                -  if args.length == 2 && block
                -    block = nil
                -  end
                -  unless block
                -    replace.__to_str
                -  end
                -  result = []
                -  this = dup
                -  found = index(pattern)
                -  return this unless found
                -  result << this[0, found]
                -  offset = found + pattern.length
                -  result << if block
                -    block.call(pattern).to_s
                -  else
                -    replace.__sub_replace(this[0, found], pattern, this[offset..-1] || "")
                +def insert(idx, str)
                +  if idx == -1
                +    return self << str
                +  elsif idx < 0
                +    idx += 1
                   end
                -  result << this[offset..-1] if offset < length
                -  result.join
                +  self[idx, 0] = str
                +  self
                 end
                - - - - -
                -
                -
                -
                -185
                -186
                -187
                -188
                -189
                -190
                -
                -
                # File 'mrblib/string.rb', line 185
                -
                -def sub!(*args, &block)
                -  raise FrozenError, "can't modify frozen String" if frozen?
                -  str = self.sub(*args, &block)
                -  return nil unless self.index(args[0])
                -  self.replace(str)
                -end
                -
                - -
                -

                - - #succObject - - - - -

                +
                 
                 
                -986
                -987
                -988
                -989
                -990
                -991
                -992
                -993
                -994
                +358 +359 +360 +361 +362 +363 +364 +365 +366
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 986
                -
                -static mrb_value
                -mrb_str_succ(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_value str;
                +      
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 358
                 
                -  str = mrb_str_dup(mrb, self);
                -  mrb_str_succ_bang(mrb, str);
                -  return str;
                -}
                +def lines(&blk) + lines = self.__lines + if blk + lines.each do |line| + blk.call(line) + end + end + lines +end
                -

                +

                - #succString + #ljust(idx, padstr = ' ') ⇒ Object @@ -11228,32 +1668,28 @@

                -

                Returns next sequence of the string;

                - -

                a = “abc” - a.succ #=> “abd”

                + +

                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"
                +
                -

                Returns:

                -
                - - - +
                -
                -
                 
                 
                -908
                -909
                -910
                -911
                -912
                -913
                -914
                -915
                -916
                -917
                -918
                -919
                -920
                -921
                -922
                -923
                -924
                -925
                -926
                -927
                -928
                -929
                -930
                -931
                -932
                -933
                -934
                -935
                -936
                -937
                -938
                -939
                -940
                -941
                -942
                -943
                -944
                -945
                -946
                -947
                -948
                -949
                -950
                -951
                -952
                -953
                -954
                -955
                -956
                -957
                -958
                -959
                -960
                -961
                -962
                -963
                -964
                -965
                -966
                -967
                -968
                -969
                -970
                -971
                -972
                -973
                -974
                -975
                -976
                -977
                -978
                -979
                -980
                -981
                -982
                -983
                -984
                +245 +246 +247 +248 +249 +250 +251
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 908
                -
                -static mrb_value
                -mrb_str_succ_bang(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_value result;
                -  unsigned char *p, *e, *b, *t;
                -  const char *prepend;
                -  struct RString *s = mrb_str_ptr(self);
                -  mrb_int l;
                -
                -  if (RSTRING_LEN(self) == 0)
                -    return self;
                -
                -  mrb_str_modify(mrb, s);
                -  l = RSTRING_LEN(self);
                -  b = p = (unsigned char*) RSTRING_PTR(self);
                -  t = e = p + l;
                -  *(e--) = 0;
                -
                -  // find trailing ascii/number
                -  while (e >= b) {
                -    if (ISALNUM(*e))
                -      break;
                -    e--;
                -  }
                -  if (e < b) {
                -    e = p + l - 1;
                -    result = mrb_str_new_lit(mrb, "");
                -  }
                -  else {
                -    // find leading letter of the ascii/number
                -    b = e;
                -    while (b > p) {
                -      if (!ISALNUM(*b) || (ISALNUM(*b) && *b != '9' && *b != 'z' && *b != 'Z'))
                -        break;
                -      b--;
                -    }
                -    if (!ISALNUM(*b))
                -      b++;
                -    result = mrb_str_new(mrb, (char*) p, b - p);
                -  }
                -
                -  while (e >= b) {
                -    if (!ISALNUM(*e)) {
                -      if (*e == 0xff) {
                -        mrb_str_cat_lit(mrb, result, "\x01");
                -        (*e) = 0;
                -      }
                -      else
                -        (*e)++;
                -      break;
                -    }
                -    prepend = NULL;
                -    if (*e == '9') {
                -      if (e == b) prepend = "1";
                -      *e = '0';
                -    }
                -    else if (*e == 'z') {
                -      if (e == b) prepend = "a";
                -      *e = 'a';
                -    }
                -    else if (*e == 'Z') {
                -      if (e == b) prepend = "A";
                -      *e = 'A';
                -    }
                -    else {
                -      (*e)++;
                -      break;
                -    }
                -    if (prepend) mrb_str_cat_cstr(mrb, result, prepend);
                -    e--;
                -  }
                -  result = mrb_str_cat(mrb, result, (char*) b, t - b);
                -  l = RSTRING_LEN(result);
                -  mrb_str_resize(mrb, self, l);
                -  memcpy(RSTRING_PTR(self), RSTRING_PTR(result), l);
                -  return self;
                -}
                +
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 245
                +
                +def ljust(idx, padstr = ' ')
                +  raise ArgumentError, 'zero width padding' if padstr == ''
                +  return self if idx <= self.size
                +  pad_repetitions = idx / padstr.size
                +  padding = (padstr * pad_repetitions)[0, idx-self.size]
                +  self + padding
                +end
                -

                +

                - #swapcaseString + #lstripObject @@ -11448,85 +1739,52 @@

                -

                Returns a copy of str with uppercase alphabetic characters converted -to lowercase and lowercase characters converted to uppercase. -Note: case conversion is effective only in ASCII region.

                - -

                “Hello”.swapcase #=> “hELLO” - “cYbEr_PuNk11”.swapcase #=> “CyBeR_pUnK11”

                + +

                call-seq: str.lstrip -> new_str

                +

                Returns a copy of str with leading whitespace removed. See also String#rstrip and String#strip.

                -
                -
                -
                - -
                -
                - +

                “ hello ”.lstrip #=> “hello ” “hello”.lstrip #=> “hello”

                -

                Returns:

                -
                  - -
                • - - - (String) - - - -
                • - -
                - -
                - - +
                -
                -
                 
                 
                -138
                -139
                -140
                -141
                -142
                -143
                -144
                -145
                -146
                +26 +27 +28 +29 +30 +31
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 138
                -
                -static mrb_value
                -mrb_str_swapcase(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_value str;
                +      
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 26
                 
                -  str = mrb_str_dup(mrb, self);
                -  mrb_str_swapcase_bang(mrb, str);
                -  return str;
                -}
                +def lstrip + a = 0 + z = self.size - 1 + a += 1 while a <= z and " \f\n\r\t\v".include?(self[a]) + (z >= 0) ? self[a..z] : "" +end
                -

                +

                - #swapcase!String? + #lstrip!Object @@ -11534,31 +1792,25 @@

                -

                Equivalent to String#swapcase, but modifies the receiver in -place, returning str, or nil if no changes were made. -Note: case conversion is effective only in ASCII region.

                + +

                call-seq: str.lstrip! -> self or nil

                +

                Removes leading whitespace from str, returning nil if no change was made. See also String#rstrip! and String#strip!.

                -
                -
                -
                - -
                -
                - +

                “ hello ”.lstrip #=> “hello ” “hello”.lstrip! #=> nil

                -

                Returns:

                -
                - - - +
                -
                -
                 
                 
                -101
                -102
                -103
                -104
                -105
                -106
                -107
                -108
                -109
                -110
                -111
                -112
                -113
                -114
                -115
                -116
                -117
                -118
                -119
                -120
                -121
                -122
                -123
                -124
                -125
                +78 +79 +80 +81 +82
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 101
                -
                -static mrb_value
                -mrb_str_swapcase_bang(mrb_state *mrb, mrb_value str)
                -{
                -  char *p, *pend;
                -  int modify = 0;
                -  struct RString *s = mrb_str_ptr(str);
                -
                -  mrb_str_modify(mrb, s);
                -  p = RSTRING_PTR(str);
                -  pend = p + RSTRING_LEN(str);
                -  while (p < pend) {
                -    if (ISUPPER(*p)) {
                -      *p = TOLOWER(*p);
                -      modify = 1;
                -    }
                -    else if (ISLOWER(*p)) {
                -      *p = TOUPPER(*p);
                -      modify = 1;
                -    }
                -    p++;
                -  }
                -
                -  if (modify) return str;
                -  return mrb_nil_value();
                -}
                +
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 78
                +
                +def lstrip!
                +  raise FrozenError, "can't modify frozen String" if frozen?
                +  s = self.lstrip
                +  (s == self) ? nil : self.replace(s)
                +end
                -

                +

                - #to_fFloat + #partition(sep) ⇒ Object @@ -11649,36 +1856,19 @@

                -

                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

                - - -
                -
                -
                - -
                -
                -
                -

                Returns:

                -
                - - - +
                -
                -
                 
                 
                -2585
                -2586
                -2587
                -2588
                -2589
                +114 +115 +116 +117 +118 +119 +120 +121 +122 +123
                -
                # File 'src/string.c', line 2585
                +      
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 114
                 
                -static mrb_value
                -mrb_str_to_f(mrb_state *mrb, mrb_value self)
                -{
                -  return mrb_float_value(mrb, mrb_str_to_dbl(mrb, self, FALSE));
                -}
                +def partition(sep) + raise TypeError, "type mismatch: #{sep.class} given" unless sep.is_a? String + n = index(sep) + unless n.nil? + m = n + sep.size + [ slice(0, n), sep, slice(m, size - m) ] + else + [ self[0..-1], "", "" ] + end +end
                -

                +

                - #to_i(base = 10) ⇒ Integer + #prepend(*args) ⇒ Object @@ -11729,98 +1924,56 @@

                -

                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.

                - -

                “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

                + +

                call-seq: str.prepend(other_str) -> str

                +

                Prepend—Prepend the given string to str.

                -
                -
                -
                - -
                -
                - +

                a = “world” a.prepend(“hello ”) #=> “hello world” a #=> “hello world”

                -

                Returns:

                - - -
                - - +
                -
                -
                 
                 
                -2489
                -2490
                -2491
                -2492
                -2493
                -2494
                -2495
                -2496
                -2497
                -2498
                -2499
                +338 +339 +340 +341 +342 +343 +344 +345
                -
                # File 'src/string.c', line 2489
                -
                -static mrb_value
                -mrb_str_to_i(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_int base = 10;
                -
                -  mrb_get_args(mrb, "|i", &base);
                -  if (base < 0) {
                -    mrb_raisef(mrb, E_ARGUMENT_ERROR, "illegal radix %i", base);
                -  }
                -  return mrb_str_to_inum(mrb, self, base, FALSE);
                -}
                +
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 338
                +
                +def prepend(*args)
                +  len = args.size
                +  while len > 0
                +    len -= 1
                +    self[0, 0] = args[len]
                +  end
                +  self
                +end
                -

                +

                - #to_sString + #rjust(idx, padstr = ' ') ⇒ Object @@ -11828,29 +1981,28 @@

                -

                Returns the receiver.

                + +

                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"
                +
                -

                Returns:

                -
                - - - +
                -
                -
                 
                 
                -2599
                -2600
                -2601
                -2602
                -2603
                -2604
                -2605
                -2606
                +264 +265 +266 +267 +268 +269 +270
                -
                # File 'src/string.c', line 2599
                -
                -static mrb_value
                -mrb_str_to_s(mrb_state *mrb, mrb_value self)
                -{
                -  if (mrb_obj_class(mrb, self) != mrb->string_class) {
                -    return mrb_str_dup(mrb, self);
                -  }
                -  return self;
                -}
                +
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 264
                +
                +def rjust(idx, padstr = ' ')
                +  raise ArgumentError, 'zero width padding' if padstr == ''
                +  return self if idx <= self.size
                +  pad_repetitions = idx / padstr.size
                +  padding = (padstr * pad_repetitions)[0, idx-self.size]
                +  padding + self
                +end
                -

                +

                - #to_sString + #rpartition(sep) ⇒ Object @@ -11907,29 +2052,19 @@

                -

                Returns the receiver.

                - - -
                -
                -
                - -
                -
                -
                -

                Returns:

                -
                - - - +
                -
                -
                 
                 
                -2599
                -2600
                -2601
                -2602
                -2603
                -2604
                -2605
                -2606
                +125 +126 +127 +128 +129 +130 +131 +132 +133 +134
                -
                # File 'src/string.c', line 2599
                -
                -static mrb_value
                -mrb_str_to_s(mrb_state *mrb, mrb_value self)
                -{
                -  if (mrb_obj_class(mrb, self) != mrb->string_class) {
                -    return mrb_str_dup(mrb, self);
                -  }
                -  return self;
                -}
                +
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 125
                +
                +def rpartition(sep)
                +  raise TypeError, "type mismatch: #{sep.class} given" unless sep.is_a? String
                +  n = rindex(sep)
                +  unless n.nil?
                +    m = n + sep.size
                +    [ slice(0, n), sep, slice(m, size - m) ]
                +  else
                +    [ "", "", self ]
                +  end
                +end
                -

                +

                - - #internObject - - #to_symObject - + #rstripObject @@ -11990,19 +2120,12 @@

                -

                Returns the Symbol corresponding to str, creating the -symbol if it did not previously exist. See Symbol#id2name.

                - -

                “Koala”.intern #=> :Koala - s = ‘cat’.to_sym #=> :cat - s == :cat #=> true - s = ‘@cat’.to_sym #=> :@cat - s == :@cat #=> true

                + +

                call-seq: str.rstrip -> new_str

                -

                This can also be used to create symbols that cannot be represented using the -:xxx notation.

                +

                Returns a copy of str with trailing whitespace removed. See also String#lstrip and String#strip.

                -

                ‘cat and dog’.to_sym #=> :”cat and dog”

                +

                “ hello ”.rstrip #=> “ hello” “hello”.rstrip #=> “hello”

                @@ -12010,37 +2133,39 @@

                -
                - +

                +
                 
                 
                -1935
                -1936
                -1937
                -1938
                -1939
                +43 +44 +45 +46 +47 +48
                -
                # File 'src/string.c', line 1935
                +      
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 43
                 
                -MRB_API mrb_value
                -mrb_str_intern(mrb_state *mrb, mrb_value self)
                -{
                -  return mrb_symbol_value(mrb_intern_str(mrb, self));
                -}
                +def rstrip + a = 0 + z = self.size - 1 + z -= 1 while a <= z and " \f\n\r\t\v\0".include?(self[z]) + (z >= 0) ? self[a..z] : "" +end
                -

                +

                - #tr(from_str, to_str) ⇒ String + #rstrip!Object @@ -12048,59 +2173,25 @@

                -

                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’, ‘’) #=> “hll” - “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”, “”) #=> “hll*wrld” - “hello-world”.tr(“a\-eo”, “”) #=> “hll*wrld”

                - -

                “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’”

                - -

                Note: conversion is effective only in ASCII region.

                + +

                call-seq: str.rstrip! -> self or nil

                +

                Removes trailing whitespace from str, returning nil if no change was made. See also String#lstrip! and String#strip!.

                -
                -
                -
                - -
                -
                - +

                “ hello ”.rstrip #=> “ hello” “hello”.rstrip! #=> nil

                -

                Returns:

                -
                - - - +
                -
                -
                 
                 
                -576
                -577
                -578
                -579
                -580
                -581
                -582
                -583
                -584
                -585
                -586
                +95 +96 +97 +98 +99
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 576
                -
                -static mrb_value
                -mrb_str_tr(mrb_state *mrb, mrb_value str)
                -{
                -  mrb_value dup;
                -  mrb_value p1, p2;
                -
                -  mrb_get_args(mrb, "SS", &p1, &p2);
                -  dup = mrb_str_dup(mrb, str);
                -  str_tr(mrb, dup, p1, p2, FALSE);
                -  return dup;
                -}
                +
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 95
                +
                +def rstrip!
                +  raise FrozenError, "can't modify frozen String" if frozen?
                +  s = self.rstrip
                +  (s == self) ? nil : self.replace(s)
                +end
                -

                +

                - #tr!(from_str, to_str) ⇒ String? + #slice!(arg1, arg2 = nil) ⇒ Object @@ -12163,30 +2237,25 @@

                -

                Translates str in place, using the same rules as String#tr. -Returns str, or nil if no changes were made.

                + +

                call-seq: str.slice!(fixnum) -> new_str or nil str.slice!(fixnum, fixnum) -> new_str or nil str.slice!(range) -> 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!(“r”) #=> “r” string #=> “thsa sting”

                -

                Returns:

                -
                - - - +
                -
                - + -
                -
                +      
                +
                +
                +152
                +153
                +154
                +155
                +156
                +157
                +158
                +159
                +160
                +161
                +162
                +163
                +164
                +165
                +166
                +167
                +168
                +169
                +170
                +171
                +172
                +173
                +174
                +175
                +176
                +177
                +178
                +179
                +180
                +181
                +182
                +183
                +184
                +185
                +186
                +187
                +188
                +189
                +190
                +191
                +192
                +193
                +194
                +195
                +196
                +197
                +198
                +199
                +200
                +201
                +202
                +203
                +204
                +205
                +206
                +
                +
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 152
                 
                +def slice!(arg1, arg2=nil)
                +  raise FrozenError, "can't modify frozen String" if frozen?
                +  raise ArgumentError, "wrong number of arguments (expected 1..2)" if arg1.nil? && arg2.nil?
                 
                -595
                -596
                -597
                -598
                -599
                -600
                -601
                -602
                -603
                -604
                -605
                -
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 595
                -
                -static mrb_value
                -mrb_str_tr_bang(mrb_state *mrb, mrb_value str)
                -{
                -  mrb_value p1, p2;
                -
                -  mrb_get_args(mrb, "SS", &p1, &p2);
                -  if (str_tr(mrb, str, p1, p2, FALSE)) {
                -    return str;
                -  }
                -  return mrb_nil_value();
                -}
                + if !arg1.nil? && !arg2.nil? + idx = arg1 + idx += self.size if arg1 < 0 + if idx >= 0 && idx <= self.size && arg2 > 0 + str = self[idx, arg2] + else + return nil + end + else + validated = false + if arg1.kind_of?(Range) + beg = arg1.begin + ed = arg1.end + beg += self.size if beg < 0 + ed += self.size if ed < 0 + ed -= 1 if arg1.exclude_end? + validated = true + elsif arg1.kind_of?(String) + validated = true + else + idx = arg1 + idx += self.size if arg1 < 0 + validated = true if idx >=0 && arg1 < self.size + end + if validated + str = self[arg1] + else + return nil + end + end + unless str.nil? || str == "" + if !arg1.nil? && !arg2.nil? + idx = arg1 >= 0 ? arg1 : self.size+arg1 + str2 = self[0...idx] + self[idx+arg2..-1].to_s + else + if arg1.kind_of?(Range) + idx = beg >= 0 ? beg : self.size+beg + idx2 = ed>= 0 ? ed : self.size+ed + str2 = self[0...idx] + self[idx2+1..-1].to_s + elsif arg1.kind_of?(String) + idx = self.index(arg1) + str2 = self[0...idx] + self[idx+arg1.size..-1] unless idx.nil? + else + idx = arg1 >= 0 ? arg1 : self.size+arg1 + str2 = self[0...idx] + self[idx+1..-1].to_s + end + end + self.replace(str2) unless str2.nil? + end + str +end
                -

                +

                - #tr_s(from_str, to_str) ⇒ String + #stripObject @@ -12249,89 +2401,54 @@

                -

                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’, ‘’) #=> “ho” - “hello”.tr_s(‘el’, ‘hx’) #=> “hhxo”

                + +

                call-seq: str.strip -> new_str

                +

                Returns a copy of str with leading and trailing whitespace removed.

                -
                -
                -
                - -
                -
                - +

                “ hello ”.strip #=> “hello” “tgoodbyern”.strip #=> “goodbye”

                -

                Returns:

                -
                  - -
                • - - - (String) - - - -
                • - -
                - -
                - - +
                -
                -
                 
                 
                -618
                -619
                -620
                -621
                -622
                -623
                -624
                -625
                -626
                -627
                -628
                +59 +60 +61 +62 +63 +64 +65
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 618
                -
                -static mrb_value
                -mrb_str_tr_s(mrb_state *mrb, mrb_value str)
                -{
                -  mrb_value dup;
                -  mrb_value p1, p2;
                -
                -  mrb_get_args(mrb, "SS", &p1, &p2);
                -  dup = mrb_str_dup(mrb, str);
                -  str_tr(mrb, dup, p1, p2, TRUE);
                -  return dup;
                -}
                +
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 59
                +
                +def strip
                +  a = 0
                +  z = self.size - 1
                +  a += 1 while a <= z and " \f\n\r\t\v".include?(self[a])
                +  z -= 1 while a <= z and " \f\n\r\t\v\0".include?(self[z])
                +  (z >= 0) ? self[a..z] : ""
                +end
                -

                +

                - #tr_s!(from_str, to_str) ⇒ String? + #strip!Object @@ -12339,30 +2456,23 @@

                -

                Performs String#tr_s processing on str in place, returning -str, or nil if no changes were made.

                - - -
                -
                -
                - -
                -
                +

                call-seq: str.strip! -> str or nil

                + +

                Removes leading and trailing whitespace from str. Returns nil if str was not altered.

                -

                Returns:

                -
                - - - +
                -
                -
                 
                 
                -637
                -638
                -639
                -640
                -641
                -642
                -643
                -644
                -645
                -646
                -647
                +108 +109 +110 +111 +112
                -
                # File 'mrbgems/mruby-string-ext/src/string.c', line 637
                -
                -static mrb_value
                -mrb_str_tr_s_bang(mrb_state *mrb, mrb_value str)
                -{
                -  mrb_value p1, p2;
                -
                -  mrb_get_args(mrb, "SS", &p1, &p2);
                -  if (str_tr(mrb, str, p1, p2, TRUE)) {
                -    return str;
                -  }
                -  return mrb_nil_value();
                -}
                +
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 108
                +
                +def strip!
                +  raise FrozenError, "can't modify frozen String" if frozen?
                +  s = self.strip
                +  (s == self) ? nil : self.replace(s)
                +end
                -

                +

                - #upcaseString + #sub(*args, &block) ⇒ Object @@ -12425,84 +2518,82 @@

                -

                Returns a copy of str with all lowercase letters replaced with their -uppercase counterparts. The operation is locale insensitive—only -characters ‘a’ to ‘z’ are affected.

                + +

                Replace only the first match of pattern with replacement. Call block (if given) for each match and replace pattern with the value of the block. Return the final value.

                -

                “hEllO”.upcase #=> “HELLO”

                +

                ISO 15.2.10.5.36

                -
                -
                - - -
                -
                - -

                Returns:

                -
                  - -
                • - - - (String) - - - -
                • - -
                -
                - - - - -
                -
                 
                 
                -2649
                -2650
                -2651
                -2652
                -2653
                -2654
                -2655
                -2656
                -2657
                +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133
                -
                # File 'src/string.c', line 2649
                +      
                # File 'mrblib/string.rb', line 112
                 
                -static mrb_value
                -mrb_str_upcase(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_value str;
                +def sub(*args, &block)
                +  unless (1..2).include?(args.length)
                +    raise ArgumentError, "wrong number of arguments (given #{args.length}, expected 2)"
                +  end
                 
                -  str = mrb_str_dup(mrb, self);
                -  mrb_str_upcase_bang(mrb, str);
                -  return str;
                -}
                + pattern, replace = *args + if args.length == 2 && block + block = nil + end + result = [] + found = self.index(pattern) + return self.dup unless found + result << self.byteslice(0, found) + offset = found + pattern.length + result << if block + block.call(pattern).to_s + else + self.__sub_replace(replace, pattern, found) + end + result << self.byteslice(offset..-1) if offset < length + result.join +end
                -

                +

                - #upcase!String? + #sub!(*args, &block) ⇒ Object @@ -12510,30 +2601,23 @@

                -

                Upcases the contents of str, returning nil if no changes -were made.

                - - -
                -
                -
                - -
                -
                +

                Replace only the first match of pattern with replacement. Call block (if given) for each match and replace pattern with the value of the block. Modify self with the final value.

                + +

                ISO 15.2.10.5.37

                -

                Returns:

                -
                - - - +
                -
                -
                 
                 
                -2616
                -2617
                -2618
                -2619
                -2620
                -2621
                -2622
                -2623
                -2624
                -2625
                -2626
                -2627
                -2628
                -2629
                -2630
                -2631
                -2632
                -2633
                -2634
                -2635
                -2636
                +142 +143 +144 +145 +146 +147
                -
                # File 'src/string.c', line 2616
                -
                -static mrb_value
                -mrb_str_upcase_bang(mrb_state *mrb, mrb_value str)
                -{
                -  struct RString *s = mrb_str_ptr(str);
                -  char *p, *pend;
                -  mrb_bool modify = FALSE;
                -
                -  mrb_str_modify_keep_ascii(mrb, s);
                -  p = RSTRING_PTR(str);
                -  pend = RSTRING_END(str);
                -  while (p < pend) {
                -    if (ISLOWER(*p)) {
                -      *p = TOUPPER(*p);
                -      modify = TRUE;
                -    }
                -    p++;
                -  }
                -
                -  if (modify) return str;
                -  return mrb_nil_value();
                -}
                +
                # File 'mrblib/string.rb', line 142
                +
                +def sub!(*args, &block)
                +  raise FrozenError, "can't modify frozen String" if frozen?
                +  str = self.sub(*args, &block)
                +  return nil unless self.index(args[0])
                +  self.replace(str)
                +end
                @@ -12616,15 +2665,10 @@

                -

                call-seq: - str.upto(other_str, exclusive=false) {|s| block } -> str - str.upto(other_str, exclusive=false) -> an_enumerator

                + +

                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.

                +

                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.

                @@ -12640,9 +2684,7 @@

                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.

                +

                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   #=> []
                @@ -12668,14 +2710,21 @@ 

                - - + +
                 
                 
                +398
                +399
                +400
                +401
                +402
                +403
                +404
                 405
                 406
                 407
                @@ -12711,16 +2760,10 @@ 

                437 438 439 -440 -441 -442 -443 -444 -445 -446

                +440
                -
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 405
                +      
                # File 'mrbgems/mruby-string-ext/mrblib/string.rb', line 398
                 
                 def upto(max, exclusive=false, &block)
                   return to_enum(:upto, max, exclusive) unless block
                @@ -12742,7 +2785,6 @@ 

                # both edges are all digits bi = self.to_i(10) ei = max.to_i(10) - len = self.length if (bi > 0 or bi == "0"*len) and (ei > 0 or ei == "0"*maxlen) while bi <= ei break if exclusive and bi == ei @@ -12760,6 +2802,8 @@

                break if exclusive and n == 0 yield bs break if n == 0 + bsiz = bs.size + break if bsiz > max.size || bsiz == 0 bs = bs.succ end self @@ -12773,11 +2817,11 @@

                - + diff --git a/docs/api/Struct.html b/docs/api/Struct.html index 9ed2f52..22af859 100644 --- a/docs/api/Struct.html +++ b/docs/api/Struct.html @@ -6,17 +6,17 @@ Class: Struct - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -91,6 +91,11 @@ +
                +
                Includes:
                +
                Enumerable
                +
                + @@ -98,15 +103,34 @@
                Defined in:
                -
                mrbgems/mruby-struct/src/struct.c,
                - mrbgems/mruby-struct/mrblib/struct.rb
                -
                +
                mrbgems/mruby-struct/mrblib/struct.rb
                +

                Overview

                +
                + +

                Struct

                + +

                ISO 15.2.18

                + + +
                +
                +
                + + +
                + + +

                Constant Summary

                + +

                Constants included + from Enumerable

                +

                Enumerable::NONE

                @@ -123,7 +147,7 @@

              • - #==(other_struct) ⇒ Boolean + #dig(idx, *args) ⇒ Object @@ -137,7 +161,8 @@

                -

                Equality—Returns true if other_struct is equal to this one: they must be of the same class as generated by Struct::new, and the values of all instance variables must be equal (according to Object#==).

                +
                +

                call-seq: hsh.dig(key,…) -> object.

              • @@ -146,7 +171,7 @@

              • - #[] ⇒ Object + #each(&block) ⇒ Object @@ -160,7 +185,8 @@

                -

                Attribute Reference—Returns the value of the instance variable named by symbol, or indexed (0..length-1) by fixnum.

                +
                +

                Calls the given block for each element of self and pass the respective element.

              • @@ -169,7 +195,7 @@

              • - #[]= ⇒ Object + #each_pair(&block) ⇒ Object @@ -183,7 +209,8 @@

                -

                Attribute Assignment—Assigns to the instance variable named by symbol or fixnum the value obj and returns it.

                +
                +

                Calls the given block for each element of self and pass the name and value of the respective element.

              • @@ -192,7 +219,7 @@

              • - #_inspect(recur_list) ⇒ Object + #select(&block) ⇒ Object @@ -207,1721 +234,193 @@

                +

                Calls the given block for each element of self and returns an array with all elements of which block is not false.

              • -
              • - - - #dig(idx, *args) ⇒ Object - - - - + + + - -

                call-seq: hsh.dig(key,…) -> object.

                -
                -
              • +

                Methods included from Enumerable

                +

                #all?, #any?, #chain, #chunk, #chunk_while, #collect, #count, #cycle, #detect, #drop, #drop_while, #each_cons, #each_entry, #each_slice, #each_with_index, #each_with_object, #entries, #filter_map, #find_all, #find_index, #first, #flat_map, #grep, #grep_v, #group_by, #hash, #include?, #inject, #lazy, #max, #max_by, #min, #min_by, #minmax, #minmax_by, #none?, #one?, #partition, #reject, #reverse_each, #sort, #sort_by, #sum, #take, #take_while, #tally, #to_h, #uniq, #zip

                - -
              • - - - #each(&block) ⇒ Object - + +
                +

                Instance Method Details

                - - - - - - +
                +

                + #dig(idx, *args) ⇒ Object -

                Calls the given block for each element of +self+ and pass the respective element.

                -
                - -

              • - -
              • - - - #each_pair(&block) ⇒ Object + +
                +
                +

                call-seq: hsh.dig(key,…) -> object

                - - - - - - - - - +

                Extracts the nested value specified by the sequence of key objects by calling dig at each step, returning nil if any intermediate step is nil.

                + +
                +
                +
                -

                Calls the given block for each element of +self+ and pass the name and value of the respectiev element.

                -
                - -
              • - -
              • - - - #eql? ⇒ Boolean - + - - - - - - - - - + + + + + +
                +
                 
                -  
                -    

                code-seq: struct.eql?(other) -> true or false.

                -
                - - - -
              • - - - #initialize ⇒ Object - +61 +62 +63 +64 +65 +66 +67 +68
              • +
                +
                # File 'mrbgems/mruby-struct/mrblib/struct.rb', line 61
                 
                +def dig(idx,*args)
                +  n = self[idx]
                +  if args.size > 0
                +    n&.dig(*args)
                +  else
                +    n
                +  end
                +end
                +
                + - - - - constructor - - - - +
                +

                + #each(&block) ⇒ Object -

                15.2.18.4.8.

                -
                - -

              • - -
              • - - - #initialize_copy ⇒ Object + +
                +
                +

                Calls the given block for each element of self and pass the respective element.

                - - - - - - - - - +

                ISO 15.2.18.4.4

                + +
                +
                +
                -

                :nodoc:.

                -
                - -
              • - -
              • - - - #inspect ⇒ Object - + - - (also: #to_s) - - - - - - - - - + + + + + +
                +
                 
                -  
                -    

                call-seq: struct.to_s -> string struct.inspect -> string.

                -
                - - - -
              • - - - #length ⇒ Object - +13 +14 +15 +16 +17 +18
              • +
                +
                # File 'mrbgems/mruby-struct/mrblib/struct.rb', line 13
                 
                +def each(&block)
                +  self.class.members.each{|field|
                +    block.call(self[field])
                +  }
                +  self
                +end
                +
                + - - - - - - +
                +

                + #each_pair(&block) ⇒ Object -

                Returns number of struct members.

                -
                - -

              • - -
              • - - - #members ⇒ Array + +
                +
                +

                Calls the given block for each element of self and pass the name and value of the respective element.

                - - - - - - - - - +

                ISO 15.2.18.4.5

                + +
                +
                +
                -

                Returns an array of strings representing the names of the instance variables.

                -
                - -
              • - -
              • - - - #select(&block) ⇒ Object - + - - - - - - - - - - - -

                Calls the given block for each element of +self+ and returns an array with all elements of which block is not false.

                -
                - -
              • - - -
              • - - - #size ⇒ Object - - - - - - - - - - - - - -

                Returns number of struct members.

                -
                - -
              • - - -
              • - - - #to_a ⇒ Object - - - - - - - - - - - - - -

                Create an array from struct values.

                -
                - -
              • - - -
              • - - - #to_h ⇒ Hash - - - - - - - - - - - - - -

                Create a hash from member names and struct values.

                -
                - -
              • - - -
              • - - - #values ⇒ Object - - - - - - - - - - - - - -

                Create an array from struct values.

                -
                - -
              • - - -
              • - - - #values_at ⇒ Object - - - - - - - - - - - - - -
                -
                - -
              • - - - - - -
                -

                Constructor Details

                - -
                -

                - - #initializeObject - - - - - -

                -
                -

                15.2.18.4.8

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -344
                -345
                -346
                -347
                -348
                -349
                -350
                -351
                -352
                -
                -
                # File 'mrbgems/mruby-struct/src/struct.c', line 344
                -
                -static mrb_value
                -mrb_struct_initialize(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_value *argv;
                -  mrb_int argc;
                -
                -  mrb_get_args(mrb, "*!", &argv, &argc);
                -  return mrb_struct_initialize_withArg(mrb, argc, argv, self);
                -}
                -
                -
                - -
                - - -
                -

                Instance Method Details

                - - -
                -

                - - #==(other_struct) ⇒ Boolean - - - - - -

                -
                -

                Equality—Returns true if other_struct is -equal to this one: they must be of the same class as generated by -Struct::new, and the values of all instance variables -must be equal (according to Object#==).

                - -

                Customer = Struct.new(:name, :address, :zip) - joe = Customer.new(“Joe Smith”, “123 Maple, Anytown NC”, 12345) - joejr = Customer.new(“Joe Smith”, “123 Maple, Anytown NC”, 12345) - jane = Customer.new(“Jane Doe”, “456 Elm, Anytown NC”, 12345) - joe == joejr #=> true - joe == jane #=> false

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (Boolean) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -545
                -546
                -547
                -548
                -549
                -550
                -551
                -552
                -553
                -554
                -555
                -556
                -557
                -558
                -559
                -560
                -561
                -562
                -563
                -564
                -565
                -566
                -567
                -568
                -569
                -570
                -571
                -572
                -
                -
                # File 'mrbgems/mruby-struct/src/struct.c', line 545
                -
                -static mrb_value
                -mrb_struct_equal(mrb_state *mrb, mrb_value s)
                -{
                -  mrb_value s2;
                -  mrb_value *ptr, *ptr2;
                -  mrb_int i, len;
                -
                -  mrb_get_args(mrb, "o", &s2);
                -  if (mrb_obj_equal(mrb, s, s2)) {
                -    return mrb_true_value();
                -  }
                -  if (mrb_obj_class(mrb, s) != mrb_obj_class(mrb, s2)) {
                -    return mrb_false_value();
                -  }
                -  if (RSTRUCT_LEN(s) != RSTRUCT_LEN(s2)) {
                -    mrb_bug(mrb, "inconsistent struct"); /* should never happen */
                -  }
                -  ptr = RSTRUCT_PTR(s);
                -  ptr2 = RSTRUCT_PTR(s2);
                -  len = RSTRUCT_LEN(s);
                -  for (i=0; i<len; i++) {
                -    if (!mrb_equal(mrb, ptr[i], ptr2[i])) {
                -      return mrb_false_value();
                -    }
                -  }
                -
                -  return mrb_true_value();
                -}
                -
                -
                - -
                -

                - - - #[](symbol) ⇒ Object - - #[](fixnum) ⇒ Object - - - - - - -

                -
                -

                Attribute Reference—Returns the value of the instance variable -named by symbol, or indexed (0..length-1) by -fixnum. Will raise NameError if the named -variable does not exist, or IndexError if the index is -out of range.

                - -

                Customer = Struct.new(:name, :address, :zip) - joe = Customer.new(“Joe Smith”, “123 Maple, Anytown NC”, 12345)

                - -

                joe[“name”] #=> “Joe Smith” - joe[:name] #=> “Joe Smith” - joe[0] #=> “Joe Smith”

                - - -
                -
                -
                - -

                Overloads:

                -
                  - - -
                • - #[](symbol) ⇒ Object -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (Object) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #[](fixnum) ⇒ Object -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (Object) - - - -
                  • - -
                  - -
                  - - -
                • - -
                - - -
                - - - - - - -
                -
                -
                -
                -428
                -429
                -430
                -431
                -432
                -433
                -434
                -435
                -436
                -437
                -438
                -439
                -440
                -441
                -442
                -443
                -444
                -445
                -446
                -
                -
                # File 'mrbgems/mruby-struct/src/struct.c', line 428
                -
                -static mrb_value
                -mrb_struct_aref(mrb_state *mrb, mrb_value s)
                -{
                -  mrb_value idx;
                -
                -  mrb_get_args(mrb, "o", &idx);
                -  if (mrb_string_p(idx)) {
                -    mrb_value sym = mrb_check_intern_str(mrb, idx);
                -
                -    if (mrb_nil_p(sym)) {
                -      mrb_name_error(mrb, mrb_intern_str(mrb, idx), "no member '%v' in struct", idx);
                -    }
                -    idx = sym;
                -  }
                -  if (mrb_symbol_p(idx)) {
                -    return struct_aref_sym(mrb, s, mrb_symbol(idx));
                -  }
                -  return struct_aref_int(mrb, s, mrb_int(mrb, idx));
                -}
                -
                -
                - -
                -

                - - - #[]=(symbol) ⇒ Object - - #[]=(fixnum) ⇒ Object - - - - - - -

                -
                -

                Attribute Assignment—Assigns to the instance variable named by -symbol or fixnum the value obj and -returns it. Will raise a NameError if the named -variable does not exist, or an IndexError if the index -is out of range.

                - -

                Customer = Struct.new(:name, :address, :zip) - joe = Customer.new(“Joe Smith”, “123 Maple, Anytown NC”, 12345)

                - -

                joe[“name”] = “Luke” - joe[:zip] = “90210”

                - -

                joe.name #=> “Luke” - joe.zip #=> “90210”

                - - -
                -
                -
                - -

                Overloads:

                -
                  - - -
                • - #[]=(symbol) ⇒ Object -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (Object) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #[]=(fixnum) ⇒ Object -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (Object) - - - -
                  • - -
                  - -
                  - - -
                • - -
                - - -
                - - - - - - -
                -
                -
                -
                -492
                -493
                -494
                -495
                -496
                -497
                -498
                -499
                -500
                -501
                -502
                -503
                -504
                -505
                -506
                -507
                -508
                -509
                -510
                -511
                -512
                -513
                -514
                -515
                -516
                -517
                -518
                -519
                -520
                -521
                -522
                -523
                -524
                -525
                -
                -
                # File 'mrbgems/mruby-struct/src/struct.c', line 492
                -
                -static mrb_value
                -mrb_struct_aset(mrb_state *mrb, mrb_value s)
                -{
                -  mrb_int i;
                -  mrb_value idx;
                -  mrb_value val;
                -
                -  mrb_get_args(mrb, "oo", &idx, &val);
                -
                -  if (mrb_string_p(idx)) {
                -    mrb_value sym = mrb_check_intern_str(mrb, idx);
                -
                -    if (mrb_nil_p(sym)) {
                -      mrb_name_error(mrb, mrb_intern_str(mrb, idx), "no member '%v' in struct", idx);
                -    }
                -    idx = sym;
                -  }
                -  if (mrb_symbol_p(idx)) {
                -    return mrb_struct_aset_sym(mrb, s, mrb_symbol(idx), val);
                -  }
                -
                -  i = mrb_int(mrb, idx);
                -  if (i < 0) i = RSTRUCT_LEN(s) + i;
                -  if (i < 0) {
                -    mrb_raisef(mrb, E_INDEX_ERROR,
                -               "offset %i too small for struct(size:%i)", i, RSTRUCT_LEN(s));
                -  }
                -  if (RSTRUCT_LEN(s) <= i) {
                -    mrb_raisef(mrb, E_INDEX_ERROR,
                -               "offset %i too large for struct(size:%i)", i, RSTRUCT_LEN(s));
                -  }
                -  mrb_struct_modify(mrb, s);
                -  return RSTRUCT_PTR(s)[i] = val;
                -}
                -
                -
                - -
                -

                - - #_inspect(recur_list) ⇒ Object - - - - - -

                - - - - -
                -
                -
                -
                -49
                -50
                -51
                -52
                -53
                -54
                -55
                -56
                -57
                -58
                -59
                -60
                -61
                -62
                -63
                -
                -
                # File 'mrbgems/mruby-struct/mrblib/struct.rb', line 49
                -
                -def _inspect(recur_list)
                -  return "#<struct #{self.class}:...>" if recur_list[self.object_id]
                -  recur_list[self.object_id] = true
                -  name = self.class.to_s
                -  if name[0] == "#"
                -    str = "#<struct "
                -  else
                -    str = "#<struct #{name} "
                -  end
                -  buf = []
                -  self.each_pair do |k,v|
                -    buf.push [k.to_s + "=" + v._inspect(recur_list)]
                -  end
                -  str + buf.join(", ") + ">"
                -end
                -
                -
                - -
                -

                - - #dig(idx, *args) ⇒ Object - - - - - -

                -
                -

                call-seq: - hsh.dig(key,…) -> object

                - -

                Extracts the nested value specified by the sequence of key -objects by calling +dig+ at each step, returning +nil+ if any -intermediate step is +nil+.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -91
                -92
                -93
                -94
                -95
                -96
                -97
                -98
                -
                -
                # File 'mrbgems/mruby-struct/mrblib/struct.rb', line 91
                -
                -def dig(idx,*args)
                -  n = self[idx]
                -  if args.size > 0
                -    n&.dig(*args)
                -  else
                -    n
                -  end
                -end
                -
                -
                - -
                -

                - - #each(&block) ⇒ Object - - - - - -

                -
                -

                Calls the given block for each element of +self+ -and pass the respective element.

                - -

                ISO 15.2.18.4.4

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -14
                -15
                -16
                -17
                -18
                -19
                -
                -
                # File 'mrbgems/mruby-struct/mrblib/struct.rb', line 14
                -
                -def each(&block)
                -  self.class.members.each{|field|
                -    block.call(self[field])
                -  }
                -  self
                -end
                -
                -
                - -
                -

                - - #each_pair(&block) ⇒ Object - - - - - -

                -
                -

                Calls the given block for each element of +self+ -and pass the name and value of the respectiev -element.

                - -

                ISO 15.2.18.4.5

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -27
                -28
                -29
                -30
                -31
                -32
                -
                -
                # File 'mrbgems/mruby-struct/mrblib/struct.rb', line 27
                -
                -def each_pair(&block)
                -  self.class.members.each{|field|
                -    block.call(field.to_sym, self[field])
                -  }
                -  self
                -end
                -
                -
                - -
                -

                - - #eql?Boolean - - - - - -

                -
                -

                code-seq: - struct.eql?(other) -> true or false

                - -

                Two structures are equal if they are the same object, or if all their -fields are equal (using eql?).

                - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (Boolean) - - - -
                • - -
                - -
                - - - - - - -
                -
                -
                -
                -582
                -583
                -584
                -585
                -586
                -587
                -588
                -589
                -590
                -591
                -592
                -593
                -594
                -595
                -596
                -597
                -598
                -599
                -600
                -601
                -602
                -603
                -604
                -605
                -606
                -607
                -608
                -609
                -
                -
                # File 'mrbgems/mruby-struct/src/struct.c', line 582
                -
                -static mrb_value
                -mrb_struct_eql(mrb_state *mrb, mrb_value s)
                -{
                -  mrb_value s2;
                -  mrb_value *ptr, *ptr2;
                -  mrb_int i, len;
                -
                -  mrb_get_args(mrb, "o", &s2);
                -  if (mrb_obj_equal(mrb, s, s2)) {
                -    return mrb_true_value();
                -  }
                -  if (mrb_obj_class(mrb, s) != mrb_obj_class(mrb, s2)) {
                -    return mrb_false_value();
                -  }
                -  if (RSTRUCT_LEN(s) != RSTRUCT_LEN(s2)) {
                -    mrb_bug(mrb, "inconsistent struct"); /* should never happen */
                -  }
                -  ptr = RSTRUCT_PTR(s);
                -  ptr2 = RSTRUCT_PTR(s2);
                -  len = RSTRUCT_LEN(s);
                -  for (i=0; i<len; i++) {
                -    if (!mrb_eql(mrb, ptr[i], ptr2[i])) {
                -      return mrb_false_value();
                -    }
                -  }
                -
                -  return mrb_true_value();
                -}
                -
                -
                - -
                -

                - - #initialize_copyObject - - - - - -

                -
                -

                :nodoc:

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -356
                -357
                -358
                -359
                -360
                -361
                -362
                -363
                -364
                -365
                -366
                -367
                -368
                -369
                -370
                -371
                -372
                -
                -
                # File 'mrbgems/mruby-struct/src/struct.c', line 356
                -
                -static mrb_value
                -mrb_struct_init_copy(mrb_state *mrb, mrb_value copy)
                -{
                -  mrb_value s;
                -
                -  mrb_get_args(mrb, "o", &s);
                -
                -  if (mrb_obj_equal(mrb, copy, s)) return copy;
                -  if (!mrb_obj_is_instance_of(mrb, s, mrb_obj_class(mrb, copy))) {
                -    mrb_raise(mrb, E_TYPE_ERROR, "wrong argument class");
                -  }
                -  if (!mrb_array_p(s)) {
                -    mrb_raise(mrb, E_TYPE_ERROR, "corrupted struct");
                -  }
                -  mrb_ary_replace(mrb, copy, s);
                -  return copy;
                -}
                -
                -
                - -
                -

                - - #inspectObject - - - - Also known as: - to_s - - - - -

                -
                -

                call-seq: - struct.to_s -> string - struct.inspect -> string

                - -

                Describe the contents of this struct in a string.

                - -

                15.2.18.4.10(x)

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -74
                -75
                -76
                -
                -
                # File 'mrbgems/mruby-struct/mrblib/struct.rb', line 74
                -
                -def inspect
                -  self._inspect({})
                -end
                -
                -
                - -
                -

                - - - #lengthFixnum - - #sizeFixnum - - - - - - -

                -
                -

                Returns number of struct members.

                - - -
                -
                -
                - -

                Overloads:

                -
                  - - -
                • - #lengthFixnum -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (Fixnum) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #sizeFixnum -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (Fixnum) - - - -
                  • - -
                  - -
                  - - -
                • - -
                - - -
                - - - - - - -
                -
                -
                -
                -618
                -619
                -620
                -621
                -622
                -
                -
                # File 'mrbgems/mruby-struct/src/struct.c', line 618
                -
                -static mrb_value
                -mrb_struct_len(mrb_state *mrb, mrb_value self)
                -{
                -  return mrb_fixnum_value(RSTRUCT_LEN(self));
                -}
                -
                -
                - -
                -

                - - #membersArray - - - - - -

                -
                -

                Returns an array of strings representing the names of the instance -variables.

                - -

                Customer = Struct.new(:name, :address, :zip) - joe = Customer.new(“Joe Smith”, “123 Maple, Anytown NC”, 12345) - joe.members #=> [:name, :address, :zip]

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (Array) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -107
                -108
                -109
                -110
                -111
                -
                -
                # File 'mrbgems/mruby-struct/src/struct.c', line 107
                -
                -static mrb_value
                -mrb_struct_members(mrb_state *mrb, mrb_value obj)
                -{
                -  return mrb_struct_s_members_m(mrb, mrb_obj_value(mrb_obj_class(mrb, obj)));
                -}
                -
                -
                - -
                -

                - - #select(&block) ⇒ Object - - - - - -

                -
                -

                Calls the given block for each element of +self+ -and returns an array with all elements of which -block is not false.

                - -

                ISO 15.2.18.4.7

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -40
                -41
                -42
                -43
                -44
                -45
                -46
                -47
                -
                -
                # File 'mrbgems/mruby-struct/mrblib/struct.rb', line 40
                -
                -def select(&block)
                -  ary = []
                -  self.class.members.each{|field|
                -    val = self[field]
                -    ary.push(val) if block.call(val)
                -  }
                -  ary
                -end
                -
                -
                - -
                -

                - - - #lengthFixnum - - #sizeFixnum - - - - - - -

                -
                -

                Returns number of struct members.

                - - -
                -
                -
                - -

                Overloads:

                -
                  - - -
                • - #lengthFixnum -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (Fixnum) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #sizeFixnum -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (Fixnum) - - - -
                  • - -
                  - -
                  - - -
                • - -
                - - -
                -
                 
                 
                -618
                -619
                -620
                -621
                -622
                +26 +27 +28 +29 +30 +31
                -
                # File 'mrbgems/mruby-struct/src/struct.c', line 618
                +      
                # File 'mrbgems/mruby-struct/mrblib/struct.rb', line 26
                 
                -static mrb_value
                -mrb_struct_len(mrb_state *mrb, mrb_value self)
                -{
                -  return mrb_fixnum_value(RSTRUCT_LEN(self));
                -}
                +def each_pair(&block) + self.class.members.each{|field| + block.call(field.to_sym, self[field]) + } + self +end
                -

                +

                - - #to_aArray - - #valuesArray - + #select(&block) ⇒ Object @@ -1929,372 +428,60 @@

                -

                Create an array from struct values.

                - - -
                -
                -
                - -

                Overloads:

                -
                  - - -
                • - #to_aArray -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (Array) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #valuesArray -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (Array) - - - -
                  • - -
                  - -
                  - - -
                • - -
                - - -
                - - - - - - -
                -
                -
                -
                -631
                -632
                -633
                -634
                -635
                -
                -
                # File 'mrbgems/mruby-struct/src/struct.c', line 631
                -
                -static mrb_value
                -mrb_struct_to_a(mrb_state *mrb, mrb_value self)
                -{
                -  return mrb_ary_new_from_values(mrb, RSTRUCT_LEN(self), RSTRUCT_PTR(self));
                -}
                -
                -
                -
                -

                - - #to_hHash - +

                Calls the given block for each element of self and returns an array with all elements of which block is not false.

                - - - -

                -
                -

                Create a hash from member names and struct values.

                +

                ISO 15.2.18.4.7

                -
                -
                - - -
                -
                - -

                Returns:

                -
                  - -
                • - - - (Hash) - - - -
                • - -
                - -
                - - - -
                -
                 
                 
                -643
                -644
                -645
                -646
                -647
                -648
                -649
                -650
                -651
                -652
                -653
                -654
                -655
                -656
                -657
                +39 +40 +41 +42 +43 +44 +45 +46
                -
                # File 'mrbgems/mruby-struct/src/struct.c', line 643
                +      
                # File 'mrbgems/mruby-struct/mrblib/struct.rb', line 39
                 
                -static mrb_value
                -mrb_struct_to_h(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_value members, ret;
                -  mrb_int i;
                -
                -  members = struct_members(mrb, self);
                -  ret = mrb_hash_new_capa(mrb, RARRAY_LEN(members));
                -
                -  for (i = 0; i < RARRAY_LEN(members); ++i) {
                -    mrb_hash_set(mrb, ret, RARRAY_PTR(members)[i], RSTRUCT_PTR(self)[i]);
                +def select(&block)
                +  ary = []
                +  self.class.members.each{|field|
                +    val = self[field]
                +    ary.push(val) if block.call(val)
                   }
                -
                -  return ret;
                -}
                + ary +end
                -
                -

                - - - #to_aArray - - #valuesArray - - - - - - -

                -
                -

                Create an array from struct values.

                - - -
                -
                -
                - -

                Overloads:

                -
                  - - -
                • - #to_aArray -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (Array) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #valuesArray -
                  -
                  - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (Array) - - - -
                  • - -
                  - -
                  - - -
                • - -
                - - -
                - - - - - - -
                -
                 
                -
                -631
                -632
                -633
                -634
                -635
                -
                -
                # File 'mrbgems/mruby-struct/src/struct.c', line 631
                -
                -static mrb_value
                -mrb_struct_to_a(mrb_state *mrb, mrb_value self)
                -{
                -  return mrb_ary_new_from_values(mrb, RSTRUCT_LEN(self), RSTRUCT_PTR(self));
                -}
                -
                -
                - -
                -

                - - #values_atObject - - - - - -

                - - - - -
                -
                -
                -
                -659
                -660
                -661
                -662
                -663
                -664
                -665
                -666
                -667
                -668
                -
                -
                # File 'mrbgems/mruby-struct/src/struct.c', line 659
                -
                -static mrb_value
                -mrb_struct_values_at(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_int argc;
                -  mrb_value *argv;
                -
                -  mrb_get_args(mrb, "*", &argv, &argc);
                -
                -  return mrb_get_values_at(mrb, self, RSTRUCT_LEN(self), argc, argv, struct_aref_int);
                -}
                -
                - -
                + - - \ No newline at end of file diff --git a/docs/api/Symbol.html b/docs/api/Symbol.html index 106641d..f869f18 100644 --- a/docs/api/Symbol.html +++ b/docs/api/Symbol.html @@ -6,17 +6,17 @@ Class: Symbol - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -103,25 +103,13 @@
                Defined in:
                -
                src/symbol.c,
                - mrblib/symbol.rb,
                mrbgems/mruby-symbol-ext/mrblib/symbol.rb
                +
                mrblib/symbol.rb,
                + mrbgems/mruby-symbol-ext/mrblib/symbol.rb
                -

                Overview

                -
                -

                15.2.11

                - - -
                -
                -
                - - -
                - @@ -140,29 +128,6 @@

              • - #<=> ⇒ Object - - - - - - - - - - - - - -

                15.2.11.3.5(x).

                -
                - -
              • - - -
              • - - #capitalize ⇒ Object @@ -177,7 +142,8 @@

                -

                call-seq: sym.capitalize -> symbol.

                +
                +

                call-seq: sym.capitalize -> symbol.

              • @@ -200,7 +166,8 @@

                -

                call-seq: sym.casecmp(other) -> -1, 0, +1 or nil.

                +
                +

                call-seq: sym.casecmp(other) -> -1, 0, +1 or nil.

                @@ -223,7 +190,8 @@

                -

                call-seq: sym.casecmp?(other) -> true, false, or nil.

                +
                +

                call-seq: sym.casecmp?(other) -> true, false, or nil.

                @@ -246,7 +214,8 @@

                -

                call-seq: sym.downcase -> symbol.

                +
                +

                call-seq: sym.downcase -> symbol.

                @@ -269,76 +238,8 @@

                -

                call-seq: sym.empty? -> true or false.

                -
                - - - - -
              • - - - #id2name ⇒ Object - - - - - - - - - - - - - -

                Returns the name or string corresponding to sym.

                -
                - -
              • - - -
              • - - - #inspect ⇒ Object - - - - - - - - - - - - - -

                15.2.11.3.5(x).

                -
                - -
              • - - -
              • - - - #to_proc ⇒ Object - - - - - - - - - - - - -
                +

                call-seq: sym.empty? -> true or false.

              • @@ -347,35 +248,10 @@

              • - #to_s ⇒ Object - - - - - - - - - - - - - -

                Returns the name or string corresponding to sym.

                -
                - -
              • - - -
              • - - - #to_sym ⇒ Object + #to_proc ⇒ Object - (also: #intern) - @@ -386,8 +262,7 @@

                -

                In general, to_sym returns the Symbol corresponding to an object.

                -
                +

              • @@ -409,7 +284,8 @@

                -

                call-seq: sym.upcase -> symbol.

                +
                +

                call-seq: sym.upcase -> symbol.

                @@ -436,103 +312,7 @@

                Instance Method Details

                -

                - - #<=>Object - - - - - -

                -
                -

                15.2.11.3.5(x)

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -566
                -567
                -568
                -569
                -570
                -571
                -572
                -573
                -574
                -575
                -576
                -577
                -578
                -579
                -580
                -581
                -582
                -583
                -584
                -585
                -586
                -587
                -588
                -589
                -590
                -591
                -592
                -593
                -594
                -595
                -
                -
                # File 'src/symbol.c', line 566
                -
                -static mrb_value
                -sym_cmp(mrb_state *mrb, mrb_value s1)
                -{
                -  mrb_value s2;
                -  mrb_sym sym1, sym2;
                -
                -  mrb_get_args(mrb, "o", &s2);
                -  if (!mrb_symbol_p(s2)) return mrb_nil_value();
                -  sym1 = mrb_symbol(s1);
                -  sym2 = mrb_symbol(s2);
                -  if (sym1 == sym2) return mrb_fixnum_value(0);
                -  else {
                -    const char *p1, *p2;
                -    int retval;
                -    mrb_int len, len1, len2;
                -    char buf1[8], buf2[8];
                -
                -    p1 = sym2name_len(mrb, sym1, buf1, &len1);
                -    p2 = sym2name_len(mrb, sym2, buf2, &len2);
                -    len = lesser(len1, len2);
                -    retval = memcmp(p1, p2, len);
                -    if (retval == 0) {
                -      if (len1 == len2) return mrb_fixnum_value(0);
                -      if (len1 > len2)  return mrb_fixnum_value(1);
                -      return mrb_fixnum_value(-1);
                -    }
                -    if (retval > 0) return mrb_fixnum_value(1);
                -    return mrb_fixnum_value(-1);
                -  }
                -}
                -
                -
                - -
                -

                +

                #capitalizeObject @@ -542,8 +322,8 @@

                -

                call-seq: - sym.capitalize -> symbol

                + +

                call-seq: sym.capitalize -> symbol

                Same as sym.to_s.capitalize.intern.

                @@ -553,8 +333,8 @@

                -
                - +

                + @@ -587,8 +367,8 @@

                -

                call-seq: - sym.casecmp(other) -> -1, 0, +1 or nil

                + +

                call-seq: sym.casecmp(other) -> -1, 0, +1 or nil

                Case-insensitive version of Symbol#<=>.

                @@ -598,8 +378,8 @@

                -
                - +

                +
                @@ -569,7 +349,7 @@

                # File 'mrbgems/mruby-symbol-ext/mrblib/symbol.rb', line 12
                 
                 def capitalize
                -  self.to_s.capitalize.to_sym
                +  (self.to_s.capitalize! || self).to_sym
                 end

                @@ -618,7 +398,7 @@

                def casecmp(other) return nil unless other.kind_of?(Symbol) - lhs = self.to_s.upcase + lhs = self.to_s; lhs.upcase! rhs = other.to_s.upcase lhs <=> rhs end @@ -638,11 +418,10 @@

                -

                call-seq: - sym.casecmp?(other) -> true, false, or nil

                + +

                call-seq: sym.casecmp?(other) -> true, false, or nil

                -

                Returns true if sym and other_sym are equal after case folding, -false if they are not equal, and nil if other_sym is not a string.

                +

                Returns true if sym and other_sym are equal after case folding, false if they are not equal, and nil if other_sym is not a string.

                @@ -663,8 +442,8 @@

                -

                - + +
                @@ -701,8 +480,8 @@

                -

                call-seq: - sym.downcase -> symbol

                + +

                call-seq: sym.downcase -> symbol

                Same as sym.to_s.downcase.intern.

                @@ -712,8 +491,8 @@

                -
                - +

                + @@ -746,10 +525,10 @@

                -

                call-seq: - sym.empty? -> true or false

                + +

                call-seq: sym.empty? -> true or false

                -

                Returns that sym is :”” or not.

                +

                Returns that sym is :“” or not.

                @@ -770,8 +549,8 @@

                -

                - + +
                @@ -728,7 +507,7 @@

                # File 'mrbgems/mruby-symbol-ext/mrblib/symbol.rb', line 22
                 
                 def downcase
                -  self.to_s.downcase.to_sym
                +  (self.to_s.downcase! || self).to_sym
                 end

                @@ -791,213 +570,6 @@

                -
                - -
                -

                - - - #id2nameString - - #to_sString - - - - - - -

                -
                -

                Returns the name or string corresponding to sym.

                - -

                :fred.id2name #=> “fred”

                - - -
                -
                -
                - -

                Overloads:

                -
                  - - -
                • - #id2nameString -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #to_sString -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String) - - - -
                  • - -
                  - -
                  - - -
                • - -
                - - -
                - - - - - - -
                -
                -
                -
                -339
                -340
                -341
                -342
                -343
                -
                -
                # File 'src/symbol.c', line 339
                -
                -static mrb_value
                -sym_to_s(mrb_state *mrb, mrb_value sym)
                -{
                -  return mrb_sym_str(mrb, mrb_symbol(sym));
                -}
                -
                -
                - -
                -

                - - #inspectObject - - - - - -

                -
                -

                15.2.11.3.5(x)

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -488
                -489
                -490
                -491
                -492
                -493
                -494
                -495
                -496
                -497
                -498
                -499
                -500
                -501
                -502
                -503
                -504
                -505
                -506
                -507
                -508
                -509
                -510
                -511
                -512
                -513
                -
                -
                # File 'src/symbol.c', line 488
                -
                -static mrb_value
                -sym_inspect(mrb_state *mrb, mrb_value sym)
                -{
                -  mrb_value str;
                -  const char *name;
                -  mrb_int len;
                -  mrb_sym id = mrb_symbol(sym);
                -  char *sp;
                -
                -  name = mrb_sym_name_len(mrb, id, &len);
                -  str = mrb_str_new(mrb, 0, len+1);
                -  sp = RSTRING_PTR(str);
                -  sp[0] = ':';
                -  memcpy(sp+1, name, len);
                -  mrb_assert_int_fit(mrb_int, len, size_t, SIZE_MAX);
                -  if (!symname_p(name) || strlen(name) != (size_t)len) {
                -    str = mrb_str_inspect(mrb, str);
                -    sp = RSTRING_PTR(str);
                -    sp[0] = ':';
                -    sp[1] = '"';
                -  }
                -#ifdef MRB_UTF8_STRING
                -  if (SYMBOL_INLINE_P(id)) RSTR_SET_ASCII_FLAG(mrb_str_ptr(str));
                -#endif
                -  return str;
                -}
                -
                @@ -1019,194 +591,21 @@

                3 4 5 -6 +6 +7

                # File 'mrblib/symbol.rb', line 2
                 
                 def to_proc
                -  ->(obj,*args,&block) do
                -    obj.__send__(self, *args, &block)
                +  mid = self
                +  ->(obj,*args,**opts,&block) do
                +    obj.__send__(mid, *args, **opts, &block)
                   end
                 end
                - - -
                -

                - - - #id2nameString - - #to_sString - - - - - - -

                -
                -

                Returns the name or string corresponding to sym.

                - -

                :fred.id2name #=> “fred”

                - - -
                -
                -
                - -

                Overloads:

                -
                  - - -
                • - #id2nameString -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String) - - - -
                  • - -
                  - -
                  - - -
                • - - -
                • - #to_sString -
                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (String) - - - -
                  • - -
                  - -
                  - - -
                • - -
                - - -
                - - - - - - -
                -
                -
                -
                -339
                -340
                -341
                -342
                -343
                -
                -
                # File 'src/symbol.c', line 339
                -
                -static mrb_value
                -sym_to_s(mrb_state *mrb, mrb_value sym)
                -{
                -  return mrb_sym_str(mrb, mrb_symbol(sym));
                -}
                -
                -
                - -
                -

                - - - #to_symObject - - #internObject - - - - - Also known as: - intern - - - - -

                -
                -

                In general, to_sym returns the Symbol corresponding -to an object. As sym is already a symbol, self is returned -in this case.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -356
                -357
                -358
                -359
                -360
                -
                -
                # File 'src/symbol.c', line 356
                -
                -static mrb_value
                -sym_to_sym(mrb_state *mrb, mrb_value sym)
                -{
                -  return sym;
                -}
                -
                @@ -1220,8 +619,8 @@

                -

                call-seq: - sym.upcase -> symbol

                + +

                call-seq: sym.upcase -> symbol

                Same as sym.to_s.upcase.intern.

                @@ -1231,8 +630,8 @@

                -
                - +

                + @@ -1258,11 +657,11 @@

                - + diff --git a/docs/api/SystemStackError.html b/docs/api/SystemStackError.html deleted file mode 100644 index 3ec8b42..0000000 --- a/docs/api/SystemStackError.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - Exception: SystemStackError - - — Documentation by YARD 0.9.20 - - - - - - - - - - - - - - - - - - - - - - - -
                - - -

                Exception: SystemStackError - - - -

                -
                - -
                -
                Inherits:
                -
                - Exception - -
                  -
                • Object
                • - - - - - -
                - show all - -
                -
                - - - - - - - - - - - -
                -
                Defined in:
                -
                src/error.c
                -
                - -
                - -

                Overview

                -
                -

                15.2.38

                - - -
                -
                -
                - - -
                - - - - - - - - - - - - - - - -

                Method Summary

                - -

                Methods inherited from Exception

                -

                #backtrace, #exception, #initialize, #inspect, #message, #set_backtrace, #to_s

                -
                -

                Constructor Details

                - -

                This class inherits a constructor from Exception

                - -
                - - -
                - - - -
                - - \ No newline at end of file diff --git a/docs/api/TCPServer.html b/docs/api/TCPServer.html index 61e6d25..c7707b0 100644 --- a/docs/api/TCPServer.html +++ b/docs/api/TCPServer.html @@ -6,17 +6,17 @@ Class: TCPServer - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -114,12 +114,6 @@ -

                Constant Summary

                - -

                Constants inherited - from IO

                -

                IO::BUF_SIZE, IO::SEEK_CUR, IO::SEEK_END, IO::SEEK_SET

                - @@ -154,8 +148,7 @@

                -
                -
                +
                @@ -177,8 +170,7 @@

                -
                -
                +
                @@ -202,7 +194,8 @@

                -

                A new instance of TCPServer.

                +
                +

                A new instance of TCPServer.

                @@ -225,8 +218,7 @@

                -
                -
                +
                @@ -248,8 +240,7 @@

                -
                -
                +
                @@ -267,7 +258,7 @@

                Methods inherited from TCPSocket

                -

                new_with_prelude

                +

                _new_with_prelude

                @@ -289,7 +280,7 @@

                Methods inherited from Methods inherited from BasicSocket

                -

                #_is_socket=, #_recvfrom, #_setnonblock, #close, do_not_reverse_lookup, do_not_reverse_lookup=, for_fd, #getpeereid, #getpeername, #getsockname, #getsockopt, #local_address, #recv, #recv_nonblock, #remote_address, #send, #setsockopt, #shutdown, #sysread, #sysseek, #syswrite

                +

                do_not_reverse_lookup, do_not_reverse_lookup=, for_fd, #local_address, #recv_nonblock, #remote_address

                @@ -300,7 +291,7 @@

                Methods inherited from Methods inherited from IO

                -

                #<<, #_check_readable, #_read_buf, #close, #close_on_exec=, #close_on_exec?, #close_write, #closed?, #each, #each_byte, #eof?, #fileno, #flush, #getc, #gets, #hash, #initialize_copy, #isatty, open, #pid, pipe, popen, #pos, #pos=, #print, #printf, #puts, read, #read, #readchar, #readline, #readlines, #rewind, #seek, #sync, #sync=, #sysread, #sysseek, #syswrite, #ungetc, #write

                +

                #<<, #each, #each_byte, #each_char, #hash, open, pipe, popen, #pos=, #print, #printf, #puts, read, #rewind, #ungetbyte

                Constructor Details

                @@ -315,7 +306,8 @@

                -

                Returns a new instance of TCPServer

                + +

                Returns a new instance of TCPServer.

                @@ -323,14 +315,17 @@

                -
                - +

                +

                @@ -1247,7 +646,7 @@

                # File 'mrbgems/mruby-symbol-ext/mrblib/symbol.rb', line 32
                 
                 def upcase
                -  self.to_s.upcase.to_sym
                +  (self.to_s.upcase! || self).to_sym
                 end

                 
                 
                +265
                +266
                +267
                 268
                 269
                 270
                @@ -338,13 +333,10 @@ 

                272 273 274 -275 -276 -277 -278

                +275
                -
                # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 268
                +      
                # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 265
                 
                 def initialize(host=nil, service)
                   ai = Addrinfo.getaddrinfo(host, service, nil, nil, nil, Socket::AI_PASSIVE)[0]
                @@ -384,6 +376,9 @@ 

                 
                 
                +277
                +278
                +279
                 280
                 281
                 282
                @@ -391,16 +386,17 @@ 

                284 285 286 -287 -288

                +287

                -
                # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 280
                +      
                # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 277
                 
                 def accept
                   fd = self.sysaccept
                   begin
                -    TCPSocket.new_with_prelude(proc { @init_with_fd = true }, fd, "r+")
                +    TCPSocket._new_with_prelude(fd, "r+") {
                +      @init_with_fd = true
                +    }
                   rescue
                     IO._sysclose(fd) rescue nil
                     raise
                @@ -426,17 +422,17 @@ 

                 
                 
                +289
                 290
                 291
                 292
                 293
                 294
                 295
                -296
                -297
                +296

                -
                # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 290
                +      
                # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 289
                 
                 def accept_nonblock
                   begin
                @@ -466,13 +462,13 @@ 

                 
                 
                +298
                 299
                 300
                -301
                -302
                +301

                -
                # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 299
                +      
                # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 298
                 
                 def listen(backlog)
                   Socket._listen(self.fileno, backlog)
                @@ -498,12 +494,12 @@ 

                 
                 
                +303
                 304
                -305
                -306
                +305

                -
                # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 304
                +      
                # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 303
                 
                 def sysaccept
                   Socket._accept(self.fileno)
                @@ -517,11 +513,11 @@ 

                - + diff --git a/docs/api/TCPSocket.html b/docs/api/TCPSocket.html index 885c93e..8ed8795 100644 --- a/docs/api/TCPSocket.html +++ b/docs/api/TCPSocket.html @@ -6,17 +6,17 @@ Class: TCPSocket - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -104,9 +104,7 @@
                Defined in:
                -
                mrbgems/mruby-socket/src/socket.c,
                - mrbgems/mruby-socket/mrblib/socket.rb
                -
                +
                mrbgems/mruby-socket/mrblib/socket.rb
                @@ -118,12 +116,6 @@

                Direct Known Subclasses

                -

                Constant Summary

                - -

                Constants inherited - from IO

                -

                IO::BUF_SIZE, IO::SEEK_CUR, IO::SEEK_END, IO::SEEK_SET

                - @@ -144,7 +136,7 @@

              • - .new_with_prelude(pre, *args) ⇒ Object + ._new_with_prelude(*args, &pre) ⇒ Object @@ -158,8 +150,7 @@

                -
                -
                +

              • @@ -192,7 +183,8 @@

                -

                A new instance of TCPSocket.

                +
                +

                A new instance of TCPSocket.

                @@ -222,7 +214,7 @@

                Methods inherited from Methods inherited from BasicSocket

                -

                #_is_socket=, #_recvfrom, #_setnonblock, #close, do_not_reverse_lookup, do_not_reverse_lookup=, for_fd, #getpeereid, #getpeername, #getsockname, #getsockopt, #local_address, #recv, #recv_nonblock, #remote_address, #send, #setsockopt, #shutdown, #sysread, #sysseek, #syswrite

                +

                do_not_reverse_lookup, do_not_reverse_lookup=, for_fd, #local_address, #recv_nonblock, #remote_address

                @@ -233,7 +225,7 @@

                Methods inherited from Methods inherited from IO

                -

                #<<, #_check_readable, #_read_buf, #close, #close_on_exec=, #close_on_exec?, #close_write, #closed?, #each, #each_byte, #eof?, #fileno, #flush, #getc, #gets, #hash, #initialize_copy, #isatty, open, #pid, pipe, popen, #pos, #pos=, #print, #printf, #puts, read, #read, #readchar, #readline, #readlines, #rewind, #seek, #sync, #sync=, #sysread, #sysseek, #syswrite, #ungetc, #write

                +

                #<<, #each, #each_byte, #each_char, #hash, open, pipe, popen, #pos=, #print, #printf, #puts, read, #rewind, #ungetbyte

                Constructor Details

                @@ -248,7 +240,8 @@

                -

                Returns a new instance of TCPSocket

                + +

                Returns a new instance of TCPSocket.

                @@ -256,14 +249,17 @@

                -
                - +

                +
                 
                 
                +228
                +229
                +230
                 231
                 232
                 233
                @@ -285,13 +281,10 @@ 

                249 250 251 -252 -253 -254 -255

                +252
                -
                # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 231
                +      
                # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 228
                 
                 def initialize(host, service, local_host=nil, local_service=nil)
                   if @init_with_fd
                @@ -331,9 +324,9 @@ 

                Class Method Details

                -

                +

                - .new_with_prelude(pre, *args) ⇒ Object + ._new_with_prelude(*args, &pre) ⇒ Object @@ -345,17 +338,17 @@

                 
                 
                +254
                +255
                +256
                 257
                 258
                -259
                -260
                -261
                -262
                +259

                -
                # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 257
                +      
                # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 254
                 
                -def self.new_with_prelude pre, *args
                +def self._new_with_prelude(*args, &pre)
                   o = self._allocate
                   o.instance_eval(&pre)
                   o.initialize(*args)
                @@ -370,11 +363,11 @@ 

                - + diff --git a/docs/api/Time.html b/docs/api/Time.html deleted file mode 100644 index 39b3caa..0000000 --- a/docs/api/Time.html +++ /dev/null @@ -1,3480 +0,0 @@ - - - - - - - Class: Time - - — Documentation by YARD 0.9.20 - - - - - - - - - - - - - - - - - - - - - - - -
                - - -

                Class: Time - - - -

                -
                - -
                -
                Inherits:
                -
                - Object - -
                  -
                • Object
                • - - - -
                - show all - -
                -
                - - - - - - - - - - - -
                -
                Defined in:
                -
                mrbgems/mruby-time/src/time.c,
                - mrbgems/mruby-time/mrblib/time.rb
                -
                -
                - -
                - -

                Overview

                -
                -

                ISO 15.2.19.2

                - - -
                -
                -
                - - -
                - - - - - - - - - -

                - Instance Method Summary - collapse -

                - -
                  - -
                • - - - #+ ⇒ Object - - - - - - - - - - - - - -

                  15.2.19.7.2.

                  -
                  - -
                • - - -
                • - - - #- ⇒ Object - - - - - - - - - - - - - -

                  15.2.19.7.3.

                  -
                  - -
                • - - -
                • - - - #<=> ⇒ Object - - - - - - - - - - - - - -

                  15.2.19.7.1.

                  -
                  - -
                • - - -
                • - - - #== ⇒ Object - - - - - - - - - - - - - -

                  15.2.19.6.6.

                  -
                  - -
                • - - -
                • - - - #asctime ⇒ Object - - - - - - - - - - - - - -

                  Returns a string that describes the time.

                  -
                  - -
                • - - -
                • - - - #ctime ⇒ Object - - - - - - - - - - - - - -

                  Returns a string that describes the time.

                  -
                  - -
                • - - -
                • - - - #day ⇒ Object - - - - - - - - - - - - - -

                  Returns the day in the month of the time.

                  -
                  - -
                • - - -
                • - - - #dst? ⇒ Boolean - - - - - - - - - - - - - -

                  Returns true if daylight saving was applied for this time.

                  -
                  - -
                • - - -
                • - - - #friday? ⇒ Boolean - - - - - - - - - - - - - -
                  -
                  - -
                • - - -
                • - - - #getgm ⇒ Object - - - - - - - - - - - - - -

                  Returns the Time object of the UTC(GMT) timezone.

                  -
                  - -
                • - - -
                • - - - #getlocal ⇒ Object - - - - - - - - - - - - - -

                  Returns the Time object of the LOCAL timezone.

                  -
                  - -
                • - - -
                • - - - #getutc ⇒ Object - - - - - - - - - - - - - -

                  Returns the Time object of the UTC(GMT) timezone.

                  -
                  - -
                • - - -
                • - - - #gmt? ⇒ Boolean - - - - - - - - - - - - - -

                  Returns true if this time is in the UTC timezone false if not.

                  -
                  - -
                • - - -
                • - - - #gmtime ⇒ Object - - - - - - - - - - - - - -

                  Sets the timezone attribute of the Time object to UTC.

                  -
                  - -
                • - - -
                • - - - #hour ⇒ Object - - - - - - - - - - - - - -

                  Returns hour of time.

                  -
                  - -
                • - - -
                • - - - #initialize ⇒ Object - - - - - - - constructor - - - - - - - - -

                  Initializes a time by setting the amount of milliseconds since the epoch.

                  -
                  - -
                • - - -
                • - - - #initialize_copy ⇒ Object - - - - - - - - - - - - - -

                  Initializes a copy of this time object.

                  -
                  - -
                • - - -
                • - - - #inspect ⇒ Object - - - - - - - - - - - - - -
                  -
                  - -
                • - - -
                • - - - #localtime ⇒ Object - - - - - - - - - - - - - -

                  Sets the timezone attribute of the Time object to LOCAL.

                  -
                  - -
                • - - -
                • - - - #mday ⇒ Object - - - - - - - - - - - - - -

                  Returns day of month of time.

                  -
                  - -
                • - - -
                • - - - #min ⇒ Object - - - - - - - - - - - - - -

                  Returns minutes of time.

                  -
                  - -
                • - - -
                • - - - #mon ⇒ Object - - - - - - - - - - - - - -

                  Returns month of time.

                  -
                  - -
                • - - -
                • - - - #monday? ⇒ Boolean - - - - - - - - - - - - - -
                  -
                  - -
                • - - -
                • - - - #month ⇒ Object - - - - - - - - - - - - - -

                  Returns month of time.

                  -
                  - -
                • - - -
                • - - - #saturday? ⇒ Boolean - - - - - - - - - - - - - -
                  -
                  - -
                • - - -
                • - - - #sec ⇒ Object - - - - - - - - - - - - - -

                  Returns seconds in minute of time.

                  -
                  - -
                • - - -
                • - - - #sunday? ⇒ Boolean - - - - - - - - - - - - - -
                  -
                  - -
                • - - -
                • - - - #thursday? ⇒ Boolean - - - - - - - - - - - - - -
                  -
                  - -
                • - - -
                • - - - #to_f ⇒ Object - - - - - - - - - - - - - -

                  Returns a Float with the time since the epoch in seconds.

                  -
                  - -
                • - - -
                • - - - #to_i ⇒ Object - - - - - - - - - - - - - -

                  Returns an Integer with the time since the epoch in seconds.

                  -
                  - -
                • - - -
                • - - - #to_s ⇒ Object - - - - - - - - - - - - - -

                  15.2.19.7.3.

                  -
                  - -
                • - - -
                • - - - #tuesday? ⇒ Boolean - - - - - - - - - - - - - -
                  -
                  - -
                • - - -
                • - - - #usec ⇒ Object - - - - - - - - - - - - - -

                  Returns an Integer with the time since the epoch in microseconds.

                  -
                  - -
                • - - -
                • - - - #utc ⇒ Object - - - - - - - - - - - - - -

                  Sets the timezone attribute of the Time object to UTC.

                  -
                  - -
                • - - -
                • - - - #utc? ⇒ Boolean - - - - - - - - - - - - - -

                  Returns true if this time is in the UTC timezone false if not.

                  -
                  - -
                • - - -
                • - - - #wday ⇒ Object - - - - - - - - - - - - - -

                  Returns week day number of time.

                  -
                  - -
                • - - -
                • - - - #wednesday? ⇒ Boolean - - - - - - - - - - - - - -
                  -
                  - -
                • - - -
                • - - - #yday ⇒ Object - - - - - - - - - - - - - -

                  Returns year day number of time.

                  -
                  - -
                • - - -
                • - - - #year ⇒ Object - - - - - - - - - - - - - -

                  Returns year of time.

                  -
                  - -
                • - - -
                • - - - #zone ⇒ Object - - - - - - - - - - - - - -

                  Returns name of time’s timezone.

                  -
                  - -
                • - - -
                - - -
                -

                Constructor Details

                - -
                -

                - - #initializeObject - - - - - -

                -
                -

                Initializes a time by setting the amount of milliseconds since the epoch.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -739
                -740
                -741
                -742
                -743
                -744
                -745
                -746
                -747
                -748
                -749
                -750
                -751
                -752
                -753
                -754
                -755
                -756
                -757
                -758
                -759
                -760
                -761
                -762
                -763
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 739
                -
                -static mrb_value
                -mrb_time_initialize(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_int ayear = 0, amonth = 1, aday = 1, ahour = 0,
                -  amin = 0, asec = 0, ausec = 0;
                -  mrb_int n;
                -  struct mrb_time *tm;
                -
                -  n = mrb_get_args(mrb, "|iiiiiii",
                -       &ayear, &amonth, &aday, &ahour, &amin, &asec, &ausec);
                -  tm = (struct mrb_time*)DATA_PTR(self);
                -  if (tm) {
                -    mrb_free(mrb, tm);
                -  }
                -  mrb_data_init(self, NULL, &mrb_time_type);
                -
                -  if (n == 0) {
                -    tm = current_mrb_time(mrb);
                -  }
                -  else {
                -    tm = time_mktime(mrb, ayear, amonth, aday, ahour, amin, asec, ausec, MRB_TIMEZONE_LOCAL);
                -  }
                -  mrb_data_init(self, tm, &mrb_time_type);
                -  return self;
                -}
                -
                -
                - -
                - - -
                -

                Instance Method Details

                - - -
                -

                - - #+Object - - - - - -

                -
                -

                15.2.19.7.2

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -553
                -554
                -555
                -556
                -557
                -558
                -559
                -560
                -561
                -562
                -563
                -564
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 553
                -
                -static mrb_value
                -mrb_time_plus(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_value o;
                -  struct mrb_time *tm;
                -  time_t sec, usec;
                -
                -  mrb_get_args(mrb, "o", &o);
                -  tm = time_get_ptr(mrb, self);
                -  sec = mrb_to_time_t(mrb, o, &usec);
                -  return mrb_time_make_time(mrb, mrb_obj_class(mrb, self), tm->sec+sec, tm->usec+usec, tm->timezone);
                -}
                -
                -
                - -
                -

                - - #-Object - - - - - -

                -
                -

                15.2.19.7.3

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -566
                -567
                -568
                -569
                -570
                -571
                -572
                -573
                -574
                -575
                -576
                -577
                -578
                -579
                -580
                -581
                -582
                -583
                -584
                -585
                -586
                -587
                -588
                -589
                -590
                -591
                -592
                -593
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 566
                -
                -static mrb_value
                -mrb_time_minus(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_value other;
                -  struct mrb_time *tm, *tm2;
                -
                -  mrb_get_args(mrb, "o", &other);
                -  tm = time_get_ptr(mrb, self);
                -  tm2 = DATA_CHECK_GET_PTR(mrb, other, &mrb_time_type, struct mrb_time);
                -  if (tm2) {
                -#ifndef MRB_WITHOUT_FLOAT
                -    mrb_float f;
                -    f = (mrb_sec)(tm->sec - tm2->sec)
                -      + (mrb_sec)(tm->usec - tm2->usec) / 1.0e6;
                -    return mrb_float_value(mrb, f);
                -#else
                -    mrb_int f;
                -    f = tm->sec - tm2->sec;
                -    if (tm->usec < tm2->usec) f--;
                -    return mrb_fixnum_value(f);
                -#endif
                -  }
                -  else {
                -    time_t sec, usec;
                -    sec = mrb_to_time_t(mrb, other, &usec);
                -    return mrb_time_make_time(mrb, mrb_obj_class(mrb, self), tm->sec-sec, tm->usec-usec, tm->timezone);
                -  }
                -}
                -
                -
                - -
                -

                - - #<=>Object - - - - - -

                -
                -

                15.2.19.7.1

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -527
                -528
                -529
                -530
                -531
                -532
                -533
                -534
                -535
                -536
                -537
                -538
                -539
                -540
                -541
                -542
                -543
                -544
                -545
                -546
                -547
                -548
                -549
                -550
                -551
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 527
                -
                -static mrb_value
                -mrb_time_cmp(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_value other;
                -  struct mrb_time *tm1, *tm2;
                -
                -  mrb_get_args(mrb, "o", &other);
                -  tm1 = DATA_GET_PTR(mrb, self, &mrb_time_type, struct mrb_time);
                -  tm2 = DATA_CHECK_GET_PTR(mrb, other, &mrb_time_type, struct mrb_time);
                -  if (!tm1 || !tm2) return mrb_nil_value();
                -  if (tm1->sec > tm2->sec) {
                -    return mrb_fixnum_value(1);
                -  }
                -  else if (tm1->sec < tm2->sec) {
                -    return mrb_fixnum_value(-1);
                -  }
                -  /* tm1->sec == tm2->sec */
                -  if (tm1->usec > tm2->usec) {
                -    return mrb_fixnum_value(1);
                -  }
                -  else if (tm1->usec < tm2->usec) {
                -    return mrb_fixnum_value(-1);
                -  }
                -  return mrb_fixnum_value(0);
                -}
                -
                -
                - -
                -

                - - #==Object - - - - - -

                -
                -

                15.2.19.6.6

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -512
                -513
                -514
                -515
                -516
                -517
                -518
                -519
                -520
                -521
                -522
                -523
                -524
                -525
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 512
                -
                -static mrb_value
                -mrb_time_eq(mrb_state *mrb, mrb_value self)
                -{
                -  mrb_value other;
                -  struct mrb_time *tm1, *tm2;
                -  mrb_bool eq_p;
                -
                -  mrb_get_args(mrb, "o", &other);
                -  tm1 = DATA_GET_PTR(mrb, self, &mrb_time_type, struct mrb_time);
                -  tm2 = DATA_CHECK_GET_PTR(mrb, other, &mrb_time_type, struct mrb_time);
                -  eq_p = tm1 && tm2 && tm1->sec == tm2->sec && tm1->usec == tm2->usec;
                -
                -  return mrb_bool_value(eq_p);
                -}
                -
                -
                - -
                -

                - - #asctimeObject - - - - - -

                -
                -

                Returns a string that describes the time.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -645
                -646
                -647
                -648
                -649
                -650
                -651
                -652
                -653
                -654
                -655
                -656
                -657
                -658
                -659
                -660
                -661
                -662
                -663
                -664
                -665
                -666
                -667
                -668
                -669
                -670
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 645
                -
                -static mrb_value
                -mrb_time_asctime(mrb_state *mrb, mrb_value self)
                -{
                -  struct mrb_time *tm = time_get_ptr(mrb, self);
                -  struct tm *d = &tm->datetime;
                -  int len;
                -
                -#if defined(MRB_DISABLE_STDIO)
                -  char *s;
                -# ifdef NO_ASCTIME_R
                -  s = asctime(d);
                -# else
                -  char buf[32];
                -  s = asctime_r(d, buf);
                -# endif
                -  len = strlen(s)-1;            /* truncate the last newline */
                -#else
                -  char buf[256];
                -
                -  len = snprintf(buf, sizeof(buf), "%s %s %2d %02d:%02d:%02d %.4d",
                -    wday_names[d->tm_wday], mon_names[d->tm_mon], d->tm_mday,
                -    d->tm_hour, d->tm_min, d->tm_sec,
                -    d->tm_year + 1900);
                -#endif
                -  return mrb_str_new(mrb, buf, len);
                -}
                -
                -
                - -
                -

                - - #ctimeObject - - - - - -

                -
                -

                Returns a string that describes the time.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -645
                -646
                -647
                -648
                -649
                -650
                -651
                -652
                -653
                -654
                -655
                -656
                -657
                -658
                -659
                -660
                -661
                -662
                -663
                -664
                -665
                -666
                -667
                -668
                -669
                -670
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 645
                -
                -static mrb_value
                -mrb_time_asctime(mrb_state *mrb, mrb_value self)
                -{
                -  struct mrb_time *tm = time_get_ptr(mrb, self);
                -  struct tm *d = &tm->datetime;
                -  int len;
                -
                -#if defined(MRB_DISABLE_STDIO)
                -  char *s;
                -# ifdef NO_ASCTIME_R
                -  s = asctime(d);
                -# else
                -  char buf[32];
                -  s = asctime_r(d, buf);
                -# endif
                -  len = strlen(s)-1;            /* truncate the last newline */
                -#else
                -  char buf[256];
                -
                -  len = snprintf(buf, sizeof(buf), "%s %s %2d %02d:%02d:%02d %.4d",
                -    wday_names[d->tm_wday], mon_names[d->tm_mon], d->tm_mday,
                -    d->tm_hour, d->tm_min, d->tm_sec,
                -    d->tm_year + 1900);
                -#endif
                -  return mrb_str_new(mrb, buf, len);
                -}
                -
                -
                - -
                -

                - - #dayObject - - - - - -

                -
                -

                Returns the day in the month of the time.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -674
                -675
                -676
                -677
                -678
                -679
                -680
                -681
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 674
                -
                -static mrb_value
                -mrb_time_day(mrb_state *mrb, mrb_value self)
                -{
                -  struct mrb_time *tm;
                -
                -  tm = time_get_ptr(mrb, self);
                -  return mrb_fixnum_value(tm->datetime.tm_mday);
                -}
                -
                -
                - -
                -

                - - #dst?Boolean - - - - - -

                -
                -

                Returns true if daylight saving was applied for this time.

                - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (Boolean) - - - -
                • - -
                - -
                - - - - - - -
                -
                -
                -
                -686
                -687
                -688
                -689
                -690
                -691
                -692
                -693
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 686
                -
                -static mrb_value
                -mrb_time_dst_p(mrb_state *mrb, mrb_value self)
                -{
                -  struct mrb_time *tm;
                -
                -  tm = time_get_ptr(mrb, self);
                -  return mrb_bool_value(tm->datetime.tm_isdst);
                -}
                -
                -
                - -
                -

                - - #friday?Boolean - - - - - -

                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (Boolean) - - - -
                • - -
                - -
                - - - - - - -
                -
                -
                -
                -7
                -
                -
                # File 'mrbgems/mruby-time/mrblib/time.rb', line 7
                -
                -def friday?;  wday == 5 end
                -
                -
                - -
                -

                - - #getgmObject - - - - - -

                -
                -

                Returns the Time object of the UTC(GMT) timezone.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -698
                -699
                -700
                -701
                -702
                -703
                -704
                -705
                -706
                -707
                -708
                -709
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 698
                -
                -static mrb_value
                -mrb_time_getutc(mrb_state *mrb, mrb_value self)
                -{
                -  struct mrb_time *tm, *tm2;
                -
                -  tm = time_get_ptr(mrb, self);
                -  tm2 = (struct mrb_time *)mrb_malloc(mrb, sizeof(*tm));
                -  *tm2 = *tm;
                -  tm2->timezone = MRB_TIMEZONE_UTC;
                -  time_update_datetime(mrb, tm2, TRUE);
                -  return mrb_time_wrap(mrb, mrb_obj_class(mrb, self), tm2);
                -}
                -
                -
                - -
                -

                - - #getlocalObject - - - - - -

                -
                -

                Returns the Time object of the LOCAL timezone.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -713
                -714
                -715
                -716
                -717
                -718
                -719
                -720
                -721
                -722
                -723
                -724
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 713
                -
                -static mrb_value
                -mrb_time_getlocal(mrb_state *mrb, mrb_value self)
                -{
                -  struct mrb_time *tm, *tm2;
                -
                -  tm = time_get_ptr(mrb, self);
                -  tm2 = (struct mrb_time *)mrb_malloc(mrb, sizeof(*tm));
                -  *tm2 = *tm;
                -  tm2->timezone = MRB_TIMEZONE_LOCAL;
                -  time_update_datetime(mrb, tm2, TRUE);
                -  return mrb_time_wrap(mrb, mrb_obj_class(mrb, self), tm2);
                -}
                -
                -
                - -
                -

                - - #getutcObject - - - - - -

                -
                -

                Returns the Time object of the UTC(GMT) timezone.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -698
                -699
                -700
                -701
                -702
                -703
                -704
                -705
                -706
                -707
                -708
                -709
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 698
                -
                -static mrb_value
                -mrb_time_getutc(mrb_state *mrb, mrb_value self)
                -{
                -  struct mrb_time *tm, *tm2;
                -
                -  tm = time_get_ptr(mrb, self);
                -  tm2 = (struct mrb_time *)mrb_malloc(mrb, sizeof(*tm));
                -  *tm2 = *tm;
                -  tm2->timezone = MRB_TIMEZONE_UTC;
                -  time_update_datetime(mrb, tm2, TRUE);
                -  return mrb_time_wrap(mrb, mrb_obj_class(mrb, self), tm2);
                -}
                -
                -
                - -
                -

                - - #gmt?Boolean - - - - - -

                -
                -

                Returns true if this time is in the UTC timezone false if not.

                - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (Boolean) - - - -
                • - -
                - -
                - - - - - - -
                -
                -
                -
                -908
                -909
                -910
                -911
                -912
                -913
                -914
                -915
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 908
                -
                -static mrb_value
                -mrb_time_utc_p(mrb_state *mrb, mrb_value self)
                -{
                -  struct mrb_time *tm;
                -
                -  tm = time_get_ptr(mrb, self);
                -  return mrb_bool_value(tm->timezone == MRB_TIMEZONE_UTC);
                -}
                -
                -
                - -
                -

                - - #gmtimeObject - - - - - -

                -
                -

                Sets the timezone attribute of the Time object to UTC.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -895
                -896
                -897
                -898
                -899
                -900
                -901
                -902
                -903
                -904
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 895
                -
                -static mrb_value
                -mrb_time_utc(mrb_state *mrb, mrb_value self)
                -{
                -  struct mrb_time *tm;
                -
                -  tm = time_get_ptr(mrb, self);
                -  tm->timezone = MRB_TIMEZONE_UTC;
                -  time_update_datetime(mrb, tm, FALSE);
                -  return self;
                -}
                -
                -
                - -
                -

                - - #hourObject - - - - - -

                -
                -

                Returns hour of time.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -728
                -729
                -730
                -731
                -732
                -733
                -734
                -735
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 728
                -
                -static mrb_value
                -mrb_time_hour(mrb_state *mrb, mrb_value self)
                -{
                -  struct mrb_time *tm;
                -
                -  tm = time_get_ptr(mrb, self);
                -  return mrb_fixnum_value(tm->datetime.tm_hour);
                -}
                -
                -
                - -
                -

                - - #initialize_copyObject - - - - - -

                -
                -

                Initializes a copy of this time object.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -767
                -768
                -769
                -770
                -771
                -772
                -773
                -774
                -775
                -776
                -777
                -778
                -779
                -780
                -781
                -782
                -783
                -784
                -785
                -786
                -787
                -788
                -789
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 767
                -
                -static mrb_value
                -mrb_time_initialize_copy(mrb_state *mrb, mrb_value copy)
                -{
                -  mrb_value src;
                -  struct mrb_time *t1, *t2;
                -
                -  mrb_get_args(mrb, "o", &src);
                -  if (mrb_obj_equal(mrb, copy, src)) return copy;
                -  if (!mrb_obj_is_instance_of(mrb, src, mrb_obj_class(mrb, copy))) {
                -    mrb_raise(mrb, E_TYPE_ERROR, "wrong argument class");
                -  }
                -  t1 = (struct mrb_time *)DATA_PTR(copy);
                -  t2 = (struct mrb_time *)DATA_PTR(src);
                -  if (!t2) {
                -    mrb_raise(mrb, E_ARGUMENT_ERROR, "uninitialized time");
                -  }
                -  if (!t1) {
                -    t1 = (struct mrb_time *)mrb_malloc(mrb, sizeof(struct mrb_time));
                -    mrb_data_init(copy, t1, &mrb_time_type);
                -  }
                -  *t1 = *t2;
                -  return copy;
                -}
                -
                -
                - -
                -

                - - #inspectObject - - - - - -

                - - - - -
                -
                -
                -
                -948
                -949
                -950
                -951
                -952
                -953
                -954
                -955
                -956
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 948
                -
                -static mrb_value
                -mrb_time_to_s(mrb_state *mrb, mrb_value self)
                -{
                -  char buf[64];
                -  struct mrb_time *tm = time_get_ptr(mrb, self);
                -  mrb_bool utc = tm->timezone == MRB_TIMEZONE_UTC;
                -  size_t len = (utc ? time_to_s_utc : time_to_s_local)(mrb, tm, buf, sizeof(buf));
                -  return mrb_str_new(mrb, buf, len);
                -}
                -
                -
                - -
                -

                - - #localtimeObject - - - - - -

                -
                -

                Sets the timezone attribute of the Time object to LOCAL.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -793
                -794
                -795
                -796
                -797
                -798
                -799
                -800
                -801
                -802
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 793
                -
                -static mrb_value
                -mrb_time_localtime(mrb_state *mrb, mrb_value self)
                -{
                -  struct mrb_time *tm;
                -
                -  tm = time_get_ptr(mrb, self);
                -  tm->timezone = MRB_TIMEZONE_LOCAL;
                -  time_update_datetime(mrb, tm, FALSE);
                -  return self;
                -}
                -
                -
                - -
                -

                - - #mdayObject - - - - - -

                -
                -

                Returns day of month of time.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -806
                -807
                -808
                -809
                -810
                -811
                -812
                -813
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 806
                -
                -static mrb_value
                -mrb_time_mday(mrb_state *mrb, mrb_value self)
                -{
                -  struct mrb_time *tm;
                -
                -  tm = time_get_ptr(mrb, self);
                -  return mrb_fixnum_value(tm->datetime.tm_mday);
                -}
                -
                -
                - -
                -

                - - #minObject - - - - - -

                -
                -

                Returns minutes of time.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -817
                -818
                -819
                -820
                -821
                -822
                -823
                -824
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 817
                -
                -static mrb_value
                -mrb_time_min(mrb_state *mrb, mrb_value self)
                -{
                -  struct mrb_time *tm;
                -
                -  tm = time_get_ptr(mrb, self);
                -  return mrb_fixnum_value(tm->datetime.tm_min);
                -}
                -
                -
                - -
                -

                - - #monObject - - - - - -

                -
                -

                Returns month of time.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -828
                -829
                -830
                -831
                -832
                -833
                -834
                -835
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 828
                -
                -static mrb_value
                -mrb_time_mon(mrb_state *mrb, mrb_value self)
                -{
                -  struct mrb_time *tm;
                -
                -  tm = time_get_ptr(mrb, self);
                -  return mrb_fixnum_value(tm->datetime.tm_mon + 1);
                -}
                -
                -
                - -
                -

                - - #monday?Boolean - - - - - -

                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (Boolean) - - - -
                • - -
                - -
                - - - - - - -
                -
                -
                -
                -3
                -
                -
                # File 'mrbgems/mruby-time/mrblib/time.rb', line 3
                -
                -def monday?;  wday == 1 end
                -
                -
                - -
                -

                - - #monthObject - - - - - -

                -
                -

                Returns month of time.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -828
                -829
                -830
                -831
                -832
                -833
                -834
                -835
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 828
                -
                -static mrb_value
                -mrb_time_mon(mrb_state *mrb, mrb_value self)
                -{
                -  struct mrb_time *tm;
                -
                -  tm = time_get_ptr(mrb, self);
                -  return mrb_fixnum_value(tm->datetime.tm_mon + 1);
                -}
                -
                -
                - -
                -

                - - #saturday?Boolean - - - - - -

                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (Boolean) - - - -
                • - -
                - -
                - - - - - - -
                -
                -
                -
                -8
                -
                -
                # File 'mrbgems/mruby-time/mrblib/time.rb', line 8
                -
                -def saturday?;  wday == 6 end
                -
                -
                - -
                -

                - - #secObject - - - - - -

                -
                -

                Returns seconds in minute of time.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -839
                -840
                -841
                -842
                -843
                -844
                -845
                -846
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 839
                -
                -static mrb_value
                -mrb_time_sec(mrb_state *mrb, mrb_value self)
                -{
                -  struct mrb_time *tm;
                -
                -  tm = time_get_ptr(mrb, self);
                -  return mrb_fixnum_value(tm->datetime.tm_sec);
                -}
                -
                -
                - -
                -

                - - #sunday?Boolean - - - - - -

                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (Boolean) - - - -
                • - -
                - -
                - - - - - - -
                -
                -
                -
                -2
                -
                -
                # File 'mrbgems/mruby-time/mrblib/time.rb', line 2
                -
                -def sunday?;  wday == 0 end
                -
                -
                - -
                -

                - - #thursday?Boolean - - - - - -

                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (Boolean) - - - -
                • - -
                - -
                - - - - - - -
                -
                -
                -
                -6
                -
                -
                # File 'mrbgems/mruby-time/mrblib/time.rb', line 6
                -
                -def thursday?;  wday == 4 end
                -
                -
                - -
                -

                - - #to_fObject - - - - - -

                -
                -

                Returns a Float with the time since the epoch in seconds.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -851
                -852
                -853
                -854
                -855
                -856
                -857
                -858
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 851
                -
                -static mrb_value
                -mrb_time_to_f(mrb_state *mrb, mrb_value self)
                -{
                -  struct mrb_time *tm;
                -
                -  tm = time_get_ptr(mrb, self);
                -  return mrb_float_value(mrb, (mrb_float)tm->sec + (mrb_float)tm->usec/1.0e6);
                -}
                -
                -
                - -
                -

                - - #to_iObject - - - - - -

                -
                -

                Returns an Integer with the time since the epoch in seconds.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -863
                -864
                -865
                -866
                -867
                -868
                -869
                -870
                -871
                -872
                -873
                -874
                -875
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 863
                -
                -static mrb_value
                -mrb_time_to_i(mrb_state *mrb, mrb_value self)
                -{
                -  struct mrb_time *tm;
                -
                -  tm = time_get_ptr(mrb, self);
                -#ifndef MRB_WITHOUT_FLOAT
                -  if (tm->sec > MRB_INT_MAX || tm->sec < MRB_INT_MIN) {
                -    return mrb_float_value(mrb, (mrb_float)tm->sec);
                -  }
                -#endif
                -  return mrb_fixnum_value((mrb_int)tm->sec);
                -}
                -
                -
                - -
                -

                - - #to_sObject - - - - - -

                -
                -

                15.2.19.7.3

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -948
                -949
                -950
                -951
                -952
                -953
                -954
                -955
                -956
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 948
                -
                -static mrb_value
                -mrb_time_to_s(mrb_state *mrb, mrb_value self)
                -{
                -  char buf[64];
                -  struct mrb_time *tm = time_get_ptr(mrb, self);
                -  mrb_bool utc = tm->timezone == MRB_TIMEZONE_UTC;
                -  size_t len = (utc ? time_to_s_utc : time_to_s_local)(mrb, tm, buf, sizeof(buf));
                -  return mrb_str_new(mrb, buf, len);
                -}
                -
                -
                - -
                -

                - - #tuesday?Boolean - - - - - -

                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (Boolean) - - - -
                • - -
                - -
                - - - - - - -
                -
                -
                -
                -4
                -
                -
                # File 'mrbgems/mruby-time/mrblib/time.rb', line 4
                -
                -def tuesday?;  wday == 2 end
                -
                -
                - -
                -

                - - #usecObject - - - - - -

                -
                -

                Returns an Integer with the time since the epoch in microseconds.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -879
                -880
                -881
                -882
                -883
                -884
                -885
                -886
                -887
                -888
                -889
                -890
                -891
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 879
                -
                -static mrb_value
                -mrb_time_usec(mrb_state *mrb, mrb_value self)
                -{
                -  struct mrb_time *tm;
                -
                -  tm = time_get_ptr(mrb, self);
                -#ifndef MRB_WITHOUT_FLOAT
                -  if (tm->usec > MRB_INT_MAX || tm->usec < MRB_INT_MIN) {
                -    return mrb_float_value(mrb, (mrb_float)tm->usec);
                -  }
                -#endif
                -  return mrb_fixnum_value((mrb_int)tm->usec);
                -}
                -
                -
                - -
                -

                - - #utcObject - - - - - -

                -
                -

                Sets the timezone attribute of the Time object to UTC.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -895
                -896
                -897
                -898
                -899
                -900
                -901
                -902
                -903
                -904
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 895
                -
                -static mrb_value
                -mrb_time_utc(mrb_state *mrb, mrb_value self)
                -{
                -  struct mrb_time *tm;
                -
                -  tm = time_get_ptr(mrb, self);
                -  tm->timezone = MRB_TIMEZONE_UTC;
                -  time_update_datetime(mrb, tm, FALSE);
                -  return self;
                -}
                -
                -
                - -
                -

                - - #utc?Boolean - - - - - -

                -
                -

                Returns true if this time is in the UTC timezone false if not.

                - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (Boolean) - - - -
                • - -
                - -
                - - - - - - -
                -
                -
                -
                -908
                -909
                -910
                -911
                -912
                -913
                -914
                -915
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 908
                -
                -static mrb_value
                -mrb_time_utc_p(mrb_state *mrb, mrb_value self)
                -{
                -  struct mrb_time *tm;
                -
                -  tm = time_get_ptr(mrb, self);
                -  return mrb_bool_value(tm->timezone == MRB_TIMEZONE_UTC);
                -}
                -
                -
                - -
                -

                - - #wdayObject - - - - - -

                -
                -

                Returns week day number of time.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -597
                -598
                -599
                -600
                -601
                -602
                -603
                -604
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 597
                -
                -static mrb_value
                -mrb_time_wday(mrb_state *mrb, mrb_value self)
                -{
                -  struct mrb_time *tm;
                -
                -  tm = time_get_ptr(mrb, self);
                -  return mrb_fixnum_value(tm->datetime.tm_wday);
                -}
                -
                -
                - -
                -

                - - #wednesday?Boolean - - - - - -

                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (Boolean) - - - -
                • - -
                - -
                - - - - - - -
                -
                -
                -
                -5
                -
                -
                # File 'mrbgems/mruby-time/mrblib/time.rb', line 5
                -
                -def wednesday?;  wday == 3 end
                -
                -
                - -
                -

                - - #ydayObject - - - - - -

                -
                -

                Returns year day number of time.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -608
                -609
                -610
                -611
                -612
                -613
                -614
                -615
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 608
                -
                -static mrb_value
                -mrb_time_yday(mrb_state *mrb, mrb_value self)
                -{
                -  struct mrb_time *tm;
                -
                -  tm = time_get_ptr(mrb, self);
                -  return mrb_fixnum_value(tm->datetime.tm_yday + 1);
                -}
                -
                -
                - -
                -

                - - #yearObject - - - - - -

                -
                -

                Returns year of time.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -619
                -620
                -621
                -622
                -623
                -624
                -625
                -626
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 619
                -
                -static mrb_value
                -mrb_time_year(mrb_state *mrb, mrb_value self)
                -{
                -  struct mrb_time *tm;
                -
                -  tm = time_get_ptr(mrb, self);
                -  return mrb_fixnum_value(tm->datetime.tm_year + 1900);
                -}
                -
                -
                - -
                -

                - - #zoneObject - - - - - -

                -
                -

                Returns name of time’s timezone.

                - - -
                -
                -
                - - -
                - - - - - - -
                -
                -
                -
                -630
                -631
                -632
                -633
                -634
                -635
                -636
                -637
                -638
                -639
                -640
                -641
                -
                -
                # File 'mrbgems/mruby-time/src/time.c', line 630
                -
                -static mrb_value
                -mrb_time_zone(mrb_state *mrb, mrb_value self)
                -{
                -  struct mrb_time *tm;
                -
                -  tm = time_get_ptr(mrb, self);
                -  if (tm->timezone <= MRB_TIMEZONE_NONE) return mrb_nil_value();
                -  if (tm->timezone >= MRB_TIMEZONE_LAST) return mrb_nil_value();
                -  return mrb_str_new_static(mrb,
                -                            timezone_names[tm->timezone].name,
                -                            timezone_names[tm->timezone].len);
                -}
                -
                -
                - -
                - -
                - - - -
                - - \ No newline at end of file diff --git a/docs/api/TrueClass.html b/docs/api/TrueClass.html deleted file mode 100644 index 634cf8c..0000000 --- a/docs/api/TrueClass.html +++ /dev/null @@ -1,585 +0,0 @@ - - - - - - - Class: TrueClass - - — Documentation by YARD 0.9.20 - - - - - - - - - - - - - - - - - - - - - - - -
                - - -

                Class: TrueClass - - - -

                -
                - -
                -
                Inherits:
                -
                - Object - -
                  -
                • Object
                • - - - -
                - show all - -
                -
                - - - - - - - - - - - -
                -
                Defined in:
                -
                src/object.c
                -
                - -
                - - - - - - - - - -

                - Instance Method Summary - collapse -

                - -
                  - -
                • - - - #&(obj) ⇒ Boolean - - - - - - - - - - - - - -

                  And—Returns false if obj is nil or false, true otherwise.

                  -
                  - -
                • - - -
                • - - - #^(obj) ⇒ Object - - - - - - - - - - - - - -

                  Exclusive Or—Returns true if obj is nil or false, false otherwise.

                  -
                  - -
                • - - -
                • - - - #to_s ⇒ Object - - - - - - - - - - - - - -

                  The string representation of true is “true”.

                  -
                  - -
                • - - -
                • - - - #to_s ⇒ Object - - - - - - - - - - - - - -

                  The string representation of true is “true”.

                  -
                  - -
                • - - -
                • - - - #|(obj) ⇒ true - - - - - - - - - - - - - -

                  Or—Returns true.

                  -
                  - -
                • - - -
                - - - - -
                -

                Instance Method Details

                - - -
                -

                - - #&(obj) ⇒ Boolean - - - - - -

                -
                -

                And—Returns false if obj is -nil or false, true otherwise.

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (Boolean) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -113
                -114
                -115
                -116
                -117
                -118
                -119
                -120
                -121
                -
                -
                # File 'src/object.c', line 113
                -
                -static mrb_value
                -true_and(mrb_state *mrb, mrb_value obj)
                -{
                -  mrb_bool obj2;
                -
                -  mrb_get_args(mrb, "b", &obj2);
                -
                -  return mrb_bool_value(obj2);
                -}
                -
                -
                - -
                -

                - - #^(obj) ⇒ Object - - - - - -

                -
                -

                Exclusive Or—Returns true if obj is -nil or false, false -otherwise.

                - - -
                -
                -
                - - - - -
                - - - - - - -
                -
                -
                -
                -133
                -134
                -135
                -136
                -137
                -138
                -139
                -140
                -
                -
                # File 'src/object.c', line 133
                -
                -static mrb_value
                -true_xor(mrb_state *mrb, mrb_value obj)
                -{
                -  mrb_bool obj2;
                -
                -  mrb_get_args(mrb, "b", &obj2);
                -  return mrb_bool_value(!obj2);
                -}
                -
                -
                - -
                -

                - - #to_sObject - - - - - -

                -
                -

                The string representation of true is “true”.

                - - -
                -
                -
                - - - - -
                - - - - - - -
                -
                -
                -
                -150
                -151
                -152
                -153
                -154
                -
                -
                # File 'src/object.c', line 150
                -
                -static mrb_value
                -true_to_s(mrb_state *mrb, mrb_value obj)
                -{
                -  return mrb_str_new_lit_frozen(mrb, "true");
                -}
                -
                -
                - -
                -

                - - #to_sObject - - - - - -

                -
                -

                The string representation of true is “true”.

                - - -
                -
                -
                - - - - -
                - - - - - - -
                -
                -
                -
                -150
                -151
                -152
                -153
                -154
                -
                -
                # File 'src/object.c', line 150
                -
                -static mrb_value
                -true_to_s(mrb_state *mrb, mrb_value obj)
                -{
                -  return mrb_str_new_lit_frozen(mrb, "true");
                -}
                -
                -
                - -
                -

                - - #|(obj) ⇒ true - - - - - -

                -
                -

                Or—Returns true. As anObject is an argument to -a method call, it is always evaluated; there is no short-circuit -evaluation in this case.

                - - - - - - - - - - - - - - -
                trueputs(“or”) 
                true puts(“logical or”)
                - -

                produces:

                - -

                or

                - - -
                -
                -
                - -
                -
                - - - -
                -
                -
                - -

                Returns:

                -
                  - -
                • - - - (true) - - - -
                • - -
                - -
                - - - - -
                - - - - - - -
                -
                -
                -
                -173
                -174
                -175
                -176
                -177
                -
                -
                # File 'src/object.c', line 173
                -
                -static mrb_value
                -true_or(mrb_state *mrb, mrb_value obj)
                -{
                -  return mrb_true_value();
                -}
                -
                -
                - -
                - -
                - - - -
                - - \ No newline at end of file diff --git a/docs/api/TypeError.html b/docs/api/TypeError.html index 4cecfff..869c634 100644 --- a/docs/api/TypeError.html +++ b/docs/api/TypeError.html @@ -6,17 +6,17 @@ Exception: TypeError - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -73,14 +73,12 @@
                Inherits:
                - StandardError + StandardError
                • Object
                • - - - + @@ -109,7 +107,8 @@

                  Overview

                  -

                  ISO 15.2.29

                  + +

                  ISO 15.2.29

                  @@ -117,8 +116,7 @@

                  Overview

                  -
                  - +
                  @@ -127,37 +125,16 @@

                  Overview

                  - - - - - - - - - - - - -

                  Method Summary

                  - -

                  Methods inherited from Exception

                  -

                  #backtrace, #exception, #initialize, #inspect, #message, #set_backtrace, #to_s

                  -
                  -

                  Constructor Details

                  - -

                  This class inherits a constructor from Exception

                  - -
                  +
                  - +
                  diff --git a/docs/api/UDPSocket.html b/docs/api/UDPSocket.html index 698d538..10e88ce 100644 --- a/docs/api/UDPSocket.html +++ b/docs/api/UDPSocket.html @@ -6,17 +6,17 @@ Class: UDPSocket - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -112,12 +112,6 @@ -

                  Constant Summary

                  - -

                  Constants inherited - from IO

                  -

                  IO::BUF_SIZE, IO::SEEK_CUR, IO::SEEK_END, IO::SEEK_SET

                  - @@ -152,8 +146,7 @@

                  -
                  -
                  +
                  @@ -175,8 +168,7 @@

                  -
                  -
                  +
                  @@ -198,8 +190,7 @@

                  -
                  -
                  +
                  @@ -223,7 +214,8 @@

                  -

                  A new instance of UDPSocket.

                  +
                  +

                  A new instance of UDPSocket.

                  @@ -246,8 +238,7 @@

                  -
                  -
                  +
                  @@ -269,8 +260,7 @@

                  -
                  -
                  +
                  @@ -299,7 +289,7 @@

                  Methods inherited from Methods inherited from BasicSocket

                  -

                  #_is_socket=, #_recvfrom, #_setnonblock, #close, do_not_reverse_lookup, do_not_reverse_lookup=, for_fd, #getpeereid, #getpeername, #getsockname, #getsockopt, #local_address, #recv, #recv_nonblock, #remote_address, #setsockopt, #shutdown, #sysread, #sysseek, #syswrite

                  +

                  do_not_reverse_lookup, do_not_reverse_lookup=, for_fd, #local_address, #recv_nonblock, #remote_address

                  @@ -310,7 +300,7 @@

                  Methods inherited from Methods inherited from IO

                  -

                  #<<, #_check_readable, #_read_buf, #close, #close_on_exec=, #close_on_exec?, #close_write, #closed?, #each, #each_byte, #eof?, #fileno, #flush, #getc, #gets, #hash, #initialize_copy, #isatty, open, #pid, pipe, popen, #pos, #pos=, #print, #printf, #puts, read, #read, #readchar, #readline, #readlines, #rewind, #seek, #sync, #sync=, #sysread, #sysseek, #syswrite, #ungetc, #write

                  +

                  #<<, #each, #each_byte, #each_char, #hash, open, pipe, popen, #pos=, #print, #printf, #puts, read, #rewind, #ungetbyte

                  Constructor Details

                  @@ -325,7 +315,8 @@

                  -

                  Returns a new instance of UDPSocket

                  + +

                  Returns a new instance of UDPSocket.

                  @@ -333,22 +324,22 @@

                  -
                  - +

                  +
                   
                   
                  +309
                   310
                   311
                   312
                  -313
                  -314
                  +313
                  -
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 310
                  +      
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 309
                   
                   def initialize(af=Socket::AF_INET)
                     super(Socket._socket(af, Socket::SOCK_DGRAM, 0), "r+")
                  @@ -382,13 +373,13 @@ 

                   
                   
                  +346
                   347
                   348
                  -349
                  -350
                  +349

                  -
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 347
                  +      
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 346
                   
                   def _sockaddr_in(port, host)
                     ai = Addrinfo.getaddrinfo(host, port, @af, Socket::SOCK_DGRAM)[0]
                  @@ -414,13 +405,13 @@ 

                   
                   
                  +315
                   316
                   317
                  -318
                  -319
                  +318

                  -
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 316
                  +      
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 315
                   
                   def bind(host, port)
                     Socket._bind(self.fileno, _sockaddr_in(port, host))
                  @@ -446,13 +437,13 @@ 

                   
                   
                  +320
                   321
                   322
                  -323
                  -324
                  +323

                  -
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 321
                  +      
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 320
                   
                   def connect(host, port)
                     Socket._connect(self.fileno, _sockaddr_in(port, host))
                  @@ -478,6 +469,7 @@ 

                   
                   
                  +325
                   326
                   327
                   328
                  @@ -486,11 +478,10 @@ 

                  331 332 333 -334 -335

                  +334

                  -
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 326
                  +      
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 325
                   
                   def recvfrom_nonblock(*args)
                     s = self
                  @@ -522,6 +513,7 @@ 

                   
                   
                  +336
                   337
                   338
                   339
                  @@ -529,11 +521,10 @@ 

                  341 342 343 -344 -345

                  +344

                  -
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 337
                  +      
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 336
                   
                   def send(mesg, flags, host=nil, port=nil)
                     if port
                  @@ -553,11 +544,11 @@ 

                  - + diff --git a/docs/api/UNIXServer.html b/docs/api/UNIXServer.html index b43272b..a8c6910 100644 --- a/docs/api/UNIXServer.html +++ b/docs/api/UNIXServer.html @@ -6,17 +6,17 @@ Class: UNIXServer - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -112,12 +112,6 @@ -

                  Constant Summary

                  - -

                  Constants inherited - from IO

                  -

                  IO::BUF_SIZE, IO::SEEK_CUR, IO::SEEK_END, IO::SEEK_SET

                  - @@ -152,8 +146,7 @@

                  -
                  -
                  +
                  @@ -175,8 +168,7 @@

                  -
                  -
                  +
                  @@ -200,7 +192,8 @@

                  -

                  A new instance of UNIXServer.

                  +
                  +

                  A new instance of UNIXServer.

                  @@ -223,8 +216,7 @@

                  -
                  -
                  +
                  @@ -246,8 +238,7 @@

                  -
                  -
                  +
                  @@ -276,7 +267,7 @@

                  Methods inherited from Methods inherited from BasicSocket

                  -

                  #_is_socket=, #_recvfrom, #_setnonblock, #close, do_not_reverse_lookup, do_not_reverse_lookup=, for_fd, #getpeereid, #getpeername, #getsockname, #getsockopt, #local_address, #recv, #recv_nonblock, #remote_address, #send, #setsockopt, #shutdown, #sysread, #sysseek, #syswrite

                  +

                  do_not_reverse_lookup, do_not_reverse_lookup=, for_fd, #local_address, #recv_nonblock, #remote_address

                  @@ -287,7 +278,7 @@

                  Methods inherited from Methods inherited from IO

                  -

                  #<<, #_check_readable, #_read_buf, #close, #close_on_exec=, #close_on_exec?, #close_write, #closed?, #each, #each_byte, #eof?, #fileno, #flush, #getc, #gets, #hash, #initialize_copy, #isatty, open, #pid, pipe, popen, #pos, #pos=, #print, #printf, #puts, read, #read, #readchar, #readline, #readlines, #rewind, #seek, #sync, #sync=, #sysread, #sysseek, #syswrite, #ungetc, #write

                  +

                  #<<, #each, #each_byte, #each_char, #hash, open, pipe, popen, #pos=, #print, #printf, #puts, read, #rewind, #ungetbyte

                  Constructor Details

                  @@ -302,7 +293,8 @@

                  -

                  Returns a new instance of UNIXServer

                  + +

                  Returns a new instance of UNIXServer.

                  @@ -310,14 +302,15 @@

                  -
                  - +

                  +
                   
                   
                  +523
                   524
                   525
                   526
                  @@ -335,11 +328,10 @@ 

                  538 539 540 -541 -542

                  +541
                  -
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 524
                  +      
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 523
                   
                   def initialize(path)
                     fd = Socket._socket(Socket::AF_UNIX, Socket::SOCK_STREAM, 0)
                  @@ -387,6 +379,7 @@ 

                   
                   
                  +543
                   544
                   545
                   546
                  @@ -394,11 +387,10 @@ 

                  548 549 550 -551 -552

                  +551

                  -
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 544
                  +      
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 543
                   
                   def accept
                     fd = self.sysaccept
                  @@ -429,17 +421,17 @@ 

                   
                   
                  +553
                   554
                   555
                   556
                   557
                   558
                   559
                  -560
                  -561
                  +560

                  -
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 554
                  +      
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 553
                   
                   def accept_nonblock
                     begin
                  @@ -469,13 +461,13 @@ 

                   
                   
                  +562
                   563
                   564
                  -565
                  -566
                  +565

                  -
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 563
                  +      
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 562
                   
                   def listen(backlog)
                     Socket._listen(self.fileno, backlog)
                  @@ -501,12 +493,12 @@ 

                   
                   
                  +567
                   568
                  -569
                  -570
                  +569

                  -
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 568
                  +      
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 567
                   
                   def sysaccept
                     Socket._accept(self.fileno)
                  @@ -520,11 +512,11 @@ 

                  - + diff --git a/docs/api/UNIXSocket.html b/docs/api/UNIXSocket.html index 52e1f7a..1cc7a4c 100644 --- a/docs/api/UNIXSocket.html +++ b/docs/api/UNIXSocket.html @@ -6,17 +6,17 @@ Class: UNIXSocket - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -114,12 +114,6 @@

                  Direct Known Subclasses

                  -

                  Constant Summary

                  - -

                  Constants inherited - from IO

                  -

                  IO::BUF_SIZE, IO::SEEK_CUR, IO::SEEK_END, IO::SEEK_SET

                  - @@ -156,8 +150,7 @@

                  -
                  -
                  +
                  @@ -188,8 +181,7 @@

                  -
                  -
                  +
                  @@ -213,7 +205,8 @@

                  -

                  A new instance of UNIXSocket.

                  +
                  +

                  A new instance of UNIXSocket.

                  @@ -236,8 +229,7 @@

                  -
                  -
                  +
                  @@ -259,8 +251,7 @@

                  -
                  -
                  +
                  @@ -282,7 +273,8 @@

                  -

                  def recv_io.

                  +
                  +

                  def recv_io.

                  @@ -301,7 +293,7 @@

                  Methods inherited from BasicSocket

                  -

                  #_is_socket=, #_recvfrom, #_setnonblock, #close, do_not_reverse_lookup, do_not_reverse_lookup=, for_fd, #getpeereid, #getpeername, #getsockname, #getsockopt, #local_address, #recv, #recv_nonblock, #remote_address, #send, #setsockopt, #shutdown, #sysread, #sysseek, #syswrite

                  +

                  do_not_reverse_lookup, do_not_reverse_lookup=, for_fd, #local_address, #recv_nonblock, #remote_address

                  @@ -312,7 +304,7 @@

                  Methods inherited from Methods inherited from IO

                  -

                  #<<, #_check_readable, #_read_buf, #close, #close_on_exec=, #close_on_exec?, #close_write, #closed?, #each, #each_byte, #eof?, #fileno, #flush, #getc, #gets, #hash, #initialize_copy, #isatty, open, #pid, pipe, popen, #pos, #pos=, #print, #printf, #puts, read, #read, #readchar, #readline, #readlines, #rewind, #seek, #sync, #sync=, #sysread, #sysseek, #syswrite, #ungetc, #write

                  +

                  #<<, #each, #each_byte, #each_char, #hash, open, pipe, popen, #pos=, #print, #printf, #puts, read, #rewind, #ungetbyte

                  Constructor Details

                  @@ -327,7 +319,8 @@

                  -

                  Returns a new instance of UNIXSocket

                  + +

                  Returns a new instance of UNIXSocket.

                  @@ -335,14 +328,15 @@

                  -
                  - +

                  + ",""],legend:[1,"
                  ","
                  "],thead:[1,"
                   
                   
                  +470
                   471
                   472
                   473
                  @@ -360,11 +354,10 @@ 

                  485 486 487 -488 -489

                  +488
                  -
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 471
                  +      
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 470
                   
                   def initialize(path, &block)
                     if self.is_a? UNIXServer
                  @@ -424,7 +417,7 @@ 

                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 491
                   
                  -def self.socketpair(type=Socket::SOCK_STREAM, protocol=0)
                  +def socketpair(type=Socket::SOCK_STREAM, protocol=0)
                     a = Socket.socketpair(Socket::AF_UNIX, type, protocol)
                     [ UNIXSocket.for_fd(a[0]), UNIXSocket.for_fd(a[1]) ]
                   end
                  @@ -454,12 +447,12 @@

                   
                   
                  +499
                   500
                  -501
                  -502
                  +501

                  -
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 500
                  +      
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 499
                   
                   def addr
                     [ "AF_UNIX", path ]
                  @@ -484,12 +477,12 @@ 

                   
                   
                  +503
                   504
                  -505
                  -506
                  +505

                  -
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 504
                  +      
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 503
                   
                   def path
                     Addrinfo.new(self.getsockname).unix_path
                  @@ -514,12 +507,12 @@ 

                   
                   
                  +507
                   508
                  -509
                  -510
                  +509

                  -
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 508
                  +      
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 507
                   
                   def peeraddr
                     [ "AF_UNIX", Addrinfo.new(self.getpeername).unix_path ]
                  @@ -540,7 +533,8 @@ 

                  -

                  def recv_io

                  + +

                  def recv_io

                  @@ -548,22 +542,22 @@

                  -
                  - +

                  +
                   
                   
                  +513
                   514
                   515
                   516
                  -517
                  -518
                  +517
                  -
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 514
                  +      
                  # File 'mrbgems/mruby-socket/mrblib/socket.rb', line 513
                   
                   def recvfrom(maxlen, flags=0)
                     msg, sa = _recvfrom(maxlen, flags)
                  @@ -579,11 +573,11 @@ 

                  - + diff --git a/docs/api/UnboundMethod.html b/docs/api/UnboundMethod.html deleted file mode 100644 index 541d1b3..0000000 --- a/docs/api/UnboundMethod.html +++ /dev/null @@ -1,1329 +0,0 @@ - - - - - - - Class: UnboundMethod - - — Documentation by YARD 0.9.20 - - - - - - - - - - - - - - - - - - - - - - - -
                  - - -

                  Class: UnboundMethod - - - -

                  -
                  - -
                  -
                  Inherits:
                  -
                  - Object - -
                    -
                  • Object
                  • - - - -
                  - show all - -
                  -
                  - - - - - - - - - - - -
                  -
                  Defined in:
                  -
                  mrbgems/mruby-method/src/method.c
                  -
                  - -
                  - - - - - - - - - -

                  - Instance Method Summary - collapse -

                  - - - - - - -
                  -

                  Instance Method Details

                  - - -
                  -

                  - - #==Object - - - - - -

                  - - - - -
                  -
                  -
                  -
                  -51
                  -52
                  -53
                  -54
                  -55
                  -56
                  -57
                  -58
                  -59
                  -60
                  -61
                  -62
                  -63
                  -64
                  -65
                  -66
                  -67
                  -68
                  -69
                  -70
                  -71
                  -72
                  -73
                  -74
                  -75
                  -76
                  -77
                  -78
                  -79
                  -80
                  -81
                  -82
                  -83
                  -84
                  -85
                  -86
                  -87
                  -88
                  -89
                  -90
                  -91
                  -92
                  -93
                  -94
                  -95
                  -96
                  -97
                  -98
                  -99
                  -100
                  -101
                  -102
                  -103
                  -104
                  -105
                  -106
                  -107
                  -
                  -
                  # File 'mrbgems/mruby-method/src/method.c', line 51
                  -
                  -static mrb_value
                  -method_eql(mrb_state *mrb, mrb_value self)
                  -{
                  -  mrb_value other, receiver, orig_proc, other_proc;
                  -  struct RClass *owner, *klass;
                  -  struct RProc *orig_rproc, *other_rproc;
                  -
                  -  mrb_get_args(mrb, "o", &other);
                  -  if (!mrb_obj_is_instance_of(mrb, other, mrb_class(mrb, self)))
                  -    return mrb_false_value();
                  -
                  -  if (mrb_class(mrb, self) != mrb_class(mrb, other))
                  -    return mrb_false_value();
                  -
                  -  klass = mrb_class_ptr(IV_GET(self, "_klass"));
                  -  if (klass != mrb_class_ptr(IV_GET(other, "_klass")))
                  -    return mrb_false_value();
                  -
                  -  owner = mrb_class_ptr(IV_GET(self, "_owner"));
                  -  if (owner != mrb_class_ptr(IV_GET(other, "_owner")))
                  -    return mrb_false_value();
                  -
                  -  receiver = IV_GET(self, "_recv");
                  -  if (!mrb_obj_equal(mrb, receiver, IV_GET(other, "_recv")))
                  -    return mrb_false_value();
                  -
                  -  orig_proc = IV_GET(self, "_proc");
                  -  other_proc = IV_GET(other, "_proc");
                  -  if (mrb_nil_p(orig_proc) && mrb_nil_p(other_proc)) {
                  -    if (mrb_symbol(IV_GET(self, "_name")) == mrb_symbol(IV_GET(other, "_name")))
                  -      return mrb_true_value();
                  -    else
                  -      return mrb_false_value();
                  -  }
                  -
                  -  if (mrb_nil_p(orig_proc))
                  -    return mrb_false_value();
                  -  if (mrb_nil_p(other_proc))
                  -    return mrb_false_value();
                  -
                  -  orig_rproc = mrb_proc_ptr(orig_proc);
                  -  other_rproc = mrb_proc_ptr(other_proc);
                  -  if (MRB_PROC_CFUNC_P(orig_rproc)) {
                  -    if (!MRB_PROC_CFUNC_P(other_rproc))
                  -      return mrb_false_value();
                  -    if (orig_rproc->body.func != other_rproc->body.func)
                  -      return mrb_false_value();
                  -  }
                  -  else {
                  -    if (MRB_PROC_CFUNC_P(other_rproc))
                  -      return mrb_false_value();
                  -    if (orig_rproc->body.irep != other_rproc->body.irep)
                  -      return mrb_false_value();
                  -  }
                  -
                  -  return mrb_true_value();
                  -}
                  -
                  -
                  - -
                  -

                  - - #arityObject - - - - - -

                  - - - - -
                  -
                  -
                  -
                  -238
                  -239
                  -240
                  -241
                  -242
                  -243
                  -244
                  -
                  -
                  # File 'mrbgems/mruby-method/src/method.c', line 238
                  -
                  -static mrb_value
                  -method_arity(mrb_state *mrb, mrb_value self)
                  -{
                  -  mrb_value proc = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_proc"));
                  -  mrb_int arity = mrb_nil_p(proc) ? -1 : mrb_proc_arity(mrb_proc_ptr(proc));
                  -  return mrb_fixnum_value(arity);
                  -}
                  -
                  -
                  - -
                  -

                  - - #bindObject - - - - - -

                  - - - - -
                  -
                  -
                  -
                  -28
                  -29
                  -30
                  -31
                  -32
                  -33
                  -34
                  -35
                  -36
                  -37
                  -38
                  -39
                  -40
                  -41
                  -42
                  -43
                  -44
                  -45
                  -46
                  -47
                  -48
                  -
                  -
                  # File 'mrbgems/mruby-method/src/method.c', line 28
                  -
                  -static mrb_value
                  -unbound_method_bind(mrb_state *mrb, mrb_value self)
                  -{
                  -  struct RObject *me;
                  -  mrb_value owner = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_owner"));
                  -  mrb_value name = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_name"));
                  -  mrb_value proc = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_proc"));
                  -  mrb_value klass = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_klass"));
                  -  mrb_value recv;
                  -
                  -  mrb_get_args(mrb, "o", &recv);
                  -  bind_check(mrb, recv, owner);
                  -  me = method_object_alloc(mrb, mrb_class_get(mrb, "Method"));
                  -  mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_owner"), owner);
                  -  mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_recv"), recv);
                  -  mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_name"), name);
                  -  mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_proc"), proc);
                  -  mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_klass"), klass);
                  -
                  -  return mrb_obj_value(me);
                  -}
                  -
                  -
                  - -
                  -

                  - - #bind_callObject - - - - - -

                  - - - - -
                  -
                  -
                  -
                  -152
                  -153
                  -154
                  -155
                  -156
                  -157
                  -158
                  -159
                  -160
                  -161
                  -162
                  -163
                  -164
                  -165
                  -
                  -
                  # File 'mrbgems/mruby-method/src/method.c', line 152
                  -
                  -static mrb_value
                  -method_bcall(mrb_state *mrb, mrb_value self)
                  -{
                  -  mrb_value proc = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_proc"));
                  -  mrb_value name = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_name"));
                  -  mrb_value recv = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_recv"));
                  -  mrb_value owner = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_owner"));
                  -  mrb_int argc;
                  -  mrb_value *argv, block;
                  -
                  -  mrb_get_args(mrb, "o*&", &recv, &argv, &argc, &block);
                  -  bind_check(mrb, recv, owner);
                  -  return mcall(mrb, recv, proc, name, mrb_class_ptr(owner), argc, argv, block);
                  -}
                  -
                  -
                  - -
                  -

                  - - #eql?Boolean - - - - - -

                  -
                  - - - -
                  -
                  -
                  - -

                  Returns:

                  -
                    - -
                  • - - - (Boolean) - - - -
                  • - -
                  - -
                  - - - - - - -
                  -
                  -
                  -
                  -51
                  -52
                  -53
                  -54
                  -55
                  -56
                  -57
                  -58
                  -59
                  -60
                  -61
                  -62
                  -63
                  -64
                  -65
                  -66
                  -67
                  -68
                  -69
                  -70
                  -71
                  -72
                  -73
                  -74
                  -75
                  -76
                  -77
                  -78
                  -79
                  -80
                  -81
                  -82
                  -83
                  -84
                  -85
                  -86
                  -87
                  -88
                  -89
                  -90
                  -91
                  -92
                  -93
                  -94
                  -95
                  -96
                  -97
                  -98
                  -99
                  -100
                  -101
                  -102
                  -103
                  -104
                  -105
                  -106
                  -107
                  -
                  -
                  # File 'mrbgems/mruby-method/src/method.c', line 51
                  -
                  -static mrb_value
                  -method_eql(mrb_state *mrb, mrb_value self)
                  -{
                  -  mrb_value other, receiver, orig_proc, other_proc;
                  -  struct RClass *owner, *klass;
                  -  struct RProc *orig_rproc, *other_rproc;
                  -
                  -  mrb_get_args(mrb, "o", &other);
                  -  if (!mrb_obj_is_instance_of(mrb, other, mrb_class(mrb, self)))
                  -    return mrb_false_value();
                  -
                  -  if (mrb_class(mrb, self) != mrb_class(mrb, other))
                  -    return mrb_false_value();
                  -
                  -  klass = mrb_class_ptr(IV_GET(self, "_klass"));
                  -  if (klass != mrb_class_ptr(IV_GET(other, "_klass")))
                  -    return mrb_false_value();
                  -
                  -  owner = mrb_class_ptr(IV_GET(self, "_owner"));
                  -  if (owner != mrb_class_ptr(IV_GET(other, "_owner")))
                  -    return mrb_false_value();
                  -
                  -  receiver = IV_GET(self, "_recv");
                  -  if (!mrb_obj_equal(mrb, receiver, IV_GET(other, "_recv")))
                  -    return mrb_false_value();
                  -
                  -  orig_proc = IV_GET(self, "_proc");
                  -  other_proc = IV_GET(other, "_proc");
                  -  if (mrb_nil_p(orig_proc) && mrb_nil_p(other_proc)) {
                  -    if (mrb_symbol(IV_GET(self, "_name")) == mrb_symbol(IV_GET(other, "_name")))
                  -      return mrb_true_value();
                  -    else
                  -      return mrb_false_value();
                  -  }
                  -
                  -  if (mrb_nil_p(orig_proc))
                  -    return mrb_false_value();
                  -  if (mrb_nil_p(other_proc))
                  -    return mrb_false_value();
                  -
                  -  orig_rproc = mrb_proc_ptr(orig_proc);
                  -  other_rproc = mrb_proc_ptr(other_proc);
                  -  if (MRB_PROC_CFUNC_P(orig_rproc)) {
                  -    if (!MRB_PROC_CFUNC_P(other_rproc))
                  -      return mrb_false_value();
                  -    if (orig_rproc->body.func != other_rproc->body.func)
                  -      return mrb_false_value();
                  -  }
                  -  else {
                  -    if (MRB_PROC_CFUNC_P(other_rproc))
                  -      return mrb_false_value();
                  -    if (orig_rproc->body.irep != other_rproc->body.irep)
                  -      return mrb_false_value();
                  -  }
                  -
                  -  return mrb_true_value();
                  -}
                  -
                  -
                  - -
                  -

                  - - #inspectObject - - - - - -

                  - - - - -
                  -
                  -
                  -
                  -287
                  -288
                  -289
                  -290
                  -291
                  -292
                  -293
                  -294
                  -295
                  -296
                  -297
                  -298
                  -299
                  -300
                  -301
                  -302
                  -303
                  -304
                  -305
                  -306
                  -307
                  -308
                  -309
                  -310
                  -311
                  -312
                  -313
                  -
                  -
                  # File 'mrbgems/mruby-method/src/method.c', line 287
                  -
                  -static mrb_value
                  -method_to_s(mrb_state *mrb, mrb_value self)
                  -{
                  -  mrb_value owner = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_owner"));
                  -  mrb_value klass = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_klass"));
                  -  mrb_value name = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_name"));
                  -  mrb_value str = mrb_str_new_lit(mrb, "#<");
                  -  struct RClass *rklass;
                  -
                  -  mrb_str_cat_cstr(mrb, str, mrb_obj_classname(mrb, self));
                  -  mrb_str_cat_lit(mrb, str, ": ");
                  -  rklass = mrb_class_ptr(klass);
                  -  if (mrb_class_ptr(owner) == rklass) {
                  -    mrb_str_concat(mrb, str, owner);
                  -    mrb_str_cat_lit(mrb, str, "#");
                  -    mrb_str_concat(mrb, str, name);
                  -  }
                  -  else {
                  -    mrb_str_cat_cstr(mrb, str, mrb_class_name(mrb, rklass));
                  -    mrb_str_cat_lit(mrb, str, "(");
                  -    mrb_str_concat(mrb, str, owner);
                  -    mrb_str_cat_lit(mrb, str, ")#");
                  -    mrb_str_concat(mrb, str, name);
                  -  }
                  -  mrb_str_cat_lit(mrb, str, ">");
                  -  return str;
                  -}
                  -
                  -
                  - -
                  -

                  - - #nameObject - - - - - -

                  - - - - -
                  -
                  -
                  -
                  -401
                  -402
                  -403
                  -404
                  -405
                  -
                  -
                  # File 'mrbgems/mruby-method/src/method.c', line 401
                  -
                  -static mrb_value
                  -method_name(mrb_state *mrb, mrb_value self)
                  -{
                  -  return mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_name"));
                  -}
                  -
                  -
                  - -
                  -

                  - - #ownerObject - - - - - -

                  - - - - -
                  -
                  -
                  -
                  -389
                  -390
                  -391
                  -392
                  -393
                  -
                  -
                  # File 'mrbgems/mruby-method/src/method.c', line 389
                  -
                  -static mrb_value
                  -method_owner(mrb_state *mrb, mrb_value self)
                  -{
                  -  return mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_owner"));
                  -}
                  -
                  -
                  - -
                  -

                  - - #parametersObject - - - - - -

                  - - - - -
                  -
                  -
                  -
                  -265
                  -266
                  -267
                  -268
                  -269
                  -270
                  -271
                  -272
                  -273
                  -274
                  -275
                  -276
                  -277
                  -278
                  -279
                  -280
                  -281
                  -282
                  -283
                  -284
                  -285
                  -
                  -
                  # File 'mrbgems/mruby-method/src/method.c', line 265
                  -
                  -static mrb_value
                  -method_parameters(mrb_state *mrb, mrb_value self)
                  -{
                  -  mrb_value proc = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_proc"));
                  -  struct RProc *rproc;
                  -  struct RClass *orig;
                  -  mrb_value ret;
                  -
                  -  if (mrb_nil_p(proc)) {
                  -    mrb_value rest = mrb_symbol_value(mrb_intern_lit(mrb, "rest"));
                  -    mrb_value arest = mrb_ary_new_from_values(mrb, 1, &rest);
                  -    return mrb_ary_new_from_values(mrb, 1, &arest);
                  -  }
                  -
                  -  rproc = mrb_proc_ptr(proc);
                  -  orig = rproc->c;
                  -  rproc->c = mrb->proc_class;
                  -  ret = mrb_funcall(mrb, proc, "parameters", 0);
                  -  rproc->c = orig;
                  -  return ret;
                  -}
                  -
                  -
                  - -
                  -

                  - - #source_locationObject - - - - - -

                  - - - - -
                  -
                  -
                  -
                  -246
                  -247
                  -248
                  -249
                  -250
                  -251
                  -252
                  -253
                  -254
                  -255
                  -256
                  -257
                  -258
                  -259
                  -260
                  -261
                  -262
                  -263
                  -
                  -
                  # File 'mrbgems/mruby-method/src/method.c', line 246
                  -
                  -static mrb_value
                  -method_source_location(mrb_state *mrb, mrb_value self)
                  -{
                  -  mrb_value proc = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_proc"));
                  -  struct RProc *rproc;
                  -  struct RClass *orig;
                  -  mrb_value ret;
                  -
                  -  if (mrb_nil_p(proc))
                  -    return mrb_nil_value();
                  -
                  -  rproc = mrb_proc_ptr(proc);
                  -  orig = rproc->c;
                  -  rproc->c = mrb->proc_class;
                  -  ret = mrb_funcall(mrb, proc, "source_location", 0);
                  -  rproc->c = orig;
                  -  return ret;
                  -}
                  -
                  -
                  - -
                  -

                  - - #super_methodObject - - - - - -

                  - - - - -
                  -
                  -
                  -
                  -197
                  -198
                  -199
                  -200
                  -201
                  -202
                  -203
                  -204
                  -205
                  -206
                  -207
                  -208
                  -209
                  -210
                  -211
                  -212
                  -213
                  -214
                  -215
                  -216
                  -217
                  -218
                  -219
                  -220
                  -221
                  -222
                  -223
                  -224
                  -225
                  -226
                  -227
                  -228
                  -229
                  -230
                  -231
                  -232
                  -233
                  -234
                  -235
                  -236
                  -
                  -
                  # File 'mrbgems/mruby-method/src/method.c', line 197
                  -
                  -static mrb_value
                  -method_super_method(mrb_state *mrb, mrb_value self)
                  -{
                  -  mrb_value recv = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_recv"));
                  -  mrb_value klass = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_klass"));
                  -  mrb_value owner = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_owner"));
                  -  mrb_value name = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_name"));
                  -  struct RClass *super, *rklass;
                  -  struct RProc *proc;
                  -  struct RObject *me;
                  -
                  -  switch (mrb_type(klass)) {
                  -    case MRB_TT_SCLASS:
                  -      super = mrb_class_ptr(klass)->super->super;
                  -      break;
                  -    case MRB_TT_ICLASS:
                  -      super = mrb_class_ptr(klass)->super;
                  -      break;
                  -    default:
                  -      super = mrb_class_ptr(owner)->super;
                  -      break;
                  -  }
                  -
                  -  proc = method_search_vm(mrb, &super, mrb_symbol(name));
                  -  if (!proc)
                  -    return mrb_nil_value();
                  -
                  -  rklass = super;
                  -  while (super->tt == MRB_TT_ICLASS)
                  -    super = super->c;
                  -
                  -  me = method_object_alloc(mrb, mrb_obj_class(mrb, self));
                  -  mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_owner"), mrb_obj_value(super));
                  -  mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_recv"), recv);
                  -  mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_name"), name);
                  -  mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_proc"), mrb_obj_value(proc));
                  -  mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_klass"), mrb_obj_value(rklass));
                  -
                  -  return mrb_obj_value(me);
                  -}
                  -
                  -
                  - -
                  -

                  - - #to_sObject - - - - - -

                  - - - - -
                  -
                  -
                  -
                  -287
                  -288
                  -289
                  -290
                  -291
                  -292
                  -293
                  -294
                  -295
                  -296
                  -297
                  -298
                  -299
                  -300
                  -301
                  -302
                  -303
                  -304
                  -305
                  -306
                  -307
                  -308
                  -309
                  -310
                  -311
                  -312
                  -313
                  -
                  -
                  # File 'mrbgems/mruby-method/src/method.c', line 287
                  -
                  -static mrb_value
                  -method_to_s(mrb_state *mrb, mrb_value self)
                  -{
                  -  mrb_value owner = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_owner"));
                  -  mrb_value klass = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_klass"));
                  -  mrb_value name = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_name"));
                  -  mrb_value str = mrb_str_new_lit(mrb, "#<");
                  -  struct RClass *rklass;
                  -
                  -  mrb_str_cat_cstr(mrb, str, mrb_obj_classname(mrb, self));
                  -  mrb_str_cat_lit(mrb, str, ": ");
                  -  rklass = mrb_class_ptr(klass);
                  -  if (mrb_class_ptr(owner) == rklass) {
                  -    mrb_str_concat(mrb, str, owner);
                  -    mrb_str_cat_lit(mrb, str, "#");
                  -    mrb_str_concat(mrb, str, name);
                  -  }
                  -  else {
                  -    mrb_str_cat_cstr(mrb, str, mrb_class_name(mrb, rklass));
                  -    mrb_str_cat_lit(mrb, str, "(");
                  -    mrb_str_concat(mrb, str, owner);
                  -    mrb_str_cat_lit(mrb, str, ")#");
                  -    mrb_str_concat(mrb, str, name);
                  -  }
                  -  mrb_str_cat_lit(mrb, str, ">");
                  -  return str;
                  -}
                  -
                  -
                  - -
                  - -
                  - - - -
                  - - \ No newline at end of file diff --git a/docs/api/UncaughtThrowError.html b/docs/api/UncaughtThrowError.html new file mode 100644 index 0000000..4a7fe9f --- /dev/null +++ b/docs/api/UncaughtThrowError.html @@ -0,0 +1,382 @@ + + + + + + + Exception: UncaughtThrowError + + — Documentation by YARD 0.9.37 + + + + + + + + + + + + + + + + + + + + + + + +
                  + + +

                  Exception: UncaughtThrowError + + + +

                  +
                  + +
                  +
                  Inherits:
                  +
                  + ArgumentError + +
                    +
                  • Object
                  • + + + + + + + +
                  + show all + +
                  +
                  + + + + + + + + + + + +
                  +
                  Defined in:
                  +
                  mrbgems/mruby-catch/mrblib/catch.rb
                  +
                  + +
                  + + + + + +

                  Instance Attribute Summary collapse

                  +
                    + +
                  • + + + #tag ⇒ Object + + + + + + + + + readonly + + + + + + + + + +
                    +

                    Returns the value of attribute tag.

                    +
                    + +
                  • + + +
                  • + + + #value ⇒ Object + + + + + + + + + readonly + + + + + + + + + +
                    +

                    Returns the value of attribute value.

                    +
                    + +
                  • + + +
                  + + + + + +

                  + Instance Method Summary + collapse +

                  + + + + + + + + + + + +
                  +

                  Constructor Details

                  + +
                  +

                  + + #initialize(tag, value) ⇒ UncaughtThrowError + + + + + +

                  +
                  + +

                  Returns a new instance of UncaughtThrowError.

                  + + +
                  +
                  +
                  + + +
                  + + + + + + +
                  +
                  +
                  +
                  +3
                  +4
                  +5
                  +6
                  +7
                  +
                  +
                  # File 'mrbgems/mruby-catch/mrblib/catch.rb', line 3
                  +
                  +def initialize(tag, value)
                  +  @tag = tag
                  +  @value = value
                  +  super("uncaught throw #{tag.inspect}")
                  +end
                  +
                  +
                  + +
                  + +
                  +

                  Instance Attribute Details

                  + + + +
                  +

                  + + #tagObject (readonly) + + + + + +

                  +
                  + +

                  Returns the value of attribute tag.

                  + + +
                  +
                  +
                  + + +
                  + + + + + + +
                  +
                  +
                  +
                  +2
                  +3
                  +4
                  +
                  +
                  # File 'mrbgems/mruby-catch/mrblib/catch.rb', line 2
                  +
                  +def tag
                  +  @tag
                  +end
                  +
                  +
                  + + + +
                  +

                  + + #valueObject (readonly) + + + + + +

                  +
                  + +

                  Returns the value of attribute value.

                  + + +
                  +
                  +
                  + + +
                  + + + + + + +
                  +
                  +
                  +
                  +2
                  +3
                  +4
                  +
                  +
                  # File 'mrbgems/mruby-catch/mrblib/catch.rb', line 2
                  +
                  +def value
                  +  @value
                  +end
                  +
                  +
                  + +
                  + + +
                  + + + +
                  + + \ No newline at end of file diff --git a/docs/api/FileTest.html b/docs/api/ZeroDivisionError.html similarity index 62% rename from docs/api/FileTest.html rename to docs/api/ZeroDivisionError.html index 8971ed1..d2046e1 100644 --- a/docs/api/FileTest.html +++ b/docs/api/ZeroDivisionError.html @@ -4,20 +4,20 @@ - Class: FileTest + Exception: ZeroDivisionError - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -40,10 +40,10 @@ -

                  Class: FileTest +

                  Exception: ZeroDivisionError @@ -73,12 +73,14 @@
                  Inherits:
                  - Object + StandardError
                  • Object
                  • - + + +
                  show all @@ -98,13 +100,23 @@
                  Defined in:
                  -
                  mrbgems/mruby-io/src/file_test.c
                  +
                  mrblib/10error.rb

                  +

                  Overview

                  +
                  + +

                  ISO 15.2.30

                  + +
                  +
                  +
                  + +
                  @@ -112,13 +124,17 @@ + + + +
                  - + diff --git a/docs/api/_index.html b/docs/api/_index.html index 8843b26..cc1a2ba 100644 --- a/docs/api/_index.html +++ b/docs/api/_index.html @@ -4,17 +4,17 @@ - Documentation by YARD 0.9.20 + Documentation by YARD 0.9.37 - + - + - + - @@ -56,7 +56,7 @@
                  -

                  Documentation by YARD 0.9.20

                  +

                  Documentation by YARD 0.9.37

                  Alphabetic Index

                  @@ -67,30 +67,78 @@

                  File Listing

                • README
                • -
                • AUTHORS
                • +
                • CONTRIBUTING
                • -
                • LICENSE
                • +
                • SECURITY
                • -
                • CONTRIBUTING
                • +
                • TODO
                • + + +
                • limitations
                • + + +
                • mruby3.0
                • + + +
                • mruby3.1
                • + + +
                • mruby3.2
                • + + +
                • mruby3.3
                • + + +
                • mruby3.4
                • compile
                • -
                • mrbgems
                • +
                • debugger
                • gc-arena-howto
                • -
                • debugger
                • +
                • hier
                • + + +
                • link
                • + + +
                • memory
                • mrbconf
                • +
                • mrbgems
                • + + +
                • symbol
                • + + +
                • boxing
                • + + +
                • opcode
                • + + +
                • AUTHORS
                • + + +
                • LEGAL
                • + + +
                • LICENSE
                • + + +
                • NEWS
                • + +
                  @@ -133,6 +181,11 @@

                  Namespace Listing A-Z

                • B
                • + + +

                  + +
                  • H
                    • @@ -290,9 +337,6 @@

                      Namespace Listing A-Z

                    -
                  - -
                  • I
                    • @@ -322,11 +366,6 @@

                      Namespace Listing A-Z

                      -
                    • - Integral - -
                    • -
                  @@ -401,16 +440,6 @@

                  Namespace Listing A-Z

                  -
                • - NilClass - -
                • - -
                • - NoMemoryError - -
                • -
                • NoMethodError @@ -439,13 +468,6 @@

                  Namespace Listing A-Z

                • -
                • - Option - - (Socket) - -
                • - @@ -463,15 +485,13 @@

                  Namespace Listing A-Z

                  +
                  + +
                  • R
                    • -
                    • - Random - -
                    • -
                    • Range @@ -496,15 +516,12 @@

                      Namespace Listing A-Z

                    -
                  - - @@ -566,16 +573,6 @@

                  Namespace Listing A-Z

                  -
                • - Time - -
                • - -
                • - TrueClass - -
                • -
                • TypeError @@ -605,7 +602,7 @@

                  Namespace Listing A-Z

                • - UnboundMethod + UncaughtThrowError
                • @@ -627,6 +624,19 @@

                  Namespace Listing A-Z

                  + + +
                  @@ -635,11 +645,11 @@

                  Namespace Listing A-Z

                  - + diff --git a/docs/api/class_list.html b/docs/api/class_list.html index 09bb080..6b25e1f 100644 --- a/docs/api/class_list.html +++ b/docs/api/class_list.html @@ -1,12 +1,12 @@ - + - + - + @@ -46,12 +46,15 @@

                  Class List

                  - + diff --git a/docs/api/css/full_list.css b/docs/api/css/full_list.css index fa35982..6eef5e4 100644 --- a/docs/api/css/full_list.css +++ b/docs/api/css/full_list.css @@ -20,8 +20,8 @@ h1 { padding: 12px 10px; padding-bottom: 0; margin: 0; font-size: 1.4em; } #content.insearch #noresults { margin-left: 7px; } li.collapsed ul { display: none; } li a.toggle { cursor: default; position: relative; left: -5px; top: 4px; text-indent: -999px; width: 10px; height: 9px; margin-left: -10px; display: block; float: left; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTM5jWRgMAAAAVdEVYdENyZWF0aW9uIFRpbWUAMy8xNC8wOeNZPpQAAAE2SURBVDiNrZTBccIwEEXfelIAHUA6CZ24BGaWO+FuzZAK4k6gg5QAdGAq+Bxs2Yqx7BzyL7Llp/VfzZeQhCTc/ezuGzKKnKSzpCxXJM8fwNXda3df5RZETlIt6YUzSQDs93sl8w3wBZxCCE10GM1OcWbWjB2mWgEH4Mfdyxm3PSepBHibgQE2wLe7r4HjEidpnXMYdQPKEMJcsZ4zs2POYQOcaPfwMVOo58zsAdMt18BuoVDPxUJRacELbXv3hUIX2vYmOUvi8C8ydz/ThjXrqKqqLbDIAdsCKBd+Wo7GWa7o9qzOQHVVVXeAbs+yHHCH4aTsaCOQqunmUy1yBUAXkdMIfMlgF5EXLo2OpV/c/Up7jG4hhHcYLgWzAZXUc2b2ixsfvc/RmNNfOXD3Q/oeL9axJE1yT9IOoUu6MGUkAAAAAElFTkSuQmCC) no-repeat bottom left; } -li.collapsed a.toggle { opacity: 0.5; cursor: default; background-position: top left; } -li { color: #888; cursor: pointer; } +li.collapsed a.toggle { cursor: default; background-position: top left; } +li { color: #666; cursor: pointer; } li.deprecated { text-decoration: line-through; font-style: italic; } li.odd { background: #f0f0f0; } li.even { background: #fafafa; } @@ -47,7 +47,7 @@ li small { display: block; font-size: 0.8em; } li small:before { content: ""; } li small:after { content: ""; } li small.search_info { display: none; } -#search { width: 170px; position: static; margin: 3px; margin-left: 10px; font-size: 0.9em; color: #888; padding-left: 0; padding-right: 24px; } +#search { width: 170px; position: static; margin: 3px; margin-left: 10px; font-size: 0.9em; color: #666; padding-left: 0; padding-right: 24px; } #content.insearch #search { background-position: center right; } #search input { width: 110px; } diff --git a/docs/api/css/style.css b/docs/api/css/style.css index 0bf7e2c..f169a65 100644 --- a/docs/api/css/style.css +++ b/docs/api/css/style.css @@ -52,6 +52,7 @@ body { background: #fff; padding: 1.2em; padding-top: 0.2em; + box-sizing: border-box; } @media (max-width: 920px) { @@ -81,6 +82,11 @@ body { #search { display: none; } } +@media (max-width: 320px) { + body { height: 100%; overflow: hidden; overflow-wrap: break-word; } + #main { height: 100%; overflow: auto; } +} + #main img { max-width: 100%; } h1 { font-size: 25px; margin: 1em 0 0.5em; padding-top: 4px; border-top: 1px dotted #d5d5d5; } h1.noborder { border-top: 0px; margin-top: 0; padding-top: 4px; } @@ -105,6 +111,7 @@ h2 small a { position: relative; padding: 2px 7px; } +a { font-weight: 550; } .clear { clear: both; } .inline { display: inline; } .inline p:first-child { display: inline; } @@ -422,8 +429,8 @@ li.r2 { background: #fafafa; } #toc ol { padding-left: 1.8em; } #toc li { font-size: 1.1em; line-height: 1.7em; } #toc > ol > li { font-size: 1.1em; font-weight: bold; } -#toc ol > ol { font-size: 0.9em; } -#toc ol ol > ol { padding-left: 2.3em; } +#toc ol > li > ol { font-size: 0.9em; } +#toc ol ol > li > ol { padding-left: 2.3em; } #toc ol + li { margin-top: 0.3em; } #toc.hidden { padding: 10px; background: #fefefe; box-shadow: none; } #toc.hidden:hover { background: #fafafa; } diff --git a/docs/api/file.AUTHORS.html b/docs/api/file.AUTHORS.html index 22e7aba..045adbf 100644 --- a/docs/api/file.AUTHORS.html +++ b/docs/api/file.AUTHORS.html @@ -6,17 +6,17 @@ File: AUTHORS - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -61,57 +61,29 @@
                  -

                  This is the (likely incomplete) list of “mruby developers”. -If you submit a patch to mruby, please add your name to the end -of this list.

                  - -

                  Yukihiro Matsumoto (Matz) - SCSK KYUSHU CORPORATION - Kyushu Institute of Technology - Network Applied Communication Laboratory, Inc. - Daniel Bovensiepen - Jon Maken - Bjorn De Meyer - Yuichiro MASUI - Masamitsu MURASE - Masaki Muranaka - Internet Initiative Japan Inc. - Tadashi FUKUZAWA - MATSUMOTO Ryosuke - Yasuhiro Matsumoto - Koji Yoshioka - Jun Hiroe - Narihiro Nakamura - Yuichi Nishiwaki - Tatsuhiko Kubo - Takeshi Watanabe - Yuki Kurihara - specified non-profit corporation mruby Forum - Kazuaki Tanaka - Hiromasa Ishii - Hiroshi Mimaki - Satoshi Odawara - Mitsubishi Electric Micro-Computer Application Software Co.,Ltd. - Ralph Desir(Mav7) - Hiroyuki Matsuzaki - Yuhei Okazaki - Manycolors, Inc. - Shota Nakano - Yuichi Osawa - Terence Lee - Zachary Scott - Tomasz Dąbrowski - Christopher Aue - Masahiro Wakame - YAMAMOTO Masaya - KOBAYASHI Shuji

                  +
                  +

                  Authors of mruby (mruby developers)

                  + +

                  The List of Contributors sorted by number of commits (as of 2025-03-01 8ba2ed6)

                  + +

                  6083 Yukihiro “Matz” Matsumoto (@matz)* 673 dearblue (@dearblue)* 587 KOBAYASHI Shuji (@shuujii) 353 Daniel Bovensiepen (@bovi)* 345 Takeshi Watanabe (@take-cheeze)* 333 Masaki Muranaka (@monaka) 234 Jun Hiroe (@suzukaze) 228 Tomoyuki Sahara (@tsahara)* 220 Cremno (@cremno)* 219 John Bampton (@jbampton) 209 Yuki Kurihara (@ksss)+ 144 Yasuhiro Matsumoto (@mattn)* 113 Carson McDonald (@carsonmcdonald) 104 Tomasz Pędraszewski (@dabroz)* 83 Akira Yumiyama (@akiray03)* 83 skandhas (@skandhas) 80 Masamitsu MURASE (@masamitsu-murase) 71 Tatsuhiko Kubo (@cubicdaiya)* 71 Yuichiro MASUI (@masuidrive) 69 Hiroshi Mimaki (@mimaki)* 62 Yuichiro Kaneko (@yui-knk)+ 59 Kurebayashi, Takahiro (@crimsonwoods)* 56 h2so5 (@h2so5) 52 Ralph Desir (@Mav7)* 48 Paolo Bosetti (@pbosetti)* 45 Rory O’Connell (@RoryO)* 42 fleuria (@flaneur2020) 40 Christopher Aue (@christopheraue) 40 Seba Gamboa (@sagmor) 39 Kouhei Sutou (@kou)* 38 Koji Yoshioka (@kyab)+ 32 Masayoshi Takahashi (@takahashim)+ 31 MATSUMOTO Ryosuke (@matsumotory) 30 Nobuyoshi Nakada (@nobu) 26 Hoshiumi Arata (@hoshiumiarata)* 25 Julian Aron Prenner (@furunkel)* 22 Clayton Smith (@clayton-shopify) 22 Uchio Kondo (@udzura)* 22 Zachary Scott (@zzak)* 21 Ryan Lopopolo (@lopopolo) 20 Ryan Scott (@ryan-scott-dev)* 19 Bouke van der Bijl (@bouk) 19 Jared Breeden (@jbreeden)* 19 go kikuta (@gkta)* 18 Corey Powell (@IceDragon200) 18 Hidetaka Takano (@TJ-Hidetaka-Takano) 18 Jon Maken (@jonforums)+ 18 mirichi (@mirichi) 17 Mitchell Blank Jr (@mitchblank)* 16 bggd (@bggd) 16 kano4 (@kano4) 15 Felix Jones (@felixjones)* 14 Blaž Hrastnik (@archseer)* 14 Kazuki Tsujimoto (@k-tsj) 14 Tadashi FUKUZAWA (@FUKUZAWA-Tadashi)+ 14 fn ⌃ ⌥ (@FnControlOption) 14 leviongit (@leviongit) 13 Jose Narvaez (@goyox86) 13 Patrick Hogan (@pbhogan) 12 Akira Kuroda (@akuroda) 12 Kouki Ooyatsu (kaishuu0123)* 12 NAKAMURA Usaku (@unak)* 12 Ray Chason (@chasonr)* 12 Takashi Sawanaka (@sdottaka)* 12 Ukrainskiy Sergey (@ukrainskiysergey) 12 Xuejie “Rafael” Xiao (@xxuejie)* 11 Julien Ammous (@schmurfy) 11 Kazuho Oku (@kazuho) 11 RIZAL Reckordp (@Reckordp)+ 11 Seeker (@SeekingMeaning) 11 takkaw (@takkaw) 10 Miura Hideki (@miura1729) 10 Narihiro Nakamura (@authorNari) 10 YAMAMOTO Masaya (pandax381) 10 Yuichi Nishiwaki (@nyuichi) 9 Akira Mitsui (@murasesyuka)* 9 Frank Celler (@fceller) 9 Tatsuya Matsumoto (@tmash06)* 8 Takashi Sogabe (@sogabe) 8 Wataru Ashihara (@wataash)* 7 Bhargava Shastry (@bshastry)* 7 Kouichi Nakanishi (@keizo042) 7 Rubyist (@expeditiousRubyist) 7 SiZiOUS (@sizious) 7 Simon Génier (@simon-shopify) 7 Terence Lee (@hone) 7 roco (@rystyle)* 6 Akito Mochizuki (@ak-mochi) 6 Beoran (@beoran) 6 David Siaw (@davidsiaw)* 6 Frederick John Milens III (@fjmilens3) 6 Hiro Asari (@BanzaiMan) 6 INOUE Yasuyuki (@yasuyuki) 6 Junji Sawada (@junjis0203) 6 Kenji Okimoto (@okkez)+ 6 Selman ULUG (@selman) 6 Yusuke Endoh (@mame)* 6 masahino (@masahino) 5 Chris Reuter (@suetanvil) 5 Davide D’Agostino (@DAddYE) 5 Eric Hodel (@drbrain) 5 Hendrik (@Asmod4n) 5 Ichito Nagata (@i110) 5 Keita Obo (@ktaobo)* 5 Max Anselm (@silverhammermba) 5 Rodrigo Malizia (@rmalizia44)+ 5 Syohei YOSHIDA (@syohex) 5 TOMITA Masahiro (@tmtm) 5 Yurie Yamane (@yurie)+ 5 dreamedge (@dreamedge) 5 nkshigeru (@nkshigeru) 5 vickash (@vickash) 5 xuejianqing (@joans321) 4 Dante Catalfamo (@dantecatalfamo) 4 Goro Kikuchi (@gorogit) 4 HASUMI Hitoshi (@hasumikin) 4 Herwin Weststrate (@herwinw) 4 Horimoto Yasuhiro (@komainu8) 4 Jon Moss (@maclover7) 4 Ken Muramatsu (@ken-mu)+ 4 Kohei Suzuki (@eagletmt) 4 Lanza (@LanzaSchneider) 4 Li Yazhou (@flaneur2020) 4 Marcus Stollsteimer (@stomar) 4 NARUSE, Yui (@nurse) 4 Ravil Bayramgalin (@brainopia)+ 4 Satoshi Odawara (@SatoshiOdawara) 4 Yuhei Okazaki (@Yuuhei-Okazaki) 4 Yuji Yamano (@yyamano) 4 kurodash (@kurodash)* 4 wanabe (@wanabe)* 3 Anton Davydov (@davydovanton) 3 Aurora Nockert (@auroranockert) 3 Carlo Prelz (@asfluido)* 3 Daniel K. Sierpiński (@513ry)+ 3 David Turnbull (@AE9RB) 3 Franck Verrot (@franckverrot) 3 J. Mutua (@katmutua)+ 3 Jan Berdajs (@mrbrdo) 3 Jonas Minnberg (@sasq64) 3 Joseph McCullough (@joequery) 3 Mark Delk (@jethrodaniel) 3 Mark McCurry (@fundamental) 3 Nobuhiro Iwamatsu (@iwamatsu) 3 Per Lundberg (@perlun)* 3 Rob Fors (@robfors)* 3 Robert Rowe (@CaptainJet) 3 Sebastián Katzer (@katzer)* 3 Shuta Kimura (@kimushu)+ 3 TERAJIMA, Motoyuki (@trmmy) 3 Taichi AOKI (@aoki1980taichi) 3 Takashi Kokubun (@k0kubun) 3 Tatsuhiro Tsujikawa (@tatsuhiro-t) 3 Thiago Scalone (@scalone) 3 Vladimir Dementyev (@palkan)* 3 William Light (@wrl) 3 bamchoh (@bamchoh) 3 sasaki takeru (@takeru) 3 windwiny (@windwiny) 2 Akira Moroo (@retrage) 2 Artur K (@nemerle) 2 Christian Mauceri (@mauceri) 2 Craig Lehmann (@craiglrock)* 2 Dominic Sisneros (@dsisnero)* 2 Dusan D. Majkic (@dmajkic) 2 Emiliano Lesende (@3miliano) 2 Francois Chagnon (@EiNSTeiN-)* 2 Gilad Zohari (@gzohari) 2 Go Saito (@govm) 2 Hirohito Higashi (@HirohitoHigashi) 2 Hiroyuki Iwatsuki (@iwadon) 2 Huei-Horng Yo (@hiroshiyui) 2 Jonas Kulla (@Ancurio) 2 Jun Takeda (@takjn) 2 Kazuaki Tanaka (@kaz0505) 2 Kazuhiko Yamashita (@pyama86)+ 2 Kazuhiro Sera (@seratch) 2 Kuroda Daisuke (@dycoon)+ 2 Lothar Scholz (@llothar) 2 Lukas Joeressen (@kext) 2 Masahiro Wakame (@vvkame)+ 2 Minao Yamamoto (@tarosay)+ 2 Nihad Abbasov (@NARKOZ) 2 Robert Mosolgo (@rmosolgo) 2 Russel Hunter Yukawa (@rhykw)+ 2 Ryunosuke SATO (@tricknotes) 2 Santa Zhang (@santazhang) 2 Serg Podtynnyi (@shtirlic) 2 Shannen Saez (@shancat) 2 Shouji Kuboyama (@Shokuji)* 2 SouthWolf (@southwolf) 2 TJ Singleton (@tjsingleton) 2 Taiyo Mizuhashi (@taiyoslime)+ 2 Tomás Pollak (@tomas)* 2 Yutaka HARA (@yhara)*+ 2 Zhang Xiaohui (@hifoolno) 2 buty4649 (@buty4649) 2 icm7216 (@icm7216) 1 A-Sat (@asatou)+ 1 Abinoam Praxedes Marques Junior (@abinoam) 1 Alex Wang (@nanamiwang)+ 1 AlexDenisov (@AlexDenisov) 1 Andrew Nordman (@cadwallion) 1 Ashish Kurmi (@boahc077) 1 Atsushi Morimoto (@mynz) 1 Ben A Morgan (@BenMorganIO) 1 Benoit Daloze (@eregon) 1 Colin MacKenzie IV (@sinisterchipmunk) 1 Daehyub Kim (@lateau) 1 Daniel Varga (@vargad) 1 Diamond Rivero (@diamant3) 1 Edgar Boda-Majer (@eboda) 1 Fangrui Song (@MaskRay) 1 Flavio Medeiros (@flaviommedeiros) 1 Francis Bogsanyi (@fbogsany) 1 Guo Xiao (@guoxiao) 1 Gwen Boatrite (@boatrit) 1 Gwendolyn Boatrite (@boatrite) 1 HARADA Makoto (@haramako) 1 HAYASHI Kentaro (@kenhys) 1 Hiroki Mori (@yamori813)+ 1 Hiromasa Ishii (@Hir0)+ 1 Hiroyuki Matsuzaki (@Hiroyuki-Matsuzaki) 1 Hugo Logmans (@hlogmans) 1 Jack Danger Canty (@JackDanger) 1 Jeff Federman (@jefffederman) 1 Jeffrey Crowell (@crowell) 1 Jeremy Ong (@jeremyong) 1 Jiro Nishiguchi (@spiritloose) 1 Joachim Baran (@indiedotkim) 1 Joe Kutner (@jkutner) 1 Jun Aruga (@junaruga) 1 Junichi Kajiwara (@kjunichi) 1 Jurriaan Pruis (@jurriaan) 1 Katsuhiko Kageyama (@kishima)+ 1 Katsuyoshi Ito (@katsuyoshi) 1 Kazuhiro NISHIYAMA (@znz) 1 Kei Sawada (@remore) 1 Kim H Madsen (@kimhmadsen) 1 Koichi ITO (@koic) 1 Konstantin Haase (@rkh) 1 Leo Neat (@Leo-Neat) 1 Lian Cheng (@liancheng) 1 Luis Lavena (@luislavena) 1 Lukas Elmer (@lukaselmer) 1 Lukas Stabe (@Ahti) 1 M.Naruoka (@fenrir-naru) 1 Marcelo Juchem (@juchem) 1 Martin Bosslet (@emboss)+ 1 Masahiko Sawada (@MasahikoSawada) 1 Matt Aimonetti (@mattetti) 1 Max Base (@MaxFork) 1 Maxim Abramchuk (@MaximAbramchuck) 1 Megumi Tomita (@tomykaira)+ 1 Mitchell Hashimoto (@mitchellh) 1 Mitsutaka Mimura (@takkanm) 1 Nathan Ladd (@ntl) 1 Nicholas (@knf) 1 Nozomi SATO (@nozomiS) 1 Okumura Takahiro (@hfm) 1 Patrick Ellis (@pje) 1 Patrick Pokatilo (@SHyx0rmZ) 1 Pavel Evstigneev (@Paxa)+ 1 Pete Kinnecom (@petekinnecom) 1 Prayag Verma (@pra85) 1 Ranmocy (@ranmocy) 1 Robert McNally (@wolfmcnally) 1 Ryan Scott Lewis (@RyanScottLewis) 1 Ryo Okubo (@syucream) 1 SAkira a.k.a. Akira Suzuki (@sakisakira) 1 Santiago Rodriguez (@sanrodari) 1 Satoh, Hiroh (@cho45)+ 1 Satoru Naba (@snaba)+ 1 Sayed Abdelhaleem (@visualsayed) 1 Sergey Ukrainskiy (@ukrainskiysergey) 1 Shugo Maeda (@shugo) 1 Sinkevich Artem (@ArtSin) 1 Sorah Fukumori (@sorah) 1 Stephen Jothen (@sjothen) 1 Stuart Hinson (@stuarth) 1 Takuma Kume (@takumakume)+ 1 Takuya ASADA (@syuu1228) 1 Thomas Schmidt (@digitaltom) 1 Timo Schilling (@timoschilling) 1 Tom Black (@blacktm) 1 Utkarsh Kukreti (@utkarshkukreti) 1 W (@graywolf) 1 Wuffers Lightwolf (@w-x-l) 1 YAMAMOTO Yuji (@igrep) 1 Yevhen Viktorov (@yevgenko) 1 Yoji SHIDARA (@darashi) 1 Yoshiori SHOJI (@yoshiori) 1 Yuji Yokoo (@yujiyokoo) 1 Yukang (@chenyukang) 1 Yurii Nakonechnyi (@inobelar) 1 Yusuke Suzuki (@Constellation)+ 1 Yusuke Tanaka (@csouls) 1 alpha.netzilla (@alpha-netzilla) 1 arton (@arton) 1 duangsuse (@duangsuse) 1 fl0l0u (@fl0l0u) 1 hhc0null (@hhc0null) 1 iTitou (@titouanc) 1 javier ramírez (@javier) 1 liyuray (@liyuray) 1 lucas dicioccio (@lucasdicioccio) 1 n4o847 (@n4o847) 1 niyarin (@niyarin) 1 robert (@R-obert) 1 sbsoftware (@sbsoftware) 1 ssmallkirby (@smallkirby) 1 taku toyama (@tsuichu)

                  + +

                  * - Entries unified according to names and addresses + - Entries with names different from commits

                  + +

                  Contributors without named commits

                  + +

                  Yuichi Osawa (Mitsubishi Electric Micro-Computer Application Software) Shota Nakano (Manycolors) Bjorn De Meyer

                  + +

                  Corporate contributors

                  + +

                  Ministry of Economy, Trade and Industry, Japan Kyushu Bureau of Economy, Trade and Industry SCSK KYUSHU CORPORATION Kyushu Institute of Technology Network Applied Communication Laboratory, Inc. Internet Initiative Japan Inc. Specified non-profit organization mruby Forum Mitsubishi Electric Micro-Computer Application Software Co.,Ltd. Manycolors, Inc.

                  - +
                  diff --git a/docs/api/file.CONTRIBUTING.html b/docs/api/file.CONTRIBUTING.html index c50cd5f..6da3519 100644 --- a/docs/api/file.CONTRIBUTING.html +++ b/docs/api/file.CONTRIBUTING.html @@ -6,17 +6,17 @@ File: CONTRIBUTING - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -61,68 +61,154 @@
                  -

                  How to contribute

                  +
                  +

                  How to contribute

                  -

                  mruby is an open-source project which is looking forward to each contribution.

                  +

                  mruby is an open-source project which is looking forward to each contribution. Contributors agree to license their contribution(s) under MIT license.

                  -

                  Your Pull Request

                  +

                  Your Pull Request

                  -

                  To make it easy to review and understand your change please keep the following -things in mind before submitting your pull request:

                  +

                  To make it easy to review and understand your change please keep the following things in mind before submitting your pull request:

                  +
                  • +

                    Work on the latest possible state of mruby/master

                    +
                  • +

                    Create a branch which is dedicated to your change

                    +
                  • +

                    Test your changes before creating a pull request (rake test)

                    +
                  • +

                    If possible write a test case which confirms your change

                    +
                  • +

                    Don’t mix several features or bug-fixes in one pull request

                    +
                  • +

                    Create a meaningful commit message

                    +
                  • +

                    Explain your change (i.e. with a link to the issue you are fixing)

                    +
                  • +

                    Use mrbgem to provide non ISO features (classes, modules and methods) unless you have a special reason to implement them in the core

                    +
                  -
                    -
                  • Work on the latest possible state of mruby/master
                  • -
                  • Create a branch which is dedicated to your change
                  • -
                  • Test your changes before creating a pull request (./minirake test)
                  • -
                  • If possible write a test case which confirms your change
                  • -
                  • Don’t mix several features or bug-fixes in one pull request
                  • -
                  • Create a meaningful commit message
                  • -
                  • Explain your change (i.e. with a link to the issue you are fixing)
                  • -
                  • Use mrbgem to provide non ISO features (classes, modules and methods) unless -you have a special reason to implement them in the core
                  • -
                  +

                  pre-commit

                  -

                  Coding conventions

                  +

                  A framework for managing and maintaining multi-language pre-commit hooks. pre-commit can be installed with pip, curl, brew or conda.

                  -

                  How to style your C and Ruby code which you want to submit.

                  +

                  You need to first install pre-commit and then install the pre-commit hooks with pre-commit install. Now pre-commit will run automatically on git commit!

                  -

                  C code

                  +

                  It’s usually a good idea to run the hooks against all the files when adding new hooks (usually pre-commit will only run on the changed files during git hooks). Use pre-commit run --all-files to check all files.

                  -

                  The core part (parser, bytecode-interpreter, core-lib, etc.) of mruby is -written in the C programming language. Please note the following hints for your -C code:

                  +

                  To run a single hook use pre-commit run --all-files <hook_id>

                  -

                  Comply with C99 (ISO/IEC 9899:1999)

                  +

                  To update use pre-commit autoupdate

                  -

                  mruby should be highly portable to other systems and compilers. For this it is -recommended to keep your code as close as possible to the C99 standard -(http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf).

                  +

                  Sometimes you might need to skip one or more hooks which can be done with the SKIP environment variable.

                  -

                  Although we target C99, we’ve heard some compilers in the embedded environment -still requires declarations of local variables to be at the beginning of a -scope. Until we confirm the situation has changed, we use the old-style -variable declaration.

                  +

                  $ SKIP=yamllint git commit -m "foo"

                  -

                  Visual C++ is also an important target for mruby (supported version is 2013 or -later). For this reason features that are not supported by Visual C++ may not -be used (e.g. %z of strftime()).

                  +

                  For convenience, we have added pre-commit run --all-files, pre-commit install and pre-commit autoupdate to both the Makefile and the Rakefile. Run them with:

                  +
                  • +

                    make check or rake check

                    +
                  • +

                    make checkinstall or rake checkinstall

                    +
                  • +

                    make checkupdate or rake checkupdate

                    +
                  -

                  NOTE: Old GCC requires -std=gnu99 option to enable C99 support.

                  +

                  To configure pre-commit you can modify the config file .pre-commit-config.yaml. We use GitHub Actions to run pre-commit on every pull request.

                  + + + + +

                  Docker

                  + +

                  We have both a Dockerfile and docker-compose.yml files in the repository root. You can run these with the command line or use Docker Desktop.

                  + +

                  The Docker image is running Debian bullseye with Ruby and Python installed. You can build the Docker image with:

                  + +

                  $ docker-compose build test

                  + +

                  So far we just have one service: test. Running the default docker-compose command will create the Docker image, spin up a container and then build and run all mruby tests.

                  + +

                  The default docker-compose command is:

                  -

                  Reduce library dependencies to a minimum

                  +

                  $ docker-compose -p mruby run test

                  -

                  The dependencies to libraries should be kept to an absolute minimum. This -increases the portability but makes it also easier to cut away parts of mruby -on-demand.

                  +

                  You can also use Make or Rake to run the default docker-compose command from above:

                  +
                  • +

                    make composetest

                    +
                  • +

                    rake composetest

                    +
                  -

                  Don’t use C++ style comments

                  +

                  List your Docker images with:

                  -
                  /* This is the preferred comment style */
                  +
                  $ docker images
                  +REPOSITORY   TAG       IMAGE ID       CREATED          SIZE
                  +mruby-test   latest    ec60f9536948   29 seconds ago   1.29GB
                   
                  -

                  Use C++ style comments only for temporary comment e.g. commenting out some code lines.

                  +

                  You can also run any custom docker-compose command which will override the default. For example to run pre-commit run --all-files type:

                  + +

                  $ docker-compose -p mruby run test pre-commit run --all-files

                  + +

                  For convenience, you can also run pre-commit with:

                  +
                  • +

                    make composecheck

                    +
                  • +

                    rake composecheck

                    +
                  + +

                  The bonus of running pre-commit with docker-compose is that you won’t need to install pre-commit and the hooks on your local machine. And that also means you won’t need to install brew, conda or pip.

                  + +

                  Note limitation: currently running pre-commit with docker-compose we skip the check-executables-have-shebangs hook.

                  + +

                  Two more examples of custom docker-compose commands are:

                  +
                  • +

                    $ docker-compose -p mruby run test ls

                    +
                  • +

                    $ docker-compose -p mruby run test rake doc:api

                    +
                  + +

                  If you want to test using a different docker-compose YAML config file you can use the -f flag:

                  + +

                  $ docker-compose -p mruby -f docker-compose.test.yml run test

                  + + +

                  Spell Checking

                  -

                  Insert a break after the method return value:

                  +

                  We are using pre-commit to run codespell to check code for common misspellings. We have a small custom dictionary file codespell.txt.

                  + +

                  Coding conventions

                  + +

                  How to style your C and Ruby code which you want to submit.

                  + +

                  C code

                  + +

                  The core part (parser, bytecode-interpreter, core-lib, etc.) of mruby is written in the C programming language. Please note the following hints for your C code:

                  + +

                  Comply with C99 (ISO/IEC 9899:1999)

                  + +

                  mruby should be highly portable to other systems and compilers. For this it is recommended to keep your code as close as possible to the C99 standard (www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf).

                  + +

                  Visual C++ is also an important target for mruby (supported version is 2013 or later). For this reason features that are not supported by Visual C++ may not be used (e.g. %z of strftime()).

                  + +

                  NOTE: Old GCC requires -std=gnu99 option to enable C99 support.

                  + +

                  Reduce library dependencies to a minimum

                  + +

                  The dependencies to libraries should be kept to an absolute minimum. This increases the portability but makes it also easier to cut away parts of mruby on-demand.

                  + +

                  Insert a break after the function return value:

                  int
                   main(void)
                  @@ -131,22 +217,38 @@ 

                  Insert a break after the m }

                  -

                  Ruby code

                  +

                  Ruby code

                  -

                  Parts of the standard library of mruby are written in the Ruby programming -language itself. Please note the following hints for your Ruby code:

                  +

                  Parts of the standard library of mruby are written in the Ruby programming language itself. Please note the following hints for your Ruby code:

                  -

                  Comply with the Ruby standard (ISO/IEC 30170:2012)

                  +

                  Comply with the Ruby standard (ISO/IEC 30170:2012)

                  -

                  mruby is currently targeting to execute Ruby code which complies to ISO/IEC -30170:2012 (http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=59579).

                  +

                  mruby is currently targeting to execute Ruby code which complies to ISO/IEC 30170:2012 (www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=59579), unless there’s a clear reason, e.g. the latest Ruby has changed behavior from ISO.

                  + +

                  Building documentation

                  + +

                  mruby API

                  +
                  • +

                    YARD - YARD is a documentation generation tool for the Ruby programming language

                    +
                  • +

                    yard-mruby - Document mruby sources with YARD

                    +
                  • +

                    yard-coderay - Adds coderay syntax highlighting to YARD docs

                    +
                  + +

                  C API

                  +
                  • +

                    Doxygen - Generate documentation from source code

                    +
                  • +

                    Graphviz - Graphviz is open source graph visualization software

                    +
                  - +
                  diff --git a/docs/api/file.LEGAL.html b/docs/api/file.LEGAL.html new file mode 100644 index 0000000..7be5265 --- /dev/null +++ b/docs/api/file.LEGAL.html @@ -0,0 +1,116 @@ + + + + + + + File: LEGAL + + — Documentation by YARD 0.9.37 + + + + + + + + + + + + + + + + + + + + + + + +
                  + + +
                  +

                  LEGAL NOTICE INFORMATION

                  + +

                  All the files in this distribution are covered under the MIT license (see the file LICENSE) except some files mentioned below:

                  +
                  • +

                    src/string.c (memsearch_swar): 2 clause BSD license code by Wojciech Muła (@WojciechMula)

                    +
                  • +

                    src/fmt_fp.c: public domain by Dave Hylands (@dhylands)

                    +
                  • +

                    mrbgems/mruby-dir/src/Win/dirent.c: MIT-like license by Kevlin Henney

                    +
                  + +

                  [src/string.c] The implementation of mrb_memsearch_ss() is taken from github.com/WojciechMula/sse4-strstr.git

                  + +

                  Copyright © 2008-2016, Wojciech Muła All rights reserved.

                  + +

                  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

                  +
                  1. +

                    Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

                    +
                  2. +

                    Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

                    +
                  + +

                  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

                  + +

                  [src/fmt_fp.c]

                  + +

                  The code in this function was inspired from Fred Bayer’s pdouble.c. Since pdouble.c was released as Public Domain, I’m releasing this code as public domain as well.

                  + +

                  Dave Hylands

                  + +

                  The original code can be found in github.com/dhylands/format-float

                  + +

                  [mrbgems/mruby-dir/src/Win/dirent.c] used only for Windows platform

                  + +

                  Copyright Kevlin Henney, 1997, 2003, 2012. All rights reserved.

                  + +

                  Permission to use, copy, modify, and distribute this software and its documentation for any purpose is hereby granted without fee, provided that this copyright and permissions notice appear in all copies and derivatives.

                  + +

                  This software is supplied “as is” without express or implied warranty.

                  + +

                  But that said, if there are any problems please get in touch.

                  +
                  + + + +
                  + + \ No newline at end of file diff --git a/docs/api/file.LICENSE.html b/docs/api/file.LICENSE.html index 32e0ae2..adcfc86 100644 --- a/docs/api/file.LICENSE.html +++ b/docs/api/file.LICENSE.html @@ -6,17 +6,17 @@ File: LICENSE - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -61,32 +61,21 @@
                  -

                  Copyright (c) 2019 mruby developers

                  - -

                  Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the “Software”), -to deal in the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions:

                  - -

                  The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software.

                  - -

                  THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE.

                  +
                  +

                  Copyright © 2010- mruby developers

                  + +

                  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

                  + +

                  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

                  + +

                  THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

                  - +
                  diff --git a/docs/api/file.NEWS.html b/docs/api/file.NEWS.html new file mode 100644 index 0000000..14bcc0b --- /dev/null +++ b/docs/api/file.NEWS.html @@ -0,0 +1,558 @@ + + + + + + + File: NEWS + + — Documentation by YARD 0.9.37 + + + + + + + + + + + + + + + + + + + + + + + +
                  + + +
                  +

                  NEWS

                  + +

                  User visible changes in mruby3.4 from mruby3.3

                  + +

                  NOTE:” are changes to be aware of.

                  + +

                  The language

                  +
                  • +

                    mruby now supports private and protected visibitily (b0db0bd)

                    +
                  • +

                    Maximum length of inlined symbols reduced from 5 to 4 characters to provide space for visibility flags (6442a01)

                    +
                  • +

                    Many methods are made private according to CRuby visibility (4a0e806)

                    +
                  • +

                    Generate OP_SSEND for self.method type calls (111fe4b)

                    +
                  • +

                    initialize method will be always private (eb8b412)

                    +
                  • +

                    Add new hooks method_removed, method_undefined (9c74f6e)

                    +
                  • +

                    Add new hooks singleton_method_removed, singleton_method_undefined (0863c08)

                    +
                  • +

                    Updated OP_DEF output from codedump (3a3e877)

                    +
                  • +

                    Better handling of binary strings, e.g. String#b (b0127f0)

                    +
                  • +

                    Hash to_s format has changed (baeeb5e)

                    +
                  • +

                    Some encoding related method such as #force_encoding (e47b4ca), #b (b0127f0)

                    +
                  • +

                    Constant folding for String#+ (6687bdd)

                    +
                  • +

                    Remove Float bit-operation (db8368f)

                    +
                  • +

                    use SWAR technique for strlen performance (cbb31e6)

                    +
                  • +

                    use merge sort for Array#sort (5bd63d6)

                    +
                  + +

                  Changes in C API

                  +
                  • +

                    pool.c renamed to mempool.c (and mrb_pool to mrb_mempool) (49525fa)

                    +
                  • +

                    mrb_pool_value renamed to mrb_irep_pool to reduce confusion (62ef5db)

                    +
                  • +

                    rename BOXNIX_SET_VALUE to BOXNO_SET_VALUE (#6397)

                    +
                  • +

                    MRB_FROZEN_P() is replaced by mrb_frozen_p() (c11d18e)

                    +
                  • +

                    rename color to gc_color (0e79f6b, 1e36d76)

                    +
                  • +

                    add obj->frozen instead of flags MRB_SET_FROZEN_FLAG/MRB_UNSET_FROZEN_FLAG (8276143)

                    +
                  + +

                  Build & Configuration

                  +
                  • +

                    New Build Target: test:run:serial, test:run:serial:lib, test:run:serial:bin (#6423)

                    +
                  • +

                    New Platform: Playstation Portable (#6022)

                    +
                  • +

                    New Platform: emscripten (#6487)

                    +
                  • +

                    New Config: no-float (with MRB_NO_FLOAT) (32200f1)

                    +
                  + +

                  Changes in mrbgems

                  +
                  • +

                    mruby-print: removed; if you do not use mruby-io, mruby use #print etc. in the core (8c8bbd9)

                    +
                  • +

                    mruby-enum-lazy: Add Enumerable::Lazy#grep_v to mruby-enum-lazy (#6171)

                    +
                  • +

                    mruby-io: Add level argument to File.dirname (#6463)

                    +
                  • +

                    mruby-io: File.absolute_path? (#6482)

                    +
                  • +

                    mruby-io: File.absolute_path (96113a2)

                    +
                  • +

                    mruby-toplevel-ext: top-level public/private/protected moved to the core (2a876d2)

                    +
                  • +

                    mruby-metaprog: method list methods now works according to the visibility (9229da1)

                    +
                  • +

                    mruby-metaprog: public_instance_methods, private_instance_methods, protected_instance_methods (9e3e7b2)

                    +
                  • +

                    mruby-encoding: MRB_UTF8_STRING turned on automatically with this gem (74bdae9)

                    +
                  + +

                  Fixed GitHub Issues

                  +
                  • +

                    #6173 Fails to build with tcc(Tiny C Compiler)

                    +
                  • +

                    #6156 ‘/LIBPATH’ issue

                    +
                  • +

                    #6183 “.e”.to_f returns NAN

                    +
                  • +

                    #6182 mrb_read_float() converts “0.3” with a small error compared to strtod()

                    +
                  • +

                    #6210 Unary minus seems broken

                    +
                  • +

                    #6255 Wrong number of characters in broken UTF-8 string

                    +
                  • +

                    #4038 Heap buffer overflow in OP_ENTER

                    +
                  • +

                    #6262 Unable to define == for objects when using Array#delete

                    +
                  • +

                    #6267 When MRB_UTF8_STRING is enabled, giving byte characters for String#index and String#split gives wrong results

                    +
                  • +

                    #6277 MSVC: can’t use malloc() in string.c with WIN32_LEAN_AND_MEAN

                    +
                  • +

                    #6240 Differentiate between lib and lib64 in the build settings.

                    +
                  • +

                    #6304 Calling method_missing with only Kwargs passes arguments incorrectly

                    +
                  • +

                    #6317 mrb_gc_register() may cause GC and collect the object being protected

                    +
                  • +

                    #6307 Planned change patch for mrb_vm_exec()

                    +
                  • +

                    #6298 foo :bar {} is legal in mruby?

                    +
                  • +

                    #6326 Detect “Use-after-free” with address sanitizer

                    +
                  • +

                    #5358 static warning from getpwnam

                    +
                  • +

                    #6339 mrb_ary_delete() may refer to an invalid address (use-after-free)

                    +
                  • +

                    #6346 Block kwargs are passed as last positional arg when using yield

                    +
                  • +

                    #6365 powl() not available when compiling for Dreamcast

                    +
                  • +

                    #6369 100x Performance Regression from 3.1

                    +
                  • +

                    #6270 NODE_ZSUPER from deeply nested blocks will result in a truncated digits for block index in OP_ARGARY

                    +
                  • +

                    #6297 Assigning to a block variable changes the actual block (thus affecting block_given? and yield)

                    +
                  • +

                    #6389 instance_exec named block args don’t work properly

                    +
                  • +

                    #6388 Recent commit broke my windows build

                    +
                  • +

                    #6411 Wrong function unwinding when using return in a block

                    +
                  • +

                    #6439 OP_JMPUW does not call the ensure block when it jumps to the beginning of the begin block

                    +
                  • +

                    #6441 break inside while loop will execute the ensure block outside of the while loop

                    +
                  • +

                    #6453 Bigint: incorrect behavior of ^ operator

                    +
                  • +

                    #6452 Bigint: weird mod behavior

                    +
                  • +

                    #6451 Bigint: incorrect division behavior

                    +
                  • +

                    #6456 bigint: bug with division of a small number by a bigint

                    +
                  • +

                    #6466 mruby-bin-mruby using Kernel#p and Kernel#print in bintest fails test

                    +
                  • +

                    #6467 Heap-Use-After-Free due to Recursive group_by Calls

                    +
                  • +

                    #6471 Discrepancy in codegen for binary operations between master branch and 3.3.0

                    +
                  • +

                    #6477 heap-buffer-overflow in mrb_vm_exec

                    +
                  • +

                    #6485 Hash#rehash does not check if the hash is frozen

                    +
                  • +

                    #6483 Hash#default_proc= accepts arbitrary objects that are not callable

                    +
                  • +

                    #6491 Destroy existing string literals when composing string literals

                    +
                  + +

                  Merged Pull Requests (User Visible Ones)

                  +
                  • +

                    #6171 Add Enumerable::Lazy#grep_v to mruby-enum-lazy

                    +
                  • +

                    #6174 Fix MRUBY_PACKAGE_DIR in mruby-config.bat

                    +
                  • +

                    #6175 Corrected strange conditional in mrb_vm_run()

                    +
                  • +

                    #6176 Stop assuming alias proc in CI_PROC_SET()

                    +
                  • +

                    #6177 gha: add macOS 14 to the build

                    +
                  • +

                    #6184 Remove the L_STOP label

                    +
                  • +

                    #6185 Added mrb_callinfo::u.keep_context for clarity

                    +
                  • +

                    #6186 Omit NULL check of e->cxt in OP_RETURN_BLK

                    +
                  • +

                    #6191 Speed up symbol equality comparison

                    +
                  • +

                    #6192 Fix OP_STOP with exception

                    +
                  • +

                    #6193 Fix wrong assertion in OP_SENDB.

                    +
                  • +

                    #6194 Simplify the calculation of the number of closures in MRB_TT_FIBER

                    +
                  • +

                    #6197 Fix int_xor to call flo_xor.

                    +
                  • +

                    #6201 tasks/doc.rake: standardize the rake doc error messages

                    +
                  • +

                    #6202 Remove the .yardoc folder with rake doc:clean:api

                    +
                  • +

                    #6204 Clean up the .editorconfig file

                    +
                  • +

                    #6209 Minor .gitignore clean up

                    +
                  • +

                    #6211 Minor .gitignore clean up; order entries

                    +
                  • +

                    #6216 Shared empty iv_tbl of module

                    +
                  • +

                    #6217 Strict declaration for mrb_istruct_size()

                    +
                  • +

                    #6219 Avoid assigning a fixed value in the loop

                    +
                  • +

                    #6220 Reorganize mrb_cache_entry and mrb_method_t types

                    +
                  • +

                    #6221 Arranging each_backtrace()

                    +
                  • +

                    #6222 Need to synchronize dbg->regs after VM call in mrdb

                    +
                  • +

                    #6224 mrb_env_unshare() to break the link to fiber

                    +
                  • +

                    #6225 Revert “Adjust environment when mrb_exec_irep happened.”

                    +
                  • +

                    #6227 fix: Array#shuffle(!) result distribution

                    +
                  • +

                    #6228 Revert “env referred from top-level callinfo should not be unshared; fix #4019”

                    +
                  • +

                    #6230 Fix status of fiber after switched by exception raised

                    +
                  • +

                    #6231 Add a way to let other gems handle closing of fds in mruby-io

                    +
                  • +

                    #6232 Fold the code for freeing env

                    +
                  • +

                    #6233 Free stack memory at end of fiber

                    +
                  • +

                    #6235 fix Array#delete always firing the block when deleting nil

                    +
                  • +

                    #6236 unify the code for filter methods (and speed up #reject!)

                    +
                  • +

                    #6237 Stricter env objects to attach to ci

                    +
                  • +

                    #6238 Minimize zero initialization of the stack

                    +
                  • +

                    #6243 Fixed base64 decoding in mruby-pack

                    +
                  • +

                    #6244 Revise scope of role of mrb_vm_run()

                    +
                  • +

                    #6246 Fix typo in test/t/hash.rb

                    +
                  • +

                    #6249 Fix grammar in src/vm.c; catched -> caught

                    +
                  • +

                    #6250 Fix spelling

                    +
                  • +

                    #6251 Clean up root move CODEOWNERS to .github directory

                    +
                  • +

                    #6253 Allow recycling fibers by GC if not referenced directly

                    +
                  • +

                    #6256 Update documentation for mrb_top_run()

                    +
                  • +

                    #6257 fix some mrbconf.md typos

                    +
                  • +

                    #6260 Remove exc_caught from mrb_vm_exec()

                    +
                  • +

                    #6261 fix: to_a integer ranges with begin > end failing

                    +
                  • +

                    #6263 fix: Array#delete mistakenly calling block even if not passed

                    +
                  • +

                    #6264 Must pass keyword arguments for Kernel#to_enum

                    +
                  • +

                    #6265 Fixes Dir.children and Dir.each_child

                    +
                  • +

                    #6266 Passes the nonexistent key as a block argument in Array#delete

                    +
                  • +

                    #6273 Improvements to mrb_protect_atexit()

                    +
                  • +

                    #6275 Fixed Binding#eval that failed to assign to the same variable

                    +
                  • +

                    #6276 Always run atexit on the top-level call frame

                    +
                  • +

                    #6279 Include headers for malloc() explicitly; fix #6277

                    +
                  • +

                    #6280 Remove MRB_ENV_CLOSED flag

                    +
                  • +

                    #6281 Fixes local variables in mruby-binding.

                    +
                  • +

                    #6283 Simplify uvenv()

                    +
                  • +

                    #6288 Detach env of ci explicitly on atexit

                    +
                  • +

                    #6289 Simplify OP_RETURN_BLK and OP_BREAK

                    +
                  • +

                    #6290 Allow to change the output directory name of the libmruby file

                    +
                  • +

                    #6293 Changed the instruction table in opcode.md

                    +
                  • +

                    #6294 Optimise mrb_iv_get

                    +
                  • +

                    #6302 Minor cleanup in mrb_str_init

                    +
                  • +

                    #6303 mrb_str_aset_m() should return replace instead of str

                    +
                  • +

                    #6305 Protect keyword arguments in prepare_missing()

                    +
                  • +

                    #6308 Assume that MRB_CATCH() has mrb->exc set

                    +
                  • +

                    #6310 Doubling the call stack when extending it

                    +
                  • +

                    #6311 Added fast-path for positional arguments less than 15 in OP_SEND

                    +
                  • +

                    #6312 Omit error checking at OP_RETURN, OP_RETURN_BLK and OP_BREAK

                    +
                  • +

                    #6313 Fix wrong column number in opcode.md

                    +
                  • +

                    #6314 Optimize even?/odd? for big integers

                    +
                  • +

                    #6318 Shrink variables in mrb_vm_exec()

                    +
                  • +

                    #6320 Shrinking the code in OP_BREAK and OP_RETURN_BLK

                    +
                  • +

                    #6321 Avoid warnings in lib/*/.rb

                    +
                  • +

                    #6322 Fix mrb_ro_data_p on Intel Mac

                    +
                  • +

                    #6324 Remove localjump_error()

                    +
                  • +

                    #6327 fix ncurses linking issues

                    +
                  • +

                    #6328 Fix use-after-free in obj_free() for env objects

                    +
                  • +

                    #6329 Fix use-after-free in mrb_obj_alloc()

                    +
                  • +

                    #6330 Add a precondition to call mrb_env_unshare().

                    +
                  • +

                    #6331 Restore the GC arena with tests

                    +
                  • +

                    #6332 Must not depend on the “host” build to generate mruby-compiler/core/y.tab.c

                    +
                  • +

                    #6333 Reduce the number of branch instructions in the heap_p()

                    +
                  • +

                    #6335 Add return_ci in CHECKPOINT_MAIN() of OP_RETURN

                    +
                  • +

                    #6338 Need to place static proc objects into 8-byte alignments

                    +
                  • +

                    #6340 Fix use-after-free for Array#<=>

                    +
                  • +

                    #6341 Need to restore the GC arena after some function calls

                    +
                  • +

                    #6344 prefer using mrb_yield to call block arguments

                    +
                  • +

                    #6347 codegen.c,parse.y: remove flattening of yield arguments; fix #6346

                    +
                  • +

                    #6348 Cancel the warning disablement

                    +
                  • +

                    #6349 Perform GC before deleting directories

                    +
                  • +

                    #6350 Fixed character encoding conversion function mismatch

                    +
                  • +

                    #6351 Remove unnecessary mrb_gc_arena_restore()

                    +
                  • +

                    #6353 Fix use-after-free in mrb_ary_delete()

                    +
                  • +

                    #6356 Making splat argument objects invisible from Ruby side

                    +
                  • +

                    #6373 Add build config for Milk-V Duo (RISC-V Linux) board

                    +
                  • +

                    #6382 Make array objects invisible in mrb_gc_register()

                    +
                  • +

                    #6385 Small improvements for mrb_gc_register()

                    +
                  • +

                    #6386 Avoid calling mrb_gv_set() from mrb_gc_unregister()

                    +
                  • +

                    #6387 Small improvements for mrb_gc_unregister()

                    +
                  • +

                    #6390 Fix use-after-free by mrb_gc_unregistor()

                    +
                  • +

                    #6391 Fixed argument forwarding in instance_exec

                    +
                  • +

                    #6392 Fix argument forwarding in mrb_exec_irep()

                    +
                  • +

                    #6393 Follow-up to #6391

                    +
                  • +

                    #6395 Storing method-id inside Symbol#to_proc

                    +
                  • +

                    #6396 Milk-V Build Config: update GPIO gem URL

                    +
                  • +

                    #6397 boxing_no.h: rename BOXNIX_SET_VALUE -> BOXNO_SET_VALUE

                    +
                  • +

                    #6399 Add macOS 15 to the build

                    +
                  • +

                    #6405 io_read: use %i instead of %d in call to mrb_raisef

                    +
                  • +

                    #6407 Allow to exclude specific files in rake install

                    +
                  • +

                    #6408 Improve compliance with C++ standards

                    +
                  • +

                    #6410 Put #include <stdlib.h> in parse.y

                    +
                  • +

                    #6412 Distinguish the call frame of the generator with OP_RETURN_BLK

                    +
                  • +

                    #6413 Add links to documentation in README.md

                    +
                  • +

                    #6415 Fix numbered parameters when used as a singleton

                    +
                  • +

                    #6416 Optimize the “new” method’s iseq

                    +
                  • +

                    #6419 Follow Ruby’s behavior for numbered parameters in -> {}

                    +
                  • +

                    #6420 Update labeler.yml: add label for the tools directory

                    +
                  • +

                    #6422 Add annotations for function names defined in the preprocessor

                    +
                  • +

                    #6423 Adding a serialized test task

                    +
                  • +

                    #6427 Need to update ci variable after re-entry to VM

                    +
                  • +

                    #6428 Change the limits of OP_ADDI and OP_SUBI from 0-127 to 0-255.

                    +
                  • +

                    #6429 Fix numbered parameters when used as hash keys

                    +
                  • +

                    #6432 Moving code in macro arguments out of macros

                    +
                  • +

                    #6434 Added document “Layout of the mruby filesystem”

                    +
                  • +

                    #6436 Make rake doc:update-index prettier friendly

                    +
                  • +

                    #6437 Add more details to the pre-commit config

                    +
                  • +

                    #6438 Remove unused MRuby::Build#list_install_excludes method

                    +
                  • +

                    #6440 Fix redo keyword

                    +
                  • +

                    #6442 Fixed wrong range condition in OP_JMPUW

                    +
                  • +

                    #6443 Fix NODE_NEGATE for bigints

                    +
                  • +

                    #6444 Add test cases for bigints

                    +
                  • +

                    #6446 Omit the _WIN64 definition check

                    +
                  • +

                    #6447 Fixed File.expand_path

                    +
                  • +

                    #6448 Suppress presym in mruby/ext/io.h file

                    +
                  • +

                    #6449 Using presym in the mruby-io/src/file_test.c file

                    +
                  • +

                    #6450 Change MRB_WITH_IO_PREAD_PWRITE configuration name

                    +
                  • +

                    #6454 mruby-bigint: handle rhs bigint in int_mod and int_divmod functions

                    +
                  • +

                    #6455 mruby-bigint: fix rounding behavior in mpz_mdiv and mpz_mdivmod functions

                    +
                  • +

                    #6457 bigint: fix bug with division of a small number by a bigint

                    +
                  • +

                    #6459 FileTest is a module

                    +
                  • +

                    #6461 To create a release package file in draft

                    +
                  • +

                    #6462 Properly cast the return value of memchr()

                    +
                  • +

                    #6463 Add level argument to File.dirname

                    +
                  • +

                    #6465 Add initial playstation portable crossbuild support

                    +
                  • +

                    #6468 Fixed missing changes to IB_FIND_BY_KEY() parameter names

                    +
                  • +

                    #6469 Add more const qualifier for RProc

                    +
                  • +

                    #6472 Moved tests for Integer#quo

                    +
                  • +

                    #6473 Hide mpz_and() symbol

                    +
                  • +

                    #6473 Hide mpz_and() symbol

                    +
                  • +

                    #6474 Avoid array object creation with “unknown keyword” error

                    +
                  • +

                    #6475 Don’t include deleted mruby-print

                    +
                  • +

                    #6478 Fixed buffer overrun in function chars2bytes()

                    +
                  • +

                    #6479 Reimplementation of File.expand_path method

                    +
                  • +

                    #6482 Add File.absolute_path? method

                    +
                  • +

                    #6487 Add Emscripten toolchain & build_config

                    +
                  +
                  + + + +
                  + + \ No newline at end of file diff --git a/docs/api/file.README.html b/docs/api/file.README.html index 0ab8144..fd8bc96 100644 --- a/docs/api/file.README.html +++ b/docs/api/file.README.html @@ -6,17 +6,17 @@ File: README - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -61,64 +61,58 @@
                  -

                  Build Status

                  - -

                  What is mruby

                  +
                  +

                  + + The mruby programming language + +

                  +

                  mruby

                  + + GitHub Super-Linter + +
                  +

                  What is mruby

                  -

                  mruby is the lightweight implementation of the Ruby language complying to (part -of) the ISO standard. Its syntax is Ruby 2.x compatible.

                  +

                  mruby is the lightweight implementation of the Ruby language complying to (part of) the ISO standard with more recent features provided by Ruby 3.x. Also, its syntax is Ruby 3.x compatible except for pattern matching.

                  -

                  mruby can be linked and embedded within your application. We provide the -interpreter program “mruby” and the interactive mruby shell “mirb” as examples. -You can also compile Ruby programs into compiled byte code using the mruby -compiler “mrbc”. All those tools reside in the “bin” directory. “mrbc” is -also able to generate compiled byte code in a C source file, see the “mrbtest” -program under the “test” directory for an example.

                  +

                  You can link and embed mruby within your application. The “mruby” interpreter program and the interactive “mirb” shell are provided as examples. You can also compile Ruby programs into compiled byte code using the “mrbc” compiler. All these tools are located in the “bin” directory. “mrbc” can also generate compiled byte code in a C source file. See the “mrbtest” program under the “test” directory for an example.

                  -

                  This achievement was sponsored by the Regional Innovation Creation R&D Programs -of the Ministry of Economy, Trade and Industry of Japan.

                  +

                  This achievement was sponsored by the Regional Innovation Creation R&D Programs of the Ministry of Economy, Trade and Industry of Japan.

                  -

                  How to get mruby

                  +

                  How to get mruby

                  -

                  The stable version 2.1.0 of mruby can be downloaded via the following URL: https://github.com/mruby/mruby/archive/2.1.0.zip

                  +

                  To get mruby, you can download the stable version 3.4.0 from the official mruby GitHub repository or clone the trunk of the mruby source tree with the “git clone” command. You can also install and compile mruby using ruby-install, ruby-build or rvm.

                  -

                  The latest development version of mruby can be downloaded via the following URL: https://github.com/mruby/mruby/zipball/master

                  +

                  The latest development version of mruby can be downloaded via the following URL: github.com/mruby/mruby/zipball/master

                  -

                  The trunk of the mruby source tree can be checked out with the -following command:

                  +

                  The trunk of the mruby source tree can be checked out with the following command:

                  $ git clone https://github.com/mruby/mruby.git
                   
                  -

                  You can also install and compile mruby using ruby-install, ruby-build or rvm.

                  - -

                  mruby home-page

                  +

                  mruby homepage

                  -

                  The URL of the mruby home-page is: http://www.mruby.org.

                  +

                  The URL of the mruby homepage is: mruby.org.

                  -

                  Mailing list

                  +

                  Mailing list

                  -

                  We don’t have a mailing list, but you can use GitHub issues.

                  +

                  We don’t have a mailing list, but you can use GitHub issues.

                  -

                  How to compile and install (mruby and gems)

                  +

                  How to compile, test, and install (mruby and gems)

                  -

                  See the compile.md file.

                  +

                  For the simplest case, type

                  -

                  Running Tests

                  - -

                  To run the tests, execute the following from the project’s root directory.

                  - -
                  $ make test
                  +
                  rake all test
                   
                  -

                  Or

                  - -
                  $ ruby ./minirake test
                  -
                  +

                  See the compile.md file for the detail.

                  -

                  Building documentation

                  +

                  Building documentation

                  -

                  There are two sets of documentation in mruby: the mruby API (generated by yard) and C API (Doxygen)

                  +

                  There are two sets of documentation in mruby: the mruby API (generated by YARD) and C API (Doxygen and Graphviz)

                  To build both of them, simply go

                  @@ -131,49 +125,60 @@

                  Building documentation

                  rake view_capi
                  -

                  How to customize mruby (mrbgems)

                  - -

                  mruby contains a package manager called mrbgems. To create extensions -in C and/or Ruby you should create a GEM. For a documentation of how to -use mrbgems consult the file mrbgems.md. -For example code of how to use mrbgems look into the folder examples/mrbgems/.

                  - -

                  License

                  - -

                  mruby is released under the MIT License.

                  - -

                  Note for License

                  - -

                  mruby has chosen a MIT License due to its permissive license allowing -developers to target various environments such as embedded systems. -However, the license requires the display of the copyright notice and license -information in manuals for instance. Doing so for big projects can be -complicated or troublesome. This is why mruby has decided to display “mruby -developers” as the copyright name to make it simple conventionally. -In the future, mruby might ask you to distribute your new code -(that you will commit,) under the MIT License as a member of -“mruby developers” but contributors will keep their copyright. -(We did not intend for contributors to transfer or waive their copyrights, -Actual copyright holder name (contributors) will be listed in the AUTHORS -file.)

                  +

                  How to customize mruby (mrbgems)

                  + +

                  mruby contains a package manager called “mrbgems” that you can use to create extensions in C and/or Ruby. For a guide on how to use mrbgems, consult the mrbgems.md file, and for example code, refer to the examples/mrbgems/ folder.

                  + +

                  Index of Document

                  + + +

                  License

                  + +

                  mruby is released under the MIT License.

                  + +

                  Note for License

                  + +

                  mruby has chosen a MIT License due to its permissive license allowing developers to target various environments such as embedded systems. However, the license requires the display of the copyright notice and license information in manuals for instance. Doing so for big projects can be complicated or troublesome. This is why mruby has decided to display “mruby developers” as the copyright name to make it simple conventionally. In the future, mruby might ask you to distribute your new code (that you will commit,) under the MIT License as a member of “mruby developers” but contributors will keep their copyright. (We did not intend for contributors to transfer or waive their copyrights, actual copyright holder name (contributors) will be listed in the AUTHORS file.)

                  Please ask us if you want to distribute your code under another license.

                  -

                  How to Contribute

                  - -

                  See the contribution guidelines, and then send a pull -request to http://github.com/mruby/mruby. We consider you have granted -non-exclusive right to your contributed code under MIT license. If you want to -be named as one of mruby developers, please include an update to the AUTHORS -file in your pull request.

                  +

                  How to Contribute

                  +

                  To contribute to mruby, please refer to the contribution guidelines and send a pull request to the mruby GitHub repository. By contributing, you grant non-exclusive rights to your code under the MIT License.

                  - +
                  diff --git a/docs/api/file.SECURITY.html b/docs/api/file.SECURITY.html new file mode 100644 index 0000000..02e88f3 --- /dev/null +++ b/docs/api/file.SECURITY.html @@ -0,0 +1,100 @@ + + + + + + + File: SECURITY + + — Documentation by YARD 0.9.37 + + + + + + + + + + + + + + + + + + + + + + + +
                  + + +
                  +

                  Security Policy

                  + +

                  Reporting a Vulnerability

                  + +

                  If you have any security concern, contact matz@ruby.or.jp.

                  + +

                  Scope

                  + +

                  We consider the following issues as vulnerabilities:

                  +
                  • +

                    Remote code execution

                    +
                  • +

                    Crash caused by a valid Ruby script

                    +
                  + +

                  We don’t consider the following issues as vulnerabilities:

                  +
                  • +

                    Runtime C undefined behavior (including integer overflow)

                    +
                  • +

                    Crash caused by misused API

                    +
                  • +

                    Crash caused by modified compiled binary

                    +
                  • +

                    ASAN/Valgrind warning for too big memory allocation mruby assumes malloc(3) returns NULL for too big allocations

                    +
                  +
                  + + + +
                  + + \ No newline at end of file diff --git a/docs/api/file.TODO.html b/docs/api/file.TODO.html new file mode 100644 index 0000000..6a82a81 --- /dev/null +++ b/docs/api/file.TODO.html @@ -0,0 +1,94 @@ + + + + + + + File: TODO + + — Documentation by YARD 0.9.37 + + + + + + + + + + + + + + + + + + + + + + + +
                  + + +
                  +

                  Things to Do in the future

                  + +

                  After mruby 3.1

                  +
                  • +

                    parser and code generator independent from mrb_state (picoruby?)

                    +
                  • +

                    variable sized AST node

                    +
                  • +

                    iv/hash entry cache

                    +
                  • +

                    more peephole optimization (if possible)

                    +
                  + +

                  Things to do (Things we need to consider)

                  +
                  • +

                    begin ... end while cond to behave as CRuby

                    +
                  • +

                    special variables ($1,$2..)

                    +
                  +
                  + + + +
                  + + \ No newline at end of file diff --git a/docs/api/file.boxing.html b/docs/api/file.boxing.html new file mode 100644 index 0000000..2d3ffc0 --- /dev/null +++ b/docs/api/file.boxing.html @@ -0,0 +1,193 @@ + + + + + + + File: boxing + + — Documentation by YARD 0.9.37 + + + + + + + + + + + + + + + + + + + + + + + +
                  + + +
                  +

                  Boxing

                  + +

                  The mruby objects and data are represented by C data type mrb_value. There are three options how to pack the data values in the mrb_value.

                  +
                  • +

                    Word Boxing

                    +
                  • +

                    NaN Boxing

                    +
                  • +

                    No Boxing

                    +
                  + +

                  Word Boxing

                  + +

                  Word boxing packs the Ruby data in a word, which is a natural integer size that equals to the size of pointers (intptr_t). Word boxing can be specified by MRB_WORD_BOXING, and it’s default configuration for most platforms.

                  + +

                  Some values (called immediate values, e.g. integers, booleans, symbols, etc.) are directly packed in the word. The other data types are represented by pointers to the heap allocated structures.

                  + +

                  The Word boxing packing bit patterns are like following:

                  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                  TypesBit Pattern
                  object‘xxxxxxxx xxxxxxxx xxxxxxxx xxxxx000`
                  fixnum‘xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxx1`
                  nil‘00000000 00000000 00000000 00000000`
                  true‘00000000 00000000 00000000 00001100`
                  false‘00000000 00000000 00000000 00000100`
                  undef‘00000000 00000000 00000000 00010100`
                  symbol‘xxxxxxxx xxxxxxxx xxxxxxxx xxxxxx10`
                  + +

                  On 64-bit platforms (unless MRB_WORDBOX_NO_FLOAT_TRUNCATE), float values are also packed in the mrb_value. In that case, we drop least significant 2 bits from mantissa. If you need full precision for floating-point numbers, define MRB_WORDBOX_NO_FLOAT_TRUNCATE.

                  + +

                  NaN Boxing

                  + +

                  NaN boxing packs the Ruby data in a floating-point numbers, which represent NaN (Not a Number) values. Under IEEE753 definitions every value that exponent is all set are considered as NaN. That means NaN can represent 2^51 values. NaN boxing is a teaching to pack the values in those NaN representation. In theory, 64-bit pointers are too big to fit in NaN, but practically most OS use only 48 bits at most for pointers (except for some OS e.g. Solaris).

                  + +

                  The NaN boxing packing bit patterns are like following:

                  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                  TypesBit Pattern
                  float‘SEEEEEEE EEEEFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF`
                  +/-inf‘S1111111 11110000 00000000 00000000 00000000 00000000 00000000 00000000`
                  nan‘01111111 11111000 00000000 00000000 00000000 00000000 00000000 00000000`
                  fixnum‘01111111 11111001 00000000 00000000 IIIIIIII IIIIIIII IIIIIIII IIIIIIII`
                  symbol‘01111111 11111110 00000000 00000000 SSSSSSSS SSSSSSSS SSSSSSSS SSSSSSSS`
                  misc‘01111111 11111111 00000000 00000000 00000000 00000000 00TTTTTT 0000MMMM`
                  object‘01111111 11111100 PPPPPPPP PPPPPPPP PPPPPPPP PPPPPPPP PPPPPPPP PPPPPP00`
                  ptr‘01111111 11111100 PPPPPPPP PPPPPPPP PPPPPPPP PPPPPPPP PPPPPPPP PPPPPP01`
                  nil‘00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000`
                  + +

                  The object values appear far more frequently than floating-point numbers, so we offset the value so that object pointers are unchanged. This technique is called “favor pointer”.

                  + +

                  No Boxing

                  + +

                  No boxing represents mrb_value by the C struct with type and the value union. This is the most portable (but inefficient) representation. No boxing can be specified by MRB_NO_BOXING, and it’s default for debugging configuration (e.g. host-debug).

                  +
                  + + + +
                  + + \ No newline at end of file diff --git a/docs/api/file.compile.html b/docs/api/file.compile.html index 5e474e9..2779482 100644 --- a/docs/api/file.compile.html +++ b/docs/api/file.compile.html @@ -6,17 +6,17 @@ File: compile - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -61,115 +61,139 @@
                  -

                  Compile

                  +
                  +

                  Compile

                  -

                  mruby uses Rake to compile and cross-compile all libraries and -binaries.

                  +

                  mruby uses Rake to compile and cross-compile all libraries and binaries.

                  -

                  Prerequisites

                  +

                  Prerequisites

                  -

                  To compile mruby out of the source code you need the following tools: -* C Compiler (e.g. gcc) -* Linker (e.g. gcc) -* Archive utility (e.g. ar) -* Parser generator (e.g. bison) -* Ruby 2.0 or later (e.g. ruby or jruby)

                  +

                  To compile mruby out of the source code you need the following tools:

                  +
                  • +

                    C Compiler (e.g. gcc or clang)

                    +
                  • +

                    Linker (e.g. gcc or clang)

                    +
                  • +

                    Archive utility (e.g. ar)

                    +
                  • +

                    Ruby 2.5 or later (e.g. ruby or jruby)

                    +
                  -

                  Optional: -* GIT (to update mruby source and integrate mrbgems easier) -* C++ compiler (to use GEMs which include *.cpp, *.cxx, *.cc) -* Assembler (to use GEMs which include *.asm)

                  +

                  Optional:

                  +
                  • +

                    Git (to update mruby source and integrate mrbgems easier)

                    +
                  • +

                    C++ compiler (to use mrbgems which include *.cpp, *.cxx, *.cc)

                    +
                  • +

                    Bison (to compile mrbgems/mruby-compiler/core/parse.y)

                    +
                  • +

                    gperf (to compile mrbgems/mruby-compiler/core/keywords)

                    +
                  -

                  Usage

                  +

                  Note that bison bundled with macOS is too old to compile mruby. Try brew install bison and follow the instruction shown to update the $PATH to compile mruby. We also encourage you to upgrade ruby on macOS in similar manner.

                  -

                  Inside of the root directory of the mruby source a file exists -called build_config.rb. This file contains the build configuration -of mruby and looks like this for example: -ruby -MRuby::Build.new do |conf| - toolchain :gcc -end -

                  +

                  Build

                  -

                  All tools necessary to compile mruby can be set or modified here. In case -you want to maintain an additional build_config.rb you can define a -customized path using the $MRUBY_CONFIG environment variable.

                  +

                  To compile mruby with the default build configuration, just invoke rake inside of the mruby source root. To generate and execute the test tools call rake test. To clean all build files call rake clean. To see full command line on build, call rake -v.

                  -

                  To compile just call ./minirake inside of the mruby source root. To -generate and execute the test tools call ./minirake test. To clean -all build files call ./minirake clean. To see full command line on -build, call ./minirake -v.

                  +

                  You can specify your own configuration file by the MRUBY_CONFIG environment variable (you can use CONFIG for shorthand for MRUBY_CONFIG). If the path doesn’t exist, build_config/${MRUBY_CONFIG}.rb is used. The default configuration is defined in the build_config/default.rb file.

                  -

                  Build Configuration

                  +

                  Those build configuration files contain the build configuration of mruby, for example:

                  -

                  Inside of the build_config.rb the following options can be configured -based on your environment.

                  +
                  MRuby::Build.new do |conf|
                  +  conf.toolchain :gcc
                  +end
                  +
                  + +

                  All tools necessary to compile mruby can be set or modified here.

                  + +

                  Build Configuration

                  + +

                  We wish you submit a pull-request to build_config/PLATFORM.rb, once you created a new configuration for a new platform.

                  + +

                  Inside the configuration file, the following options can be configured based on your environment.

                  + +

                  Toolchains

                  + +

                  The mruby build system already contains a set of toolchain templates which configure the build environment for specific compiler infrastructures.

                  + +

                  GCC

                  + +

                  Toolchain configuration for the GNU C Compiler.

                  + +
                  conf.toolchain :gcc
                  +
                  + +

                  clang

                  + +

                  Toolchain configuration for the LLVM C Compiler clang. Mainly equal to the GCC toolchain.

                  + +
                  conf.toolchain :clang
                  +
                  + +

                  Visual Studio 2010, 2012 and 2013

                  + +

                  Toolchain configuration for Visual Studio on Windows. If you use the Visual Studio Command Prompt, you normally do not have to specify this manually, since it gets automatically detected by our build process.

                  -

                  Toolchains

                  +
                  conf.toolchain :visualcpp
                  +
                  + +

                  Android

                  -

                  The mruby build system already contains a set of toolchain templates which -configure the build environment for specific compiler infrastructures.

                  +

                  Toolchain configuration for Android.

                  -

                  GCC

                  +
                  conf.toolchain :android
                  +
                  -

                  Toolchain configuration for the GNU C Compiler. -ruby -toolchain :gcc -

                  +

                  Requires the custom standalone Android NDK and the toolchain path in ANDROID_STANDALONE_TOOLCHAIN.

                  -

                  clang

                  +

                  Binaries

                  -

                  Toolchain configuration for the LLVM C Compiler clang. Mainly equal to the -GCC toolchain. -ruby -toolchain :clang -

                  +

                  It is possible to select which tools should be compiled during the compilation process. For example,

                  +
                  • +

                    mruby

                    +
                  • +

                    mirb

                    +
                  -

                  Visual Studio 2010, 2012 and 2013

                  +

                  The configuration are done via mrbgems. See Mrbgems section.

                  -

                  Toolchain configuration for Visual Studio on Windows. If you use the -Visual Studio Command Prompt, -you normally do not have to specify this manually, since it gets automatically detected by our build process. -ruby -toolchain :visualcpp -

                  +

                  File Separator

                  -

                  Android

                  +

                  Some environments require a different file separator character. It is possible to set the character via conf.file_separator.

                  + +
                  conf.file_separator = '/'
                  +
                  -

                  Toolchain configuration for Android. -ruby -toolchain :android -

                  +

                  Name of library directory

                  -

                  Requires the custom standalone Android NDK and the toolchain path -in ANDROID_STANDALONE_TOOLCHAIN.

                  +

                  In some environments, the libmruby.a file requires a different directory name than lib. You can be changed to any name by the conf.libdir_name accessor.

                  -

                  Binaries

                  +
                  conf.libdir_name = 'lib64'
                  +
                  + +

                  Alternatively, it can be changed via the environment variable MRUBY_SYSTEM_LIBDIR_NAME when the rake command is run.

                  + +
                  $ export MRUBY_SYSTEM_LIBDIR_NAME=lib64
                  +$ rake clean all
                  +
                  -

                  It is possible to select which tools should be compiled during the compilation -process. The following tools can be selected: -* mruby (mruby interpreter) -* mirb (mruby interactive shell)

                  +

                  NOTES:

                  +
                  • +

                    This environment variable MRUBY_SYSTEM_LIBDIR_NAME does not affect MRuby::CrossBuild. In other words, if you want to change it for MRuby::CrossBuild, you must set it with MRuby::CrossBuild#libdir_name=.

                    +
                  • +

                    If you want to switch this environment variable MRUBY_SYSTEM_LIBDIR_NAME, you must do rake clean.

                    +
                  -

                  To select them declare conf.gem as follows: -ruby -conf.gem "#{root}/mrbgems/mruby-bin-mruby" -conf.gem "#{root}/mrbgems/mruby-bin-mirb" -

                  +

                  A bad usage example is shown below.

                  -

                  File Separator

                  +

                  console $ rake clean all $ rake MRUBY_SYSTEM_LIBDIR_NAME=lib64 install

                  -

                  Some environments require a different file separator character. It is possible to -set the character via conf.file_separator. -ruby -conf.file_separator = '/' -

                  +

                  C Compiler

                  -

                  C Compiler

                  +

                  Configuration of the C compiler binary, flags and include paths.

                  -

                  Configuration of the C compiler binary, flags and include paths. -ruby -conf.cc do |cc| +

                  conf.cc do |cc|
                     cc.command = ...
                     cc.flags = ...
                     cc.include_paths = ...
                  @@ -177,343 +201,330 @@ 

                  C Compiler

                  cc.option_include_path = ... cc.option_define = ... cc.compile_options = ... -end -

                  +end +

                  C Compiler has header searcher to detect installed library.

                  -

                  If you need a include path of header file use search_header_path: -ruby -# Searchesiconv.h. -# If found it will return include path of the header file. -# Otherwise it will return nil . -fail 'iconv.h not found' unless conf.cc.search_header_path 'iconv.h' -

                  - -

                  If you need a full file name of header file use search_header: -ruby -# Searchesiconv.h. -# If found it will return full path of the header file. -# Otherwise it will return nil . -iconv_h = conf.cc.search_header 'iconv.h' -print "iconv.h found: #{iconv_h}\n" -

                  - -

                  Header searcher uses compiler’s include_paths by default. -When you are using GCC toolchain (including clang toolchain since its base is gcc toolchain) -it will use compiler specific include paths too. (For example /usr/local/include, /usr/include)

                  - -

                  If you need a special header search paths define a singleton method header_search_paths to C compiler: -ruby -def conf.cc.header_search_paths - ['/opt/local/include'] + include_paths -end -

                  - -

                  Linker

                  - -

                  Configuration of the Linker binary, flags and library paths. -ruby -conf.linker do |linker| +

                  If you need an include path of header file use search_header_path:

                  + +
                  # Searches `iconv.h`.
                  +# If found it will return include path of the header file.
                  +# Otherwise it will return nil.
                  +fail 'iconv.h not found' unless conf.cc.search_header_path 'iconv.h'
                  +
                  + +

                  If you need a full file name of header file use search_header:

                  + +
                  # Searches `iconv.h`.
                  +# If found it will return full path of the header file.
                  +# Otherwise it will return nil.
                  +iconv_h = conf.cc.search_header 'iconv.h'
                  +print "iconv.h found: #{iconv_h}\n"
                  +
                  + +

                  Header searcher uses compiler’s include_paths by default. When you are using GCC toolchain (including clang toolchain since its base is gcc toolchain) it will use compiler specific include paths too. (For example /usr/local/include, /usr/include)

                  + +

                  If you need a special header search paths define a singleton method header_search_paths to C compiler:

                  + +
                  def conf.cc.header_search_paths
                  +  ['/opt/local/include'] + include_paths
                  +end
                  +
                  + +

                  Linker

                  + +

                  Configuration of the Linker binary, flags and library paths.

                  + +
                  conf.linker do |linker|
                     linker.command = ...
                     linker.flags = ...
                     linker.flags_before_libraries = ...
                     linker.libraries = ...
                     linker.flags_after_libraries = ...
                  -  linker.library_paths = ....
                  +  linker.library_paths = ...
                     linker.option_library = ...
                     linker.option_library_path = ...
                     linker.link_options = ...
                  -end
                  -

                  +end +
                  + +

                  Archiver

                  -

                  Archiver

                  +

                  Configuration of the Archiver binary and flags.

                  -

                  Configuration of the Archiver binary and flags. -ruby -conf.archiver do |archiver| +

                  conf.archiver do |archiver|
                     archiver.command = ...
                     archiver.archive_options = ...
                  -end
                  -

                  +end +
                  + +

                  Parser Generator

                  -

                  Parser Generator

                  +

                  Configuration of the Parser Generator binary and flags.

                  -

                  Configuration of the Parser Generator binary and flags. -ruby -conf.yacc do |yacc| +

                  conf.yacc do |yacc|
                     yacc.command = ...
                     yacc.compile_options = ...
                  -end
                  -

                  +end +
                  + +

                  GPerf

                  -

                  GPerf

                  +

                  Configuration of the GPerf binary and flags.

                  -

                  Configuration of the GPerf binary and flags. -ruby -conf.gperf do |gperf| +

                  conf.gperf do |gperf|
                     gperf.command = ...
                     gperf.compile_options = ...
                  -end
                  -

                  +end +
                  + +

                  File Extensions

                  -

                  File Extensions

                  -

                  ruby -conf.exts do |exts| +

                  conf.exts do |exts|
                     exts.object = ...
                     exts.executable = ...
                     exts.library = ...
                  -end
                  -

                  +end +
                  + +

                  Preallocated Symbols

                  + +

                  By far, preallocated symbols are highly compatible with the previous versions, so we expect you won’t see any problem with them. But just in case you face any issue, you can disable preallocated symbols by specifying conf.disable_presym.

                  + +

                  In the build process, mrbc under cross compiling environment will be compiled with this configuration.

                  -

                  Mrbgems

                  +

                  Mrbgems

                  -

                  Integrate GEMs in the build process. -```ruby -# Integrate GEM with additional configuration -conf.gem ‘path/to/gem’ do |g| - g.cc.flags « … -end

                  +

                  mruby comes with the (sort of) packaging system named mrbgems. To specify gem, you can use conf.gem in the configuration file.

                  -

                  Integrate GEM without additional configuration

                  -

                  conf.gem ‘path/to/another/gem’ -```

                  +
                  # Integrate a bundled Gem you see in `mrbgems` directory
                  +conf.gem :core => 'mruby-something'
                   
                  -

                  See doc/mrbgems/README.md for more option about mrbgems.

                  +# Integrate a Gem from GitHub +conf.gem :github => 'someone/mruby-another' -

                  Mrbtest

                  +# Integrate a mruby binary Gem +conf.gem :core => 'mruby-bin-mruby' + +# Integrate a interactive mruby binary Gem +conf.gem :core => 'mruby-bin-mirb' + +# Integrate GemBox (set of Gems) +conf.gembox "default" +
                  + +

                  A GemBox is a set of Gems defined in mrbgems/default.gembox for example. It’s just a set of mrbgem configurations.

                  + +

                  There is a RubyGem (gem for CRuby) named mgem that help you to manage mrbgems. Try gem install mgem. mgem can show you the list of registered mrbgems.

                  + +

                  See doc/guides/mrbgems.md for more option about mrbgems.

                  + +

                  Mrbtest

                  Configuration Mrbtest build process.

                  -

                  If you want mrbtest.a only, You should set conf.build_mrbtest_lib_only -ruby -conf.build_mrbtest_lib_only -

                  - -

                  Bintest

                  - -

                  Tests for mrbgem tools using CRuby. -To have bintests place *.rb scripts to bintest/ directory of mrbgems. -See mruby-bin-*/bintest/*.rb if you need examples. -If you want a temporary files use tempfile module of CRuby instead of /tmp/.

                  - -

                  You can enable it with following: -ruby -conf.enable_bintest -

                  - -

                  C++ ABI

                  - -

                  By default, mruby uses setjmp/longjmp to implement its -exceptions. But it doesn’t release C++ stack object -correctly. To support mrbgems written in C++, mruby can be -configured to use C++ exception.

                  - -

                  There are two levels of C++ exception handling. The one is -enable_cxx_exception that enables C++ exception, but -uses C ABI. The other is enable_cxx_abi where all -files are compiled by C++ compiler.

                  - -

                  When you mix C++ code, C++ exception would be enabled automatically. -If you need to enable C++ exception explicitly add the following: -ruby -conf.enable_cxx_exception -

                  - -

                  C++ exception disabling.

                  - -

                  If your compiler does not support C++ and you want to ensure -you don’t use mrbgem written in C++, you can explicitly disable -C++ exception, add following: -ruby -conf.disable_cxx_exception - -and you will get an error when you try to use C++ gem. -Note that it must be called before enable_cxx_exception or gem method.

                  - -

                  Debugging mode

                  - -

                  To enable debugging mode add the following: -ruby -conf.enable_debug -

                  - -

                  When debugging mode is enabled -* Macro MRB_DEBUG would be defined. - * Which means mrb_assert() macro is enabled. -* Debug information of irep would be generated by mrbc. - * Because -g flag would be added to mrbc runner. - * You can have better backtrace of mruby scripts with this.

                  - -

                  Cross-Compilation

                  - -

                  mruby can also be cross-compiled from one platform to another. To -achieve this the build_config.rb needs to contain an instance of -MRuby::CrossBuild. This instance defines the compilation -tools and flags for the target platform. An example could look -like this: -```ruby -MRuby::CrossBuild.new(‘32bit’) do |conf| - toolchain :gcc

                  - -

                  conf.cc.flags « “-m32” - conf.linker.flags « “-m32” -end -```

                  - -

                  All configuration options of MRuby::Build can also be used -in MRuby::CrossBuild.

                  - -

                  Mrbtest in Cross-Compilation

                  - -

                  In cross compilation, you can run mrbtest on emulator if -you have it by changing configuration of test runner. -```ruby -conf.test_runner do |t| - t.command = … # set emulator. this value must be non nil or false - t.flags = … # set flags of emulator

                  - -

                  def t.run(bin) # override run if you need to change the behavior of it - … # bin is the full path of mrbtest - end -end -```

                  - -

                  Build process

                  - -

                  During the build process the directory build will be created in the -root directory. The structure of this directory will look like this:

                  +

                  If you want mrbtest.a only, You should set conf.build_mrbtest_lib_only

                  + +
                  conf.build_mrbtest_lib_only
                  +
                  + +

                  Bintest

                  + +

                  Tests for mrbgem tools using CRuby. To have bintests place *.rb scripts to bintest/ directory of mrbgems. See mruby-bin-/bintest/.rb if you need examples. If you want a temporary files use tempfile module of CRuby instead of /tmp/.

                  + +

                  You can enable it with following:

                  + +
                  conf.enable_bintest
                  +
                  + +

                  C++ ABI

                  + +

                  By default, mruby uses setjmp/longjmp to implement its exceptions. But it doesn’t release C++ stack object correctly. To support mrbgems written in C++, mruby can be configured to use C++ exception.

                  + +

                  There are two levels of C++ exception handling. The one is enable_cxx_exception that enables C++ exception, but uses C ABI. The other is enable_cxx_abi where all files are compiled by C++ compiler.

                  + +

                  When you mix C++ code, C++ exception would be enabled automatically. If you need to enable C++ exception explicitly add the following:

                  + +
                  conf.enable_cxx_exception
                  +
                  + +

                  C++ exception disabling

                  + +

                  If your compiler does not support C++, and you want to ensure you don’t use mrbgem written in C++, you can explicitly disable C++ exception, add following:

                  + +
                  conf.disable_cxx_exception
                  +
                  + +

                  and you will get an error when you try to use C++ gem. Note that it must be called before enable_cxx_exception or gem method.

                  + +

                  Debugging mode

                  + +

                  To enable debugging mode add the following:

                  + +
                  conf.enable_debug
                  +
                  + +

                  When debugging mode is enabled

                  +
                  • +

                    Macro MRB_DEBUG would be defined.

                    +
                  • +

                    Which means mrb_assert() macro is enabled.

                    +
                  • +

                    Debug information of irep would be generated by mrbc.

                    +
                  • +

                    Because -g flag would be added to mrbc runner.

                    +
                    • +

                      You can have better backtrace of mruby scripts with this.

                      +
                    +
                  + +

                  Cross-Compilation

                  + +

                  mruby can also be cross-compiled from one platform to another. To achieve cross-compilation, the build configuration needs to contain an instance of MRuby::CrossBuild. This instance defines the compilation tools and flags for the target platform. An example could look like this:

                  + +
                  MRuby::CrossBuild.new('32bit') do |conf|
                  +  conf.toolchain :gcc
                  +
                  +  conf.cc.flags << "-m32"
                  +  conf.linker.flags << "-m32"
                  +end
                  +
                  + +

                  All configuration options of MRuby::Build can also be used in MRuby::CrossBuild. You can find examples under the build_config directory.

                  + +

                  Mrbtest in Cross-Compilation

                  + +

                  In cross compilation, you can run mrbtest on an emulator if you have it by changing configuration of test runner.

                  + +
                  conf.test_runner do |t|
                  +  t.command = ... # set emulator. this value must be non nil or false
                  +  t.flags = ... # set flags of emulator
                  +
                  +  def t.run(bin) # override `run` if you need to change the behavior of it
                  +    ... # `bin` is the full path of mrbtest
                  +  end
                  +end
                  +
                  + +

                  Build process

                  + +

                  During the build process the build directory will be created in the root directory. The structure of this directory will look like this:

                  +- build
                  -   |
                  -   +-  host
                  -       |
                  -       +- bin          <- Binaries (mirb, mrbc and mruby)
                  -       |
                  -       +- lib          <- Libraries (libmruby.a and libmruby_core.a)
                  -       |
                  -       +- mrblib
                  -       |
                  -       +- src
                  -       |
                  -       +- test         <- mrbtest tool
                  -       |
                  -       +- tools
                  -          |
                  -          +- mirb
                  -          |
                  -          +- mrbc
                  -          |
                  -          +- mruby
                  -
                  - -

                  The compilation workflow will look like this: -* compile all files under src (object files will be stored -in build/host/src) -* generate parser grammar out of src/parse.y (generated -result will be stored in build/host/src/y.tab.c) -* compile build/host/src/y.tab.c to build/host/src/y.tab.o -* create build/host/lib/libmruby_core.a out of all object files (C only) -* create build/host/bin/mrbc by compiling tools/mrbc/mrbc.c and -linking with build/host/lib/libmruby_core.a -* create build/host/mrblib/mrblib.c by compiling all *.rb files -under mrblib with build/host/bin/mrbc -* compile build/host/mrblib/mrblib.c to build/host/mrblib/mrblib.o -* create build/host/lib/libmruby.a out of all object files (C and Ruby) -* create build/host/bin/mruby by compiling mrbgems/mruby-bin-mruby/tools/mruby/mruby.c and -linking with build/host/lib/libmruby.a -* create build/host/bin/mirb by compiling mrbgems/mruby-bin-mirb/tools/mirb/mirb.c and -linking with build/host/lib/libmruby.a

                  - -

                  - _____ _____ ______ ____ ____ _____ _____ ____ -| CC |->|GEN |->|AR |->|CC |->|CC |->|AR |->|CC |->|CC | + | + +- host + | + +- LEGAL <- License description + | + +- bin <- Binaries (mirb, mrbc and mruby) + | + +- lib <- Libraries (libmruby.a and libmruby_core.a) + | + +- mrbc <- Minimal mrbc place + | + +- mrbgems <- Compilation result from mrbgems + | + +- mrblib <- Compilation result from mrblib + | + +- src <- Compilation result from C sources +

                  + +

                  The compilation workflow will look like this:

                  +
                  • +

                    compile minimal mrbc from src and mrblib sources

                    +
                  • +

                    compile all files under src (object files will be stored in build/host/mrbc/src)

                    +
                  • +

                    compile mruby-compiler gem

                    +
                  • +

                    create build/host/mrbc/lib/libmruby_core.a out of all object files (C only)

                    +
                  • +

                    create build/host/mrbc/bin/mrbc via mruby-bin-mrbc gem

                    +
                  • +

                    compile all files under src and store result in build/host/src

                    +
                  • +

                    create build/host/mrblib/mrblib.c by compiling all *.rb files under mrblib with build/host/mrbc/bin/mrbc

                    +
                  • +

                    compile build/host/mrblib/mrblib.c to build/host/mrblib/mrblib.o

                    +
                  • +

                    create build/host/lib/libmruby.a out of all object files (C and Ruby)

                    +
                  • +

                    compile (normal) mrbgems specified in the configuration file

                    +
                  • +

                    create build/host/lib/libmruby.a from object files from gems and libmruby_core.a

                    +
                  • +

                    create binary commands according to binary gems (e.g. mirb and mruby)

                    +
                  • +

                    copy binaries under build/host/bin to bin directory

                    +
                  + +
                  _____    _____    ______    ____    ____    _____    _____    ____
                  +| CC  |->|GEN  |->|AR    |->|CC  |->|CC  |->|AR   |->|CC   |->|CC  |
                   | *.c |  |y.tab|  |core.a|  |mrbc|  |*.rb|  |lib.a|  |mruby|  |mirb|
                    -----    -----    ------    ----    ----    -----    -----    ----
                  -

                  +
                  -

                  Cross-Compilation

                  +

                  Cross-Compilation

                  -

                  In case of a cross-compilation to i386 the build directory structure looks -like this:

                  +

                  In case of a cross-compilation to i386 the build directory structure looks like this:

                  +- build
                  -   |
                  -   +-  host
                  -   |   |
                  -   |   +- bin           <- Native Binaries
                  -   |   |
                  -   |   +- lib           <- Native Libraries
                  -   |   |
                  -   |   +- mrblib
                  -   |   |
                  -   |   +- src
                  -   |   |
                  -   |   +- test          <- Native mrbtest tool
                  -   |   |
                  -   |   +- tools
                  -   |      |
                  -   |      +- mirb
                  -   |      |
                  -   |      +- mrbc
                  -   |      |
                  -   |      +- mruby
                  -   +- i386
                  -      |
                  -      +- bin            <- Cross-compiled Binaries
                  -      |
                  -      +- lib            <- Cross-compiled Libraries
                  -      |
                  -      +- mrblib
                  -      |
                  -      +- src
                  -      |
                  -      +- test           <- Cross-compiled mrbtest tool
                  -      |
                  -      +- tools
                  -         |
                  -         +- mirb
                  -         |
                  -         +- mrbc
                  -         |
                  -         +- mruby
                  -
                  - -

                  An extra directory is created for the target platform. In case you -compile for i386 a directory called i386 is created under the -build directory.

                  - -

                  The cross compilation workflow starts in the same way as the normal -compilation by compiling all native libraries and binaries. -Afterwards the cross compilation process proceeds like this: -* cross-compile all files under src (object files will be stored -in build/i386/src) -* generate parser grammar out of src/parse.y (generated -result will be stored in build/i386/src/y.tab.c) -* cross-compile build/i386/src/y.tab.c to build/i386/src/y.tab.o -* create build/i386/mrblib/mrblib.c by compiling all *.rb files -under mrblib with the native build/host/bin/mrbc -* cross-compile build/host/mrblib/mrblib.c to build/host/mrblib/mrblib.o -* create build/i386/lib/libmruby.a out of all object files (C and Ruby) -* create build/i386/bin/mruby by cross-compiling mrbgems/mruby-bin-mruby/tools/mruby/mruby.c and -linking with build/i386/lib/libmruby.a -* create build/i386/bin/mirb by cross-compiling mrbgems/mruby-bin-mirb/tools/mirb/mirb.c and -linking with build/i386/lib/libmruby.a -* create build/i386/lib/libmruby_core.a out of all object files (C only) -* create build/i386/bin/mrbc by cross-compiling tools/mrbc/mrbc.c and -linking with build/i386/lib/libmruby_core.a

                  - -

                  - _______________________________________________________________ -| Native Compilation for Host System | + | + +- host + | | + | +- bin <- Native Binaries + | | + | +- lib <- Native Libraries + | | + | +- mrbgems + | | + | +- src + | + +- i386 + | + +- bin <- Cross-compiled Binaries + | + +- include <- Header Directory + | + +- lib <- Cross-compiled Libraries + | + +- mrbgems + | + +- mrblib + | + +- src +

                  + +

                  An extra directory is created for the target platform. In case you compile for i386 a directory called i386 is created under the build directory.

                  + +

                  The cross compilation workflow starts in the same way as the normal compilation by compiling all native libraries and binaries, except for we don’t have host/mrbc directory (host directory itself works as placeholder for mrbc). Afterwards the cross compilation process proceeds like this:

                  +
                  • +

                    cross-compile all files under src and store result in build/i386/src

                    +
                  • +

                    create build/i386/lib/libmruby_core.a out of C object files

                    +
                  • +

                    create build/i386/mrblib/mrblib.c by compiling all *.rb files under mrblib with native build/host/bin/mrbc

                    +
                  • +

                    cross-compile build/i386/mrblib/mrblib.c to build/i386/mrblib/mrblib.o

                    +
                  • +

                    create build/i386/lib/libmruby.a from object files from gems and libmruby_core.a

                    +
                  • +

                    create binary commands according to binary gems (e.g. mirb and mruby)

                    +
                  • +

                    copy binaries under build/host/bin to bin directory

                    +
                  + +
                  _______________________________________________________________
                  +|              Native Compilation for Host System               |
                   |  _____      ______      _____      ____      ____      _____  |
                  -| | CC  | -> |AR    | -> |GEN  | -> |CC  | -> |CC  | -> |AR   | |
                  +| | CC  | -> |AR    | -> |GEN  | -> |CC  | -> |CC  | -> |AR   | |
                   | | *.c |    |core.a|    |y.tab|    |mrbc|    |*.rb|    |lib.a| |
                   |  -----      ------      -----      ----      ----      -----  |
                    ---------------------------------------------------------------
                                                   ||
                  -                               \||/
                  -                                \/
                  +                               \||/
                  +                                \/
                    ________________________________________________________________
                   |             Cross Compilation for Target System                |
                   |  _____      _____      _____      ____      ______      _____  |
                  @@ -521,43 +532,142 @@ 

                  Cross-Compilation

                  | | *.c | |lib.a| |mruby| |mirb| |core.a| |mrbc | | | ----- ----- ----- ---- ------ ----- | ---------------------------------------------------------------- -

                  +
                  + +

                  Build Configuration Examples

                  + +

                  Minimal Library

                  + +

                  To build a minimal mruby library you need to use the Cross Compiling feature due to the reason that there are functions (e.g. stdio) which can’t be disabled for the main build.

                  -

                  Build Configuration Examples

                  +
                  MRuby::CrossBuild.new('minimal') do |conf|
                  +  conf.toolchain :gcc
                  +  conf.cc.defines << 'MRB_NO_STDIO'
                  +end
                  +
                  + +

                  This configuration defines a cross compile build called ‘minimal’ which is using the GCC and compiles for the host machine. It also disables all usages of stdio and doesn’t compile any binaries (e.g. mrbc).

                  -

                  Minimal Library

                  +

                  Test Environment

                  -

                  To build a minimal mruby library you need to use the Cross Compiling -feature due to the reason that there are functions (e.g. stdio) which -can’t be disabled for the main build.

                  +

                  mruby’s build process includes a test environment. In case you start the testing of mruby, a native binary called mrbtest will be generated and executed. This binary contains all test cases which are defined under test/t. In case of a cross-compilation an additional cross-compiled mrbtest binary is generated. You can copy this binary and run on your target system.

                  -

                  ```ruby -MRuby::CrossBuild.new(‘Minimal’) do |conf| - toolchain :gcc

                  +

                  Embedding mruby in Your Application

                  -

                  conf.cc.defines = %w(MRB_DISABLE_STDIO) - conf.bins = [] -end -```

                  +

                  After the build, you will get libmruby.a. You can link it to your application.

                  -

                  This configuration defines a cross compile build called ‘Minimal’ which -is using the GCC and compiles for the host machine. It also disables -all usages of stdio and doesn’t compile any binaries (e.g. mrbc).

                  +

                  For compiler options and library path, you can use mruby-config command for convenience. mruby-config command prints the configuration used for libmruby.a.

                  + +
                  $ mruby-config --help
                  +Usage: mruby-config [switches]
                  +  switches:
                  +  --cc                        print compiler name
                  +  --cflags                    print flags passed to compiler
                  +  --ld                        print linker name
                  +  --ldflags                   print flags passed to linker
                  +  --ldflags-before-libs       print flags passed to linker before linked libraries
                  +  --libs                      print linked libraries
                  +  --libmruby-path             print libmruby path
                  +  --help                      print this help
                  +
                  -

                  Test Environment

                  +

                  For example, when you have a C source file (c.c) and try to compile and link it with libmruby.a, you can run the following command,

                  -

                  mruby’s build process includes a test environment. In case you start the testing -of mruby, a native binary called mrbtest will be generated and executed. -This binary contains all test cases which are defined under test/t. In case -of a cross-compilation an additional cross-compiled mrbtest binary is -generated. You can copy this binary and run on your target system.

                  +
                  `mruby-config --cc --cflags` c.c `mruby-config --ldflags --libs`
                  +
                  + +

                  When you use make, add following lines in Makefile

                  + +
                  MRB_CONFIG = <path-to-mruby-config>
                  +CFLAGS = `$(MRB_CONFIG) --cflags`
                  +LDFLAGS = `$(MRB_CONFIG) --ldflags`
                  +LIBS = `$(MRB_CONFIG) --libs`
                  +
                  + +

                  Install

                  + +

                  To install the files in the bin, include and lib directories generated by the “host” build target into a system directory, do the following:

                  + +
                  $ rake install
                  +
                  + +

                  If there are multiple build targets in the build configuration file, to install the products of all build targets, do the following:

                  + +
                  $ rake install:full
                  +
                  + +

                  To install only one of several build targets, e.g., the “its-mine” build target, do the following:

                  + +
                  $ rake install:full:its-mine
                  +
                  + +

                  To install only the executable files, do the following:

                  + +
                  $ rake install_bin              # only "host" build target
                  +$ rake install:bin              # all build targets
                  +$ rake install:bin:its-mine     # only "its-mine" build target
                  +
                  + +

                  Installation Directory

                  + +

                  The installation directory is /usr/local for the “host” build target and /usr/local/mruby/<build-name> for the others. To change them, you can set the environment variable PREFIX or use MRuby::Build#install_prefix = dir in your build configuration file.

                  + +

                  The PREFIX environment variable affects all build targets and changes the /usr/local part.

                  + +

                  The MRuby::Build#install_prefix can be set for each individual build target. In this case, the environment variable PREFIX is ignored.

                  + +

                  Also, if the environment variable DESTDIR is set, it will prepend to the path obtained by install_prefix to determine the final write directory. This is intended for temporary file expansion by the user’s package work.

                  +
                  + +

                  To summarize:

                  +
                  • +

                    The default value of the environment variable PREFIX is /usr/local.

                    +
                  • +

                    For the “host” build target, the default value of MRuby::Build#install_prefix is <PREFIX>.

                    +
                  • +

                    For a build target other than “host”, the default value of MRuby::Build#install_prefix is <PREFIX>/mruby/<build-name>.

                    +
                  • +

                    If the environment variable DESTDIR is set, the actual write directory is <DESTDIR>/<MRuby::Build#install_prefix>.

                    +
                  + +

                  Excluded files

                  + +

                  In some cases there are files that you do not want to install. In such cases, add a file path filter to the array object MRuby::Build#install_excludes to exclude them.

                  + +

                  The following is an object that can be defined as a file path filter. The path variable that appears is a relative path based on MRuby::Build#build_dir.

                  +
                  • +

                    string objects: files matched by string.match?(path) are excluded.

                    +
                  • +

                    regexp object: files matched by regexp.match?(path) are excluded.

                    +
                  • +

                    proc object: files which return true with proc.call(path) are excluded.

                    +
                  + +
                  # exclude bin/mrbc
                  +conf.install_excludes << exefile("bin/mrbc")
                  +
                  +# exclude all files under lib/ directory
                  +conf.install_excludes << %r(^lib/)
                  +
                  +# exclude bin/mrbtest, but in this case it is recommended to use string instead of proc
                  +conf.install_excludes << proc { |path|
                  +  path == exefile("bin/mrbtest")
                  +}
                  +
                  + +

                  By default, it contains only a proc object to exclude libmruby_core.

                  + +

                  Tips

                  +
                  • +

                    If you see compilation troubles, try rake clean first.

                    +
                  - + diff --git a/docs/api/file.debugger.html b/docs/api/file.debugger.html index bf8c2b0..75201db 100644 --- a/docs/api/file.debugger.html +++ b/docs/api/file.debugger.html @@ -6,17 +6,17 @@ File: debugger - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -61,170 +61,157 @@
                  -

                  How to Use the mruby Debugger

                  +
                  +

                  How to Use the mruby Debugger

                  -

                  copyright (c) 2014 Specified Non-Profit Corporation mruby Forum

                  +

                  copyright © 2014 Specified Non-Profit Corporation mruby Forum

                  -

                  1. Summary

                  +

                  1. Summary

                  This file documents the mruby debugger (‘mrdb’) methods.

                  -

                  2 Debugging with mrdb

                  +

                  2 Debugging with mrdb

                  -

                  2.1 Building mrdb

                  +

                  2.1 Building mrdb

                  The trunk of the mruby source tree, with the most recent mrdb, can be checked out with the following command:

                  -

                  bash -$ git clone https://github.com/mruby/mruby.git -

                  +
                  $ git clone https://github.com/mruby/mruby.git
                  +

                  To run the make command:

                  -

                  bash -$ cd mruby -$ make -

                  +
                  $ cd mruby
                  +$ make
                  +

                  By default, the make command will install the debugger files into mruby/bin.

                  You can add the path for mrdb on your host environment with the following command:

                  -

                  bash -$ echo "export PATH=\$PATH:MRUBY_ROOT/bin" >> ~/.bashrc -$ source ~/.bashrc -

                  +
                  $ echo "export PATH=\$PATH:MRUBY_ROOT/bin" >> ~/.bashrc
                  +$ source ~/.bashrc
                  +

                  *MRUBY_ROOT is the directory in which mruby source code will be installed.

                  To confirm mrdb was installed properly, run mrdb with the --version option:

                  -

                  bash -$ mrdb --version -mruby 2.1.0 (2019-11-19) -

                  +
                  $ mrdb --version
                  +mruby 3.4.0 (2025-04-20)
                  +
                  -

                  2.2 Basic Operation

                  +

                  2.2 Basic Operation

                  -

                  2.2.1 Debugging mruby Script Files (rb file) with mrdb

                  +

                  2.2.1 Debugging mruby Script Files (rb file) with mrdb

                  To invoke the mruby debugger, just type mrdb.

                  To specify the script file:

                  -

                  bash -$ mrdb [option] file name -

                  +
                  $ mrdb [option] file name
                  +

                  For example: Debugging sample.rb

                  -

                  bash -$ mrdb sample.rb -

                  +
                  $ mrdb sample.rb
                  +

                  You can execute the shell commands listed below:

                  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
                  commanddescription
                  runexecute programs
                  stepexecute stepping
                  continueexecute continuing program
                  breakconfigure the breaking point
                  deletedeleting the breaking points
                  disabledisabling the breaking points
                  enableenabling the breaking points
                  info breakpointsshowing list of the breaking points
                  printevaluating and printing the values of the mruby expressions in the script
                  listdisplaying the source cords
                  helpshowing help
                  quitterminating the mruby debugger
                  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                  commanddescription
                  runexecute programs
                  stepexecute stepping
                  continueexecute continuing program
                  breakconfigure the breaking point
                  deletedeleting the breaking points
                  disabledisabling the breaking points
                  enableenabling the breaking points
                  info breakpointsshowing list of the breaking points
                  printevaluating and printing the values of the mruby expressions in the script
                  listdisplaying the source cords
                  helpshowing help
                  quitterminating the mruby debugger
                  -

                  2.2.2 Debugging mruby Binary Files (mrb file) with mrdb

                  +

                  2.2.2 Debugging mruby Binary Files (mrb file) with mrdb

                  You can debug the mruby binary files.

                  -

                  2.2.2.1 Debugging the binary files

                  +

                  2.2.2.1 Debugging the binary files

                  +
                  • +

                    notice To debug mruby binary files, you need to compile mruby files with option -g.

                    +
                  -
                    -
                  • notice -To debug mruby binary files, you need to compile mruby files with option -g.
                  • -
                  - -

                  bash -$ mrbc -g sample.rb -

                  +
                  $ mrbc -g sample.rb
                  +

                  You can debug the mruby binary files with following command and the option -b.

                  -

                  bash -$ mrdb -b sample.mrb -

                  +
                  $ mrdb -b sample.mrb
                  +

                  Then you can execute all debugger shell commands.

                  -

                  Break Command

                  +

                  Break Command

                  -

                  You can use any breakpoint to stop the program by specifying the line number and method name. -The breakpoint list will be displayed after you have set the breakpoint successfully.

                  +

                  You can use any breakpoint to stop the program by specifying the line number and method name. The breakpoint list will be displayed after you have set the breakpoint successfully.

                  Usage:

                  -

                  -break [file:]linenum -b [file:]linenum -break [class:]method -b [class:]method -

                  +
                  break [file:]linenum
                  +b [file:]linenum
                  +break [class:]method
                  +b [class:]method
                  +
                  -

                  The breakpoint will be ordered in serial from 1. -The number, which was given to the deleted breakpoint, will never be given to another breakpoint again.

                  +

                  The breakpoint will be ordered in serial from 1. The number, which was given to the deleted breakpoint, will never be given to another breakpoint again.

                  -

                  You can give multiple breakpoints to specified the line number and method. -Be ware that breakpoint command will not check the validity of the class name and method name.

                  +

                  You can give multiple breakpoints to the specified the line number and method. Be aware that the breakpoint command will not check the validity of the class name and method name.

                  You can get the current breakpoint information by the following options.

                  @@ -232,14 +219,13 @@

                  Break Command

                  breakpoint breakpoint number : [class name,] method name

                  -

                  Continue Command

                  +

                  Continue Command

                  Usage:

                  -

                  -continue [N] -c [N] -

                  +
                  continue [N]
                  +c [N]
                  +

                  N: the next breakpoint number

                  @@ -249,241 +235,213 @@

                  Continue Command

                  Example:

                  -

                  -(foo.rb:1) continue 3 -

                  +
                  (foo.rb:1) continue 3
                  +

                  This will resume the program and stop it at the third breakpoint.

                  -

                  Delete Command

                  +

                  Delete Command

                  This will delete the specified breakpoint.

                  Usage:

                  -

                  -delete [breakpoint-no] +

                  delete [breakpoint-no]
                   d [breakpoint-no]
                  -

                  +

                  breakpoint-no: breakpoint number

                  Example:

                  -

                  -(foo.rb:1) delete -

                  +
                  (foo.rb:1) delete
                  +
                  -

                  This will delete all of the breakpoints.

                  +

                  This will delete all the breakpoints.

                  -

                  -(foo.rb:1) delete 1 3 -

                  +
                  (foo.rb:1) delete 1 3
                  +

                  This will delete the breakpoint at 1 and 3.

                  -

                  Disable Command

                  +

                  Disable Command

                  This will disable the specified breakpoint.

                  Usage:

                  -

                  -disable [breakpoint-no] +

                  disable [breakpoint-no]
                   dis [breakpoint-no]
                  -

                  +

                  reappointing: breakpoint number

                  Example:

                  -

                  -(foo.rb:1) disable -

                  +
                  (foo.rb:1) disable
                  +
                  -

                  Use disable if you would like to disable all of the breakpoints.

                  +

                  Use disable if you would like to disable all the breakpoints.

                  -

                  -(foo.rb:1) disable 1 3 -

                  +
                  (foo.rb:1) disable 1 3
                  +

                  This will disable the breakpoints at 1 and 3.

                  -

                  Enable Command

                  +

                  Enable Command

                  This will enable the specified breakpoints.

                  Usage:

                  -

                  -enable [breakpoint-no] +

                  enable [breakpoint-no]
                   e [breakpoint-no]
                  -

                  +

                  breakpoint-no: breakpoint number

                  Example:

                  -

                  -(foo.rb:1) enable -

                  +
                  (foo.rb:1) enable
                  +
                  + +

                  Enabling all breakpoints

                  -

                  Enabling all breakpoints - -(foo.rb:1) enable 1 3 -

                  +
                  (foo.rb:1) enable 1 3
                  +

                  Enabling the breakpoint 1 and 3

                  -

                  eval command

                  +

                  eval command

                  Evaluating the string as source code and printing the value.

                  Same as print command, please see print command.

                  -

                  help command

                  +

                  help command

                  Displaying the help message.

                  Usage:

                  -

                  -help [command] +

                  help [command]
                   h [command]
                  -

                  +

                  Typing help without any options will display the command list.

                  -

                  Info Breakpoints Command

                  +

                  Info Breakpoints Command

                  Displaying the specified breakpoint information.

                  Usage:

                  -

                  -info breakpoints [breakpoint-no] +

                  info breakpoints [breakpoint-no]
                   i b [breakpoint-no]
                  -

                  +

                  breakpoint-no: breakpoint number

                  -

                  Typing “info breakpoints” without ant option will display all breakpoint information. -Example:

                  +

                  Typing “info breakpoints” without ant option will display all breakpoint information. Example:

                  -

                  -(sample.rb:1) info breakpoints -Num Type Enb What -1 breakpoint y at sample.rb:3 -> file name,line number -2 breakpoint n in Sample_class:sample_class_method -> [class:]method name -3 breakpoint y in sample_global_method -

                  +
                  (sample.rb:1) info breakpoints
                  +Num     Type           Enb What
                  +1       breakpoint     y   at sample.rb:3                      -> file name,line number
                  +2       breakpoint     n   in Sample_class:sample_class_method -> [class:]method name
                  +3       breakpoint     y   in sample_global_method
                  +

                  Displaying the specified breakpoint number:

                  -

                  -(foo.rb:1) info breakpoints 1 3 -Num Type Enb What -1 breakpoint y at sample.rb:3 -3 breakpoint y in sample_global_method -

                  +
                  (foo.rb:1) info breakpoints 1 3
                  +Num     Type           Enb What
                  +1       breakpoint     y   at sample.rb:3
                  +3       breakpoint     y   in sample_global_method
                  +
                  -

                  List Command

                  +

                  List Command

                  To display the code of the source file.

                  Usage:

                  -

                  -list [filename:]first[,last] -l [filename]:first[,last] -

                  +
                  list [filename:]first[,last]
                  +l [filename]:first[,last]
                  +
                  -

                  first: the opening row number -last : the closing row number

                  +

                  first: the opening row number last : the closing row number

                  -

                  When you specify the first, but not the last option, you will receive 10 rows. -When you do not specify both the first and last options, you will receive the next 10 rows.

                  +

                  When you specify the first, but not the last option, you will receive 10 rows. When you do not specify both the first and last options, you will receive the next 10 rows.

                  Example:

                  -

                  -Specifying file name and first row number -sample.rb:1) list sample2.rb:5 -

                  +
                  Specifying file name and first row number
                  +sample.rb:1) list sample2.rb:5
                  +

                  Specifying the file name and the first and last row number:

                  -

                  -(sample.rb:1) list sample2.rb:6,7 -

                  +
                  (sample.rb:1) list sample2.rb:6,7
                  +
                  - +

                  Print Command

                  Evaluating the string as source code and printing the value.

                  Usage:

                  -

                  -print [expr] +

                  print [expr]
                   p [expr]
                  -

                  +

                  expr: expression

                  -

                  The expression is mandatory. -The displayed expressions will be serially ordered from 1. -If an exception occurs, the exception information will be displayed and the debugging will be continued.

                  +

                  The expression is mandatory. The displayed expressions will be serially ordered from 1. If an exception occurs, the exception information will be displayed, and the debugging will be continued.

                  Example:

                  -

                  -(sample.rb:1) print 1+2 -$1 = 3 -(sample.rb:1) print self -$2 = main -

                  +
                  (sample.rb:1) print 1+2
                  +$1 = 3
                  +(sample.rb:1) print self
                  +$2 = main
                  +

                  Below is the case of the exception:

                  -

                  -(sample.rb:1) print (1+2 -$1 = SyntaxError: line 1: syntax error, unexpected $end, expecting ')' -

                  +
                  (sample.rb:1) print (1+2
                  +$1 =  SyntaxError: line 1: syntax error, unexpected $end, expecting ')'
                  +
                  -

                  Quit Command

                  +

                  Quit Command

                  Quitting the debugger.

                  Usage:

                  -

                  -quit +

                  quit
                   q
                  -

                  +
                  -

                  Run Command

                  +

                  Run Command

                  Running the program and stopping at the first breakpoint.

                  Usage:

                  -

                  -run +

                  run
                   r
                  -

                  +
                  -

                  Step Command

                  +

                  Step Command

                  -

                  This will run the program step by step. -When the method and the block are invoked, the program will be stop at the first row. -The program, which is developed in C, will be ignored.

                  +

                  This will run the program step by step. When the method and the block are invoked, the program will stop at the first row. The program, which is developed in C, will be ignored.

                  - +
                  diff --git a/docs/api/file.gc-arena-howto.html b/docs/api/file.gc-arena-howto.html index 0776a58..91e3f4a 100644 --- a/docs/api/file.gc-arena-howto.html +++ b/docs/api/file.gc-arena-howto.html @@ -6,17 +6,17 @@ File: gc-arena-howto - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -61,192 +61,136 @@
                  -

                  How to use mrb_gc_arena_save()/mrb_gc_arena_restore()/mrb_gc_protect()

                  +
                  +

                  How to use mrb_gc_arena_save()/mrb_gc_arena_restore()/mrb_gc_protect()

                  -

                  This is an English translation of [Matz’s blog post][matz blog post] -written in Japanese. -Some parts are updated to reflect recent changes. -[matz blog post]: http://www.rubyist.net/~matz/20130731.html

                  +

                  This is an English translation of blog post[https://www.rubyist.net/~matz/20130731.html] written in Japanese. Some parts are updated to reflect recent changes.

                  -

                  When you are extending mruby using C language, you may encounter -mysterious “arena overflow error” or memory leak or very slow -execution speed. This is an error indicating overflow of “GC arena” -implementing “conservative GC”.

                  +

                  When you are extending mruby using C language, you may encounter mysterious “arena overflow error” or memory leak or very slow execution speed. This is an error indicating overflow of “GC arena” implementing “conservative GC”.

                  -

                  GC (garbage collector) must ensure that object is “alive”, in other -words, that it is referenced by somewhere from program. This can be -determined by checking if the object can be directly or indirectly -referenced by root. The local variables, global variables and -constants etc are root.

                  +

                  GC (garbage collector) must ensure that object is “alive”, in other words, that it is referenced by somewhere from the program. This can be determined by checking if the object can be directly or indirectly referenced by root. The local variables, global variables and constants etc. are root.

                  -

                  If program execution is performed inside mruby VM, there is nothing to -worry about because GC can access all roots owned by VM.

                  +

                  If program execution is performed inside mruby VM, there is nothing to worry about because GC can access all roots owned by the VM.

                  -

                  The problem arises when executing C functions. The object referenced -by C variable is also “alive”, but mruby GC cannot aware of this, so -it might mistakenly recognize the objects referenced by only C -variables as dead.

                  +

                  The problem arises when executing C functions. The object referenced by C variable is also “alive”, but mruby GC cannot aware of this, so it might mistakenly recognize the objects referenced by only C variables as dead.

                  This can be a fatal bug if the GC tries to collect a live object.

                  -

                  In CRuby, we scan C stack area, and use C variable as root to check -whether object is alive or not. Of course, because we are accessing C -stack just as memory region, we never know it is an integer or a -pointer. We workaround this by assuming that if it looks like a -pointer, then assume it as a pointer. We call it “conservative”.

                  +

                  In CRuby, we scan C stack area, and use C variable as root to check whether object is alive or not. Of course, because we are accessing C stack just as memory region, we never know it is an integer or a pointer. We work around this by assuming that if it looks like a pointer, then assume it as a pointer. We call it “conservative”.

                  By the way, CRuby’s “conservative GC” has some problems.

                  -

                  The biggest problem is we have no way to access to the stack area in -portable way. Therefore, we cannot use this method if we’d like to -implement highly portable runtime, like mruby.

                  +

                  The biggest problem is we have no way to access to the stack area in portable way. Therefore, we cannot use this method if we’d like to implement highly portable runtime, like mruby.

                  -

                  So we came up with an another plan to implement “conservative GC” in mruby.

                  +

                  So we came up with another plan to implement “conservative GC” in mruby.

                  -

                  Again, the problem is when an object which was created in C function, becomes -no longer referenced in the Ruby world, and cannot be treated as garbage.

                  +

                  Again, the problem is when an object which was created in C function, becomes no longer referenced in the Ruby world, and cannot be treated as garbage.

                  -

                  In mruby, we recognize all objects created in C function are alive. -Then we have no problem such as confusing a live object as dead.

                  +

                  In mruby, we recognize all objects created in C function are alive. Then we have no problem such as confusing a live object as dead.

                  -

                  This means that because we cannot collect truly dead object, we may -lose efficiency, but as a trade-off the GC itself is highly portable. -We can say goodbye to the problem that GC deletes live objects due to -optimization which sometimes occurs in CRuby.

                  +

                  This means that because we cannot collect a truly dead object, we may lose efficiency, but as a trade-off the GC itself is highly portable. We can say goodbye to the problem that GC deletes live objects due to optimization which sometimes occurs in CRuby.

                  -

                  According to this idea, we have a table, called “GC arena”, which -remembers objects created in C function.

                  +

                  According to this idea, we have a table, called “GC arena”, which remembers objects created in C function.

                  -

                  The arena is stack structure, when C function execution is returned to mruby -VM, all objects registered in the arena are popped.

                  +

                  The arena is stack structure, when C function execution is returned to mruby VM, all objects registered in the arena are popped.

                  -

                  This works very well, but can cause another problem: “arena overflow error” or -memory leak.

                  +

                  This works very well, but can cause another problem: “arena overflow error” or memory leak.

                  -

                  As of this writing, mruby automatically extend arena to remember -objects (See MRB_GC_FIXED_ARENA and MRB_GC_ARENA_SIZE in -doc/guides/mrbconf.md).

                  +

                  As of this writing, mruby automatically extend arena to remember objects (See MRB_GC_FIXED_ARENA and MRB_GC_ARENA_SIZE in doc/guides/mrbconf.md).

                  -

                  If you create many objects in C functions, memory usage will increase, since -GC never kick in. This memory usage may look like memory leak, but will also -make execution slower as more memory will need to be allocated.

                  +

                  If you create many objects in C functions, memory usage will increase, since GC never kicks in. This memory usage may look like memory leaks, but will also make execution slower as more memory will need to be allocated.

                  -

                  With the build time configuration, you can limit the maximum size of -arena (e.g., 100). Then if you create many objects, arena overflows, -thus you will get an “arena overflow error”.

                  +

                  With the build time configuration, you can limit the maximum size of arena (e.g., 100). Then if you create many objects, arena overflows, thus you will get an “arena overflow error”.

                  -

                  To workaround these problems, we have mrb_gc_arena_save() and -mrb_gc_arena_restore() functions.

                  +

                  To work around these problems, we have mrb_gc_arena_save() and mrb_gc_arena_restore() functions.

                  -

                  int mrb_gc_arena_save(mrb) returns the current position of the stack -top of GC arena, and void mrb_gc_arena_restore(mrb, idx) sets the -stack top position to back to given idx.

                  +

                  int mrb_gc_arena_save(mrb) returns the current position of the stack top of GC arena, and void mrb_gc_arena_restore(mrb, idx) sets the stack top position to back to given idx.

                  We can use them like this:

                  -

                  ```c -int arena_idx = mrb_gc_arena_save(mrb);

                  +
                  int arena_idx = mrb_gc_arena_save(mrb);
                   
                  -

                  // …create objects… -mrb_gc_arena_restore(mrb, arena_idx);

                  - -

                  ```

                  +// ...create objects... +mrb_gc_arena_restore(mrb, arena_idx); +
                  -

                  In mruby, C function calls are surrounded by this save/restore, but we -can further optimize memory usage by surrounding save/restore, and can -avoid creating arena overflow bugs.

                  +

                  In mruby, C function calls are surrounded by this save/restore, but we can further optimize memory usage by surrounding save/restore, and can avoid creating arena overflow bugs.

                  -

                  Let’s take a real example. Here is the source code of Array#inspect:

                  +

                  Let’s take a real example. Here is the source code of Array#inspect:

                  -

                  ```c -static mrb_value +

                  static mrb_value
                   inspect_ary(mrb_state *mrb, mrb_value ary, mrb_value list)
                   {
                     mrb_int i;
                     mrb_value s, arystr;
                  -  char head[] = { ‘[’ };
                  -  char sep[] = { ‘,’, ‘ ‘ };
                  -  char tail[] = { ‘]’ };

                  - -

                  /* check recursive */ - for(i=0; i<RARRAY_LEN(list); i++) { - if (mrb_obj_equal(mrb, ary, RARRAY_PTR(list)[i])) { - return mrb_str_new(mrb, “[…]”, 5); + char head[] = { '[' }; + char sep[] = { ',', ' ' }; + char tail[] = { ']' }; + + /* check recursive */ + for (i=0; i<RARRAY_LEN(list); i++) { + if (mrb_obj_equal(mrb, ary, RARRAY_PTR(list)[i])) { + return mrb_str_new(mrb, "[...]", 5); } - }

                  + } -

                  mrb_ary_push(mrb, list, ary);

                  + mrb_ary_push(mrb, list, ary); -

                  arystr = mrb_str_new_capa(mrb, 64); - mrb_str_cat(mrb, arystr, head, sizeof(head));

                  + arystr = mrb_str_new_capa(mrb, 64); + mrb_str_cat(mrb, arystr, head, sizeof(head)); -

                  for(i=0; i<RARRAY_LEN(ary); i++) { - int ai = mrb_gc_arena_save(mrb);

                  + for (i=0; i<RARRAY_LEN(ary); i++) { + int ai = mrb_gc_arena_save(mrb); -
                  if (i > 0) {
                  -  mrb_str_cat(mrb, arystr, sep, sizeof(sep));
                  -}
                  -if (mrb_array_p(RARRAY_PTR(ary)[i])) {
                  -  s = inspect_ary(mrb, RARRAY_PTR(ary)[i], list);
                  -}
                  -else {
                  -  s = mrb_inspect(mrb, RARRAY_PTR(ary)[i]);
                  +    if (i > 0) {
                  +      mrb_str_cat(mrb, arystr, sep, sizeof(sep));
                  +    }
                  +    if (mrb_array_p(RARRAY_PTR(ary)[i])) {
                  +      s = inspect_ary(mrb, RARRAY_PTR(ary)[i], list);
                  +    }
                  +    else {
                  +      s = mrb_inspect(mrb, RARRAY_PTR(ary)[i]);
                  +    }
                  +    mrb_str_cat(mrb, arystr, RSTRING_PTR(s), RSTRING_LEN(s));
                  +    mrb_gc_arena_restore(mrb, ai);
                  +  }
                  +
                  +  mrb_str_cat(mrb, arystr, tail, sizeof(tail));
                  +  mrb_ary_pop(mrb, list);
                  +
                  +  return arystr;
                   }
                  -mrb_str_cat(mrb, arystr, RSTRING_PTR(s), RSTRING_LEN(s));
                  -mrb_gc_arena_restore(mrb, ai);   }
                   
                  -

                  mrb_str_cat(mrb, arystr, tail, sizeof(tail)); - mrb_ary_pop(mrb, list);

                  +

                  This is a real example, so slightly complicated, but bear with me. The essence of Array#inspect is that after stringifying each element of array using inspect method, we join them together so that we can get inspect representation of the entire array.

                  -

                  return arystr; -} -```

                  - -

                  This is a real example, so a little bit complicated, but bear with me. -The essence of Array#inspect is that after stringifying each element -of array using inspect method, we join them together so that we can -get inspect representation of the entire array.

                  - -

                  After the inspect representation is created, we no longer require the -individual string representation. This means that we don’t have to register -these temporal objects into GC arena.

                  - -

                  Therefore, in order to keep the arena size small; the ary_inspect() function -will do the following:

                  - -
                    -
                  • save the position of the stack top using mrb_gc_arena_save().
                  • -
                  • get inspect representation of each element.
                  • -
                  • append it to the constructing entire inspect representation of array.
                  • -
                  • restore stack top position using mrb_gc_arena_restore().
                  • -
                  - -

                  Please note that the final inspect representation of entire array -was created before the call of mrb_gc_arena_restore(). Otherwise, -required temporal object may be deleted by GC.

                  - -

                  We may have a usecase where after creating many temporal objects, we’d -like to keep some of them. In this case, we cannot use the same idea -in ary_inspect() like appending objects to existing one. -Instead, after mrb_gc_arena_restore(), we must re-register the objects we -want to keep in the arena using mrb_gc_protect(mrb, obj). -Use mrb_gc_protect() with caution because it could also lead to an “arena -overflow error”.

                  - -

                  We must also mention that when mrb_funcall is called in top level, the return -value is also registered to GC arena, so repeated use of mrb_funcall may -eventually lead to an “arena overflow error”.

                  - -

                  Use mrb_gc_arena_save() and mrb_gc_arena_restore() or possible use of -mrb_gc_protect() to workaround this.

                  +

                  After the inspect representation is created, we no longer require the individual string representation. This means that we don’t have to register these temporal objects into GC arena.

                  + +

                  Therefore, in order to keep the arena size small; the ary_inspect() function will do the following:

                  +
                  • +

                    save the position of the stack top using mrb_gc_arena_save().

                    +
                  • +

                    get inspect representation of each element.

                    +
                  • +

                    append it to the constructing entire inspect representation of array.

                    +
                  • +

                    restore stack top position using mrb_gc_arena_restore().

                    +
                  + +

                  Please note that the final inspect representation of entire array was created before the call of mrb_gc_arena_restore(). Otherwise, required temporal object may be deleted by GC.

                  + +

                  We may have an usecase where after creating many temporal objects, we’d like to keep some of them. In this case, we cannot use the same idea in ary_inspect() like appending objects to existing one. Instead, after mrb_gc_arena_restore(), we must re-register the objects we want to keep in the arena using mrb_gc_protect(mrb, obj). Use mrb_gc_protect() with caution because it could also lead to an “arena overflow error”.

                  + +

                  We must also mention that when mrb_funcall is called in top level, the return value is also registered to GC arena, so repeated use of mrb_funcall may eventually lead to an “arena overflow error”.

                  + +

                  Use mrb_gc_arena_save() and mrb_gc_arena_restore() or possible use of mrb_gc_protect() to workaround this.

                  - +
                  diff --git a/docs/api/file.hier.html b/docs/api/file.hier.html new file mode 100644 index 0000000..5df9c1d --- /dev/null +++ b/docs/api/file.hier.html @@ -0,0 +1,134 @@ + + + + + + + File: hier + + — Documentation by YARD 0.9.37 + + + + + + + + + + + + + + + + + + + + + + + +
                  + + +
                  +

                  The mruby directory structure

                  + +
                  +- 💎 mruby/                    The top directory of mruby.
                  +    |
                  +    +- 📁 .github/              GitHub configuration files for mruby project management.
                  +    |
                  +    +- 📁 benchmark/            Benchmarking files for mruby.
                  +    |
                  +    +- 📁 bin/                  Links to temporary executables after build. Auto-created.
                  +    |
                  +    +- 📁 build/                Default build output destination for mruby. Auto-created.
                  +    |   |
                  +    |   +- 📁 repos/            The git clone destination directory for GEMs that depend on the build configuration.
                  +    |   |
                  +    |   +- 📁 host/             The "host" build output directory.
                  +    |
                  +    +- 📁 build_config/         Build configuration files for various environments.
                  +    |
                  +    +- 📁 doc/                  Documentation for mruby.
                  +    |   |
                  +    |   +- 📁 guides/           Documentation for general users.
                  +    |   |
                  +    |   +- 📁 internal/         Documentation for internal implementations for developers.
                  +    |
                  +    +- 📁 examples/             Examples of mruby usages.
                  +    |   |
                  +    |   +- 📁 mrbgems/          Examples for creating custom GEM for mruby.
                  +    |
                  +    +- 📁 include/              C header files required when using mruby.
                  +    |
                  +    +- 📁 lib/                  Ruby scripts used for building mruby.
                  +    |
                  +    +- 📁 mrbgems/              A library collection of features not provided by mruby core only.
                  +    |   |                       See doc/guides/mrbgems.md file
                  +    |   |
                  +    |   +- 📁 mruby-*/          The directory of each GEMs.
                  +    |   |
                  +    |   +- 📃 *.gembox          A collection of GEMs grouped by features and purposes.
                  +    |
                  +    +- 📁 mrblib/               The core Ruby scripts that makes up the main body of mruby.
                  +    |
                  +    +- 📁 oss-fuzz/             Source code for The fuzzing-test.
                  +    |                           See https://github.com/google/oss-fuzz
                  +    |
                  +    +- 📁 src/                  The core C source code that makes up the main body of mruby.
                  +    |
                  +    +- 📁 tasks/                Rake tasks at build-time.
                  +    |   |
                  +    |   +- 📁 toolchains/       Definitions for the compiler, linker, archiver, etc. for each toolchain.
                  +    |
                  +    +- 📁 test/                 Ruby scripts needed for testing mruby.
                  +    |   |
                  +    |   +- 📁 t/                mruby test cases.
                  +    |
                  +    +- 📁 tools/                External programs used for the mruby project.
                  +        |
                  +        +- 📁 lrama/            LALR parser generator as an alternative to bison.
                  +                                Import from https://github.com/ruby/lrama
                  +
                  +
                  + + + +
                  + + \ No newline at end of file diff --git a/docs/api/file.limitations.html b/docs/api/file.limitations.html new file mode 100644 index 0000000..df3e924 --- /dev/null +++ b/docs/api/file.limitations.html @@ -0,0 +1,233 @@ + + + + + + + File: limitations + + — Documentation by YARD 0.9.37 + + + + + + + + + + + + + + + + + + + + + + + +
                  + + +
                  +

                  Limitations and Differences

                  + +

                  The philosophy of mruby is to be a lightweight implementation of the Ruby ISO standard. These two objectives are partially contradicting. Ruby is an expressive language with complex implementation details which are difficult to implement in a lightweight manner. To cope with this, limitations to the “Ruby Compatibility” are defined.

                  + +

                  This document is collecting these limitations.

                  + +

                  Integrity

                  + +

                  This document does not contain a complete list of limitations. Please help to improve it by submitting your findings.

                  + +

                  Kernel.raise in rescue clause

                  + +

                  Kernel.raise without arguments does not raise the current exception within a rescue clause.

                  + +
                  begin
                  +  1 / 0
                  +rescue
                  +  raise
                  +end
                  +
                  + +

                  Ruby [ruby 2.0.0p645 (2015-04-13 revision 50299)]

                  + +

                  ZeroDivisionError is raised.

                  + +

                  mruby [3.1.0 (2022-05-12)]

                  + +

                  RuntimeError is raised instead of ZeroDivisionError. To re-raise the exception, you have to do:

                  + +
                  begin
                  +  1 / 0
                  +rescue => e
                  +  raise e
                  +end
                  +
                  + +

                  Fiber execution can’t cross C function boundary

                  + +

                  mruby’s Fiber is implemented similarly to Lua’s co-routine. This results in the consequence that you can’t switch context within C functions. Only exception is mrb_fiber_yield at return.

                  + +

                  Array does not support instance variables

                  + +

                  To reduce memory consumption Array does not support instance variables.

                  + +
                  class Liste < Array
                  +  def initialize(str = nil)
                  +    @field = str
                  +  end
                  +end
                  +
                  +p Liste.new "foobar"
                  +
                  + +

                  Ruby [ruby 2.0.0p645 (2015-04-13 revision 50299)]

                  + +

                  []

                  + +

                  mruby [3.1.0 (2022-05-12)]

                  + +

                  ArgumentError is raised.

                  + +

                  defined?

                  + +

                  The defined? keyword is considered too complex to be fully implemented. It is recommended to use const_defined? and other reflection methods instead.

                  + +
                  defined?(Foo)
                  +
                  + +

                  Ruby [ruby 2.0.0p645 (2015-04-13 revision 50299)]

                  + +
                  nil
                  +
                  + +

                  mruby [3.1.0 (2022-05-12)]

                  + +

                  NameError is raised.

                  + +

                  alias on global variables

                  + +

                  Aliasing a global variable works in CRuby but is not part of the ISO standard.

                  + +
                  alias $a $__a__
                  +
                  + +

                  Ruby [ruby 2.0.0p645 (2015-04-13 revision 50299)]

                  + +

                  nil

                  + +

                  mruby [3.1.0 (2022-05-12)]

                  + +

                  Syntax error

                  + +

                  Operator modification

                  + +

                  An operator can’t be overwritten by the user.

                  + +
                  class String
                  +  def +
                  +  end
                  +end
                  +
                  +'a' + 'b'
                  +
                  + +

                  Ruby [ruby 2.0.0p645 (2015-04-13 revision 50299)]

                  + +

                  ArgumentError is raised. The re-defined + operator does not accept any arguments.

                  + +

                  mruby [3.1.0 (2022-05-12)]

                  + +

                  'ab' Behavior of the operator wasn’t changed.

                  + +

                  Kernel#binding is not supported until [3.0.0 (2021-03-05)]

                  + +

                  Kernel#binding method is not supported.

                  + +

                  Ruby [ruby 2.5.1p57 (2018-03-29 revision 63029)]

                  + +
                  $ ruby -e 'puts Proc.new {}.binding'
                  +#<Binding:0x00000e9deabb9950>
                  +
                  + +

                  nil? redefinition in conditional expressions

                  + +

                  Redefinition of nil? is ignored in conditional expressions.

                  + +
                  a = "a"
                  +def a.nil?
                  +  true
                  +end
                  +puts(a.nil? ? "truthy" : "falsy")
                  +
                  + +

                  Ruby outputs truthy. mruby outputs falsy.

                  + +

                  Argument Destructuring

                  + +
                  def m(a,(b,c),d); p [a,b,c,d]; end
                  +m(1,[2,3],4)  # => [1,2,3,4]
                  +
                  + +

                  Destructured arguments (b and c in above example) cannot be accessed from the default expression of optional arguments and keyword arguments, since actual assignment is done after the evaluation of those default expressions. Thus:

                  + +
                  def f(a,(b,c),d=b)
                  +  p [a,b,c,d]
                  +end
                  +f(1,[2,3])
                  +
                  + +

                  CRuby gives [1,2,3,nil]. mruby raises NoMethodError for b.

                  + +

                  Keyword argument expansion has similar restrictions. The following example, gives [1, 1] for CRuby, mruby raises NoMethodError for b.

                  + +
                  def g(a: 1, b: a)
                  +  p [a,b]
                  +end
                  +g(a:1)
                  +
                  +
                  + + + +
                  + + \ No newline at end of file diff --git a/docs/api/file.link.html b/docs/api/file.link.html new file mode 100644 index 0000000..fe29a54 --- /dev/null +++ b/docs/api/file.link.html @@ -0,0 +1,152 @@ + + + + + + + File: link + + — Documentation by YARD 0.9.37 + + + + + + + + + + + + + + + + + + + + + + + +
                  + + +
                  +

                  Linking libmruby to your application

                  + +

                  You have two ways to link libmruby to your application.

                  +
                  • +

                    using executable gem.

                    +
                  • +

                    using normal compilation process

                    +
                  + +

                  Executable Gems

                  + +

                  If your application is relatively small, mrbgem is an easier way to create the executable. By tradition, the gem name start with mruby-bin-, e.g. mruby-bin-debugger.

                  + +

                  mrbgem.rake file

                  + +

                  The executable name is specified in mrbgem.rake file at the top of your mrbgem directory.

                  + +
                  MRuby::Gem::Specification.new('mruby-bin-example') do |spec|
                  +  spec.license = 'MIT'
                  +  spec.author  = 'mruby developers'
                  +  spec.summary = 'Example for executable command gem'
                  +  spec.bins = %w(mruby-example)    # <- this is binary name
                  +end
                  +
                  + +

                  Source tree structure

                  + +

                  The source file for the gem executable should be in <gem-name>/tools/<bin-name>. Currently, we support C or C++ source code (.c, .cpp, .cxx, .cc) for the executable. Ruby source files are not supported. Put the functionality in the different gem and specify dependency to it in mrbgem.rake.

                  + +

                  Normal compilation process

                  + +

                  The libmruby is a normal library so that you can just link it to your application. Specify proper compiler options (-I etc.) and linker options (-lmruby etc.) to compile and link your application. Specify those options in your build script (e.g. Makefile).

                  + +

                  Compiler options

                  + +

                  You need to specify compiler options that are compatible to mruby configuration, for example:

                  +
                  • +

                    -I to specify the place for mruby header files

                    +
                  • +

                    -D to specify mruby configuration macros

                    +
                  + +

                  To retrieve compiler options used to build mruby, you can use mruby-config command with following options:

                  +
                  • +

                    --cc compiler name

                    +
                  • +

                    --cflags options passed to compiler

                    +
                  + +
                  $ mruby-config --cflags
                  +-std=gnu99 -g -O3 -Wall -DMRB_GC_FIXED_ARENA -I/home/matz/work/mruby/include -I/home/matz/work/mruby/build/host/include
                  +
                  + +

                  Linker options

                  + +

                  Just like compiler options, you need to specify linker options that are compatible to mruby configuration.

                  + +

                  To retrieve linker options, you can use mruby-config with following options:

                  +
                  • +

                    --ld linker name

                    +
                  • +

                    --ldflags options passed to linker

                    +
                  • +

                    --ldflags-before-libs options passed to linker before linked libraries

                    +
                  • +

                    --libs linked libraries

                    +
                  + +
                  $ mruby-config --ldflags
                  +-L/home/matz/work/mruby/build/host/lib
                  +
                  +$ mruby-config --ldflags-before-libs
                  +# <nothing in this case>
                  +
                  +$ mruby-config --libs
                  +-lmruby -lm
                  +
                  +
                  + + + +
                  + + \ No newline at end of file diff --git a/docs/api/file.memory.html b/docs/api/file.memory.html new file mode 100644 index 0000000..c628d29 --- /dev/null +++ b/docs/api/file.memory.html @@ -0,0 +1,99 @@ + + + + + + + File: memory + + — Documentation by YARD 0.9.37 + + + + + + + + + + + + + + + + + + + + + + + +
                  + + +
                  +

                  Memory Allocation

                  + +

                  There are three methods to customize memory allocation in mruby.

                  +
                  1. +

                    Provide your own realloc()/free()

                    +
                  2. +

                    Redefine mrb_default_allocf()

                    +
                  3. +

                    Specify a function with mrb_open_allocf()

                    +
                  + +

                  Provide your own realloc()/free()

                  + +

                  On some platforms, especially on microcontrollers, the standard library may not provide malloc(), realloc(), and free(). In such cases, it may be necessary to define memory allocation functions for the specific platform. mruby uses realloc() and free() from the standard C library for memory management. By defining these two functions of your own, you can make mruby work. However, note the following two points:

                  + +

                  First, realloc(NULL, size) behaves the same as malloc(size). Second, free(NULL) exits without doing anything.

                  + +

                  Redefine mrb_default_allocf()

                  + +

                  The only function in mruby that uses the standard C library’s memory allocation functions is mrb_default_allocf(), defined in alloc.c. By defining this function within your application, you can customize the memory management of your application.

                  + +

                  Specify a function with mrb_open_allocf()

                  + +

                  If you want to perform different memory management for each mrb_state within your application, you can use the mrb_open_allocf() function to create the mrb_state structure. This allows you to specify a memory allocation function (which is compatible with mrb_default_allocf) for each mrb_state. Although this scheme is not recommended. It may become obsolete in the future, since I have never seen per mrb_state memory management use-case.

                  +
                  + + + +
                  + + \ No newline at end of file diff --git a/docs/api/file.mrbconf.html b/docs/api/file.mrbconf.html index 52ab1f8..8ae48d9 100644 --- a/docs/api/file.mrbconf.html +++ b/docs/api/file.mrbconf.html @@ -6,17 +6,17 @@ File: mrbconf - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -61,198 +61,333 @@
                  -

                  mruby configuration macros.

                  - -

                  How to use these macros.

                  -

                  You can use mrbconfs with following ways: -* Write them in mrbconf.h. - * Using compiler flags is preferred when building a cross binaries or multiple mruby binaries - since it’s easier to use different mrbconf per each MRuby::Build. - * Most flags can be enabled by just commenting in. -* Pass them as compiler flags. - * Make sure you pass the same flags to all compilers since some mrbconf(e.g., MRB_GC_FIXED_ARENA) - changes struct layout and cause memory access error when C and other language(e.g., C++) is mixed.

                  - -

                  stdio setting.

                  -

                  MRB_DISABLE_STDIO -* When defined <stdio.h> functions won’t be used. -* Some features will be disabled when this is enabled: - * mrb_irep load/dump from/to file. - * Compiling mruby script from file. - * Printing features in src/print.c.

                  - -

                  Debug macros.

                  -

                  MRB_ENABLE_DEBUG_HOOK -* When defined code fetch hook and debug OP hook will be enabled. -* When using any of the hook set function pointer code_fetch_hook and/or debug_op_hook of mrb_state. -* Fetch hook will be called before any OP. -* Debug OP hook will be called when dispatching OP_DEBUG.

                  - -

                  MRB_DEBUG -* When defined mrb_assert* macro will be defined with macros from <assert.h>. -* Could be enabled via enable_debug method of MRuby::Build.

                  - -

                  Stack configuration

                  - -

                  MRB_STACK_EXTEND_DOUBLING -* If defined doubles the stack size when extending it. -* Else extends stack with MRB_STACK_GROWTH.

                  - -

                  MRB_STACK_GROWTH -* Default value is 128. -* Used in stack extending. -* Ignored when MRB_STACK_EXTEND_DOUBLING is defined.

                  - -

                  MRB_STACK_MAX -* Default value is 0x40000 - MRB_STACK_GROWTH. -* Raises RuntimeError when stack size exceeds this value.

                  - -

                  Primitive type configuration.

                  - -

                  MRB_USE_FLOAT -* When defined single precision floating point type(C type float) is used as mrb_float. -* Else double precision floating point type(C type double) is used as mrb_float.

                  - -

                  MRB_WITHOUT_FLOAT -* When defined removes floating point numbers from mruby. -* It makes mruby easier to handle in “Microcontroller without FPU” and “Kernel Space”.

                  - -

                  MRB_INT16 -* When defined int16_t will be defined as mrb_int. -* Conflicts with MRB_INT32 and MRB_INT64.

                  - -

                  MRB_INT32 -* When defined, or both MRB_INT16 and MRB_INT64 are not defined on 32-bit CPU mode, int32_t will be defined as mrb_int. -* Conflicts with MRB_INT16 and MRB_INT64.

                  - -

                  MRB_INT64 -* When defined, or both MRB_INT16 and MRB_INT32 are not defined on 64-bit CPU mode, int64_t will be defined as mrb_int. -* Conflicts with MRB_INT16 and MRB_INT32.

                  - -

                  Garbage collector configuration.

                  - -

                  MRB_GC_STRESS -* When defined full GC is emitted per each RBasic allocation. -* Mainly used in memory manager debugging.

                  - -

                  MRB_GC_TURN_OFF_GENERATIONAL -* When defined turns generational GC by default.

                  - -

                  MRB_GC_FIXED_ARENA -* When defined used fixed size GC arena. -* Raises RuntimeError when this is defined and GC arena size exceeds MRB_GC_ARENA_SIZE. -* Useful tracking unnecessary mruby object allocation.

                  - -

                  MRB_GC_ARENA_SIZE -* Default value is 100. -* Ignored when MRB_GC_FIXED_ARENA isn’t defined. -* Defines fixed GC arena size.

                  - -

                  MRB_HEAP_PAGE_SIZE -* Defines value is 1024. -* Specifies number of RBasic per each heap page.

                  - -

                  Memory pool configuration.

                  - -

                  POOL_ALIGNMENT -* Default value is 4. -* If you’re allocating data types that requires alignment more than default value define the -largest value of required alignment.

                  - -

                  POOL_PAGE_SIZE -* Default value is 16000. -* Specifies page size of pool page. -* Smaller the value is increases memory overhead.

                  - -

                  State atexit configuration.

                  - -

                  MRB_FIXED_STATE_ATEXIT_STACK -* If defined enables fixed size mrb_state atexit stack. -* Raises RuntimeError when mrb_state_atexit call count to same mrb_state exceeds -MRB_FIXED_STATE_ATEXIT_STACK_SIZE’s value.

                  - -

                  MRB_FIXED_STATE_ATEXIT_STACK_SIZE -* Default value is 5. -* If MRB_FIXED_STATE_ATEXIT_STACK isn’t defined this macro is ignored.

                  - -

                  mrb_value configuration.

                  - -

                  MRB_ENDIAN_BIG -* If defined compiles mruby for big endian machines. -* Used in MRB_NAN_BOXING. -* Some mrbgem use this mrbconf.

                  - -

                  MRB_NAN_BOXING -* If defined represent mrb_value in boxed double. -* Conflicts with MRB_USE_FLOAT and MRB_WITHOUT_FLOAT.

                  - -

                  MRB_WORD_BOXING -* If defined represent mrb_value as a word. -* If defined Float will be a mruby object with RBasic.

                  - -

                  Instance variable configuration.

                  -

                  MRB_IV_SEGMENT_SIZE -* Default value is 4. -* Specifies size of each segment in segment list.

                  - -

                  Reduce heap memory configuration.

                  - -

                  MRB_USE_LINK_TIME_RO_DATA_P -* Only available on ELF platforms. -* If you specify the address of a read-only section when creating a symbol or string, that string will be used as it is. -* Heap memory can be saved. -* Uses __ehdr_start and __init_array_start. -* It must be __ehdr_start < data_addr < __init_array_start.

                  - -

                  MRB_USE_CUSTOM_RO_DATA_P -* Takes precedence over MRB_USE_LINK_TIME_RO_DATA_P. -* Please try if MRB_USE_LINK_TIME_RO_DATA_P is not available. -* The mrb_ro_data_p() function is implemented by the user in an arbitrary file. -* The prototype declaration is mrb_bool mrb_ro_data_p(const char *ptr). -* Return TRUE if ptr is in read-only section, otherwise return FALSE.

                  - -

                  Other configuration.

                  -

                  MRB_UTF8_STRING -* Adds UTF-8 encoding support to character-oriented String instance methods. -* If it isn’t defined, they only support the US-ASCII encoding.

                  - -

                  MRB_FUNCALL_ARGC_MAX -* Default value is 16. -* Specifies 4th argument(argc) max value of mrb_funcall. -* Raises ArgumentError when the argc argument is bigger then this value mrb_funcall.

                  - -

                  KHASH_DEFAULT_SIZE -* Default value is 32. -* Specifies default size of khash table bucket. -* Used in kh_init_ ## name function.

                  - -

                  MRB_STR_BUF_MIN_SIZE -* Default value is 128. -* Specifies initial capacity of RString created by mrb_str_buf_new function..

                  - -

                  MRB_METHOD_CACHE -* Improve performance for method dispatch.

                  - -

                  MRB_METHOD_CACHE_SIZE -* Default value is 128. -* Ignored if MRB_METHOD_CACHE is not defined. -* Need to be the power of 2.

                  - -

                  MRB_METHOD_T_STRUCT -* Use C struct to represent mrb_method_t -* No MRB_METHOD_T_STRUCT requires highest 2 bits of function pointers to be zero -* Define this macro on machines that use higher bits of pointers

                  - -

                  MRB_ENABLE_ALL_SYMBOLS -* Make it available Symbols.all_symbols in mrbgems/mruby-symbol-ext -* Increase heap memory usage.

                  +
                  +

                  mruby configuration macros

                  + +

                  The configuration file

                  + +

                  You can do the build configuration in the build configuration file. The default configuration file is build_config/default.rb.

                  + +

                  You can specify your own configuration file by the MRUBY_CONFIG environment variable (you can use CONFIG for shorthand for MRUBY_CONFIG). If the path doesn’t exist, build_config/${MRUBY_CONFIG}.rb is used.

                  + +

                  How to use these macros

                  + +

                  Just add the configuration value to the MRuby::Build#defines attribute. This is the same for MRuby::CrossBuild.

                  + +
                  # build_config.rb
                  +
                  +MRuby::Build.new do |conf|
                  +  ...
                  +  conf.defines << 'MRB_GC_FIXED_ARENA'
                  +  conf.defines << 'MRB_NO_METHOD_CACHE'
                  +  ...
                  +end
                  +
                  + +

                  NOTE

                  +
                  • +

                    Use common definitions (conf.defines) instead of per-compiler definitions (e.g., conf.cc.defines) unless there is a special reason not to.

                    +
                  • +

                    It is now deprecated to edit the include/mruby/mrbconf.h file or give it directly as a compiler flag, as was the case before.

                    +
                  + +

                  stdio setting

                  + +

                  MRB_NO_STDIO

                  +
                  • +

                    When defined <stdio.h> functions won’t be used.

                    +
                  • +

                    Some features will be disabled when this is enabled:

                    +
                  • +

                    mrb_irep load/dump from/to file.

                    +
                  • +

                    Compiling mruby script from a file.

                    +
                  • +

                    Printing features in src/print.c.

                    +
                  + +

                  Debug macros

                  + +

                  MRB_USE_DEBUG_HOOK

                  +
                  • +

                    When defined code fetch hook and debug OP hook will be enabled.

                    +
                  • +

                    When using any of the hook set function pointer code_fetch_hook and/or debug_op_hook of mrb_state.

                    +
                  • +

                    Fetch hook will be called before any OP.

                    +
                  • +

                    Debug OP hook will be called when dispatching OP_DEBUG.

                    +
                  + +

                  MRB_DEBUG

                  +
                  • +

                    When defined mrb_assert* macro will be defined with macros from <assert.h>.

                    +
                  • +

                    Could be enabled via enable_debug method of MRuby::Build.

                    +
                  + +

                  Stack configuration

                  + +

                  MRB_STACK_EXTEND_DOUBLING

                  +
                  • +

                    If defined doubles the stack size when extending it.

                    +
                  • +

                    Otherwise extends stack with MRB_STACK_GROWTH.

                    +
                  + +

                  MRB_STACK_GROWTH

                  +
                  • +

                    Default value is 128.

                    +
                  • +

                    Used in stack extending.

                    +
                  • +

                    Ignored when MRB_STACK_EXTEND_DOUBLING is defined.

                    +
                  + +

                  MRB_STACK_MAX

                  +
                  • +

                    Default value is 0x40000 - MRB_STACK_GROWTH.

                    +
                  • +

                    Raises RuntimeError when stack size exceeds this value.

                    +
                  + +

                  Primitive type configuration

                  + +

                  MRB_USE_FLOAT32

                  +
                  • +

                    When defined single-precision floating-point type(C type float) is used as mrb_float.

                    +
                  • +

                    Otherwise, double-precision floating-point type(C type double) is used as mrb_float.

                    +
                  + +

                  MRB_NO_FLOAT

                  +
                  • +

                    When defined removes floating-point numbers from mruby.

                    +
                  • +

                    It makes mruby easier to handle in “Micro-controller without FPU” and “Kernel Space”.

                    +
                  + +

                  MRB_INT32

                  +
                  • +

                    When defined, or MRB_INT64 are not defined on 32-bit CPU mode, mrb_int will be defined as int32_t.

                    +
                  • +

                    Conflicts with MRB_INT64.

                    +
                  + +

                  MRB_INT64

                  +
                  • +

                    When defined, or MRB_INT32 are not defined on 64-bit CPU mode, mrb_int will be defined as int64_t.

                    +
                  • +

                    Conflicts with MRB_INT32.

                    +
                  + +

                  Garbage collector configuration

                  + +

                  MRB_GC_STRESS

                  +
                  • +

                    When defined full GC is emitted per each RBasic allocation.

                    +
                  • +

                    Mainly used in memory manager debugging.

                    +
                  • +

                    If defined at the same time as MRB_DEBUG, full GC is emitted also per each heap allocation (mrb_malloc() or etc.). This configuration slows down mruby execution by a factor of 2 to 3 or even more.

                    +
                  + +

                  MRB_GC_TURN_OFF_GENERATIONAL

                  +
                  • +

                    When defined turns generational GC off by default.

                    +
                  + +

                  MRB_GC_FIXED_ARENA

                  +
                  • +

                    When defined used fixed size GC arena.

                    +
                  • +

                    Raises RuntimeError when this is defined and GC arena size exceeds MRB_GC_ARENA_SIZE.

                    +
                  • +

                    Useful tracking unnecessary mruby object allocation.

                    +
                  + +

                  MRB_GC_ARENA_SIZE

                  +
                  • +

                    Default value is 100.

                    +
                  • +

                    Ignored when MRB_GC_FIXED_ARENA isn’t defined.

                    +
                  • +

                    Defines fixed GC arena size.

                    +
                  + +

                  MRB_HEAP_PAGE_SIZE

                  +
                  • +

                    Default value is 1024.

                    +
                  • +

                    Specifies number of RBasic per each heap page.

                    +
                  • +

                    To calculate the number of bytes per heap page, it is “(size of management data per heap page) + (size per object) * MRB_HEAP_PAGE_SIZE”. In mruby 3.1.0, the “size of management data per heap page” is 6 words, also “size per object” is 6 words. For a 32-bit CPU, (6 * 4) + (6 * 4) * MRB_HEAP_PAGE_SIZE gives the bytes of size per heap page. Conversely, for example, to keep the size per heap page to 4 Ki bytes, calculate (4096 - (6 * 4)) / (6 * 4) to specify MRB_HEAP_PAGE_SIZE=169.

                    +
                  + +

                  Memory pool configuration

                  + +

                  POOL_ALIGNMENT

                  +
                  • +

                    Default value is 4.

                    +
                  • +

                    If you’re allocating data types that requires alignment more than default value define the largest value of required alignment.

                    +
                  + +

                  POOL_PAGE_SIZE

                  +
                  • +

                    Default value is 16000.

                    +
                  • +

                    Specifies page size of pool page.

                    +
                  • +

                    Smaller the value is increases memory overhead.

                    +
                  + +

                  State atexit configuration

                  + +

                  MRB_FIXED_STATE_ATEXIT_STACK

                  +
                  • +

                    If defined enables fixed size mrb_state atexit stack.

                    +
                  • +

                    Raises RuntimeError when mrb_state_atexit call count to same mrb_state exceeds MRB_FIXED_STATE_ATEXIT_STACK_SIZE‘s value.

                    +
                  + +

                  MRB_FIXED_STATE_ATEXIT_STACK_SIZE

                  +
                  • +

                    Default value is 5.

                    +
                  • +

                    If MRB_FIXED_STATE_ATEXIT_STACK isn’t defined this macro is ignored.

                    +
                  + +

                  mrb_value configuration

                  + +

                  MRB_ENDIAN_BIG

                  +
                  • +

                    If defined compiles mruby for big endian machines.

                    +
                  • +

                    Used in MRB_NAN_BOXING.

                    +
                  • +

                    Some mrbgem use this mrbconf.

                    +
                  + +

                  MRB_NAN_BOXING

                  +
                  • +

                    If defined represent mrb_value in boxed double.

                    +
                  • +

                    Conflicts with MRB_USE_FLOAT32 and MRB_NO_FLOAT.

                    +
                  + +

                  MRB_WORD_BOXING

                  +
                  • +

                    If defined represent mrb_value as a word.

                    +
                  • +

                    If defined Float will be a mruby object with RBasic.

                    +
                  + +

                  Reduce heap memory configuration

                  + +

                  MRB_USE_ETEXT_RO_DATA_P

                  +
                  • +

                    Use etext and edata section addresses defined by the linker to detect read-only data.

                    +
                  • +

                    Those addresses are widely available, but not portable, nor standardized.

                    +
                  • +

                    This macro is defined by default on User-mode Linux.

                    +
                  + +

                  MRB_NO_DEFAULT_RO_DATA_P

                  +
                  • +

                    Define this macro when the default mrb_ro_data_p() does not work for any reason.

                    +
                  + +

                  MRB_USE_CUSTOM_RO_DATA_P

                  +
                  • +

                    Please try if MRB_USE_LINK_TIME_RO_DATA_P is not available.

                    +
                  • +

                    The mrb_ro_data_p() function is implemented by the user in an arbitrary file.

                    +
                  • +

                    The prototype declaration is mrb_bool mrb_ro_data_p(const char *ptr).

                    +
                  • +

                    Return TRUE if ptr is in the read-only section, otherwise return FALSE.

                    +
                  + +

                  Other configuration

                  + +

                  MRB_MALLOC_TRIM

                  +
                  • +

                    call malloc_trim(0) for each mrb_full_gc() call

                    +
                  + +

                  MRB_UTF8_STRING

                  +
                  • +

                    Adds UTF-8 encoding support to character-oriented String instance methods.

                    +
                  • +

                    If it isn’t defined, they only support the US-ASCII encoding.

                    +
                  + +

                  MRB_STR_LENGTH_MAX

                  +
                  • +

                    The maximum length of strings (default 1MB)

                    +
                  • +

                    set this value to zero to skip the check

                    +
                  + +

                  MRB_ARY_LENGTH_MAX

                  +
                  • +

                    The maximum length of arrays (default 1MB)

                    +
                  • +

                    set this value to zero to skip the check

                    +
                  + +

                  MRB_FUNCALL_ARGC_MAX

                  +
                  • +

                    Default value is 16.

                    +
                  • +

                    Specifies 4th argument(argc) max value of mrb_funcall.

                    +
                  • +

                    Raises ArgumentError when the argc argument is bigger then this value mrb_funcall.

                    +
                  + +

                  KHASH_DEFAULT_SIZE

                  +
                  • +

                    Default value is 32.

                    +
                  • +

                    Specifies default size of khash table bucket.

                    +
                  • +

                    Used in kh_init_ ## name function.

                    +
                  + +

                  MRB_NO_METHOD_CACHE

                  +
                  • +

                    Disable method cache to save memory.

                    +
                  + +

                  MRB_METHOD_CACHE_SIZE

                  +
                  • +

                    Default value is 256.

                    +
                  • +

                    Ignored if MRB_NO_METHOD_CACHE is defined.

                    +
                  • +

                    Need to be the power of 2.

                    +
                  + +

                  MRB_USE_ALL_SYMBOLS

                  +
                  • +

                    Make it available Symbol.all_symbols in mrbgems/mruby-symbol-ext

                    +
                  • +

                    Increase heap memory usage.

                    +
                  + +

                  MRB_USE_VM_SWITCH_DISPATCH

                  +
                  • +

                    Turn on switch dispatch in VM loop

                    +
                  - +
                  diff --git a/docs/api/file.mrbgems.html b/docs/api/file.mrbgems.html index 3f3bd9a..50a2c34 100644 --- a/docs/api/file.mrbgems.html +++ b/docs/api/file.mrbgems.html @@ -6,17 +6,17 @@ File: mrbgems - — Documentation by YARD 0.9.20 + — Documentation by YARD 0.9.37 - + - + - + - @@ -61,372 +61,418 @@
                  -

                  mrbgems

                  +
                  +

                  mrbgems

                  -

                  mrbgems is a library manager to integrate C and Ruby extension in an easy and -standardised way into mruby.

                  +

                  mrbgems is a library manager to integrate C and Ruby extensions in an easy and standardised way into mruby. Conventionally, each mrbgem name is prefixed by mruby-, e.g. mruby-time for a gem that provides Time class functionality.

                  -

                  Usage

                  +

                  Usage

                  -

                  By default mrbgems is currently deactivated. As soon as you add a GEM to your -build configuration (i.e. build_config.rb), mrbgems will be activated and the -extension integrated.

                  +

                  You have to activate mrbgems explicitly in your build configuration. To add a gem, add the following line to your build configuration file, for example:

                  -

                  To add a GEM into the build_config.rb add the following line for example: -ruby -conf.gem '/path/to/your/gem/dir' -

                  +
                  conf.gem '/path/to/your/gem/dir'
                  +
                  -

                  You can also use a relative path which would be relative from the mruby root: -ruby -conf.gem 'examples/mrbgems/ruby_extension_example' -

                  +

                  You can also use a relative path to specify a gem.

                  -

                  A remote GIT repository location for a GEM is also supported: -ruby -conf.gem :git => 'https://github.com/masuidrive/mrbgems-example.git', :branch => 'master' -conf.gem :github => 'masuidrive/mrbgems-example', :branch => 'master' -conf.gem :bitbucket => 'mruby/mrbgems-example', :branch => 'master' -

                  +
                  conf.gem 'examples/mrbgems/ruby_extension_example'
                  +
                  -

                  You can specify the sub directory of the repository with :path option: -ruby -conf.gem github: 'mruby/mruby', path: 'mrbgems/mruby-socket' -

                  +

                  In that case,

                  +
                  • +

                    if your build configuration file is in the build_config directory, it’s relative from MRUBY_ROOT.

                    +
                  • +

                    otherwise, it is relative from the directory where your build configuration is.

                    +
                  -

                  To use mrbgem from mgem-list use :mgem option: -ruby -conf.gem :mgem => 'mruby-yaml' -conf.gem :mgem => 'yaml' # 'mruby-' prefix could be omitted -

                  +

                  A remote GIT repository location for a GEM is also supported:

                  -

                  For specifying commit hash to checkout use :checksum_hash option: -ruby -conf.gem mgem: 'mruby-redis', checksum_hash: '3446d19fc4a3f9697b5ddbf2a904f301c42f2f4e' -

                  +
                  conf.gem :git => 'https://github.com/masuidrive/mrbgems-example.git', :branch => 'master'
                  +conf.gem :github => 'masuidrive/mrbgems-example', :branch => 'master'
                  +conf.gem :bitbucket => 'mruby/mrbgems-example', :branch => 'master'
                  +
                  -

                  If there is missing dependencies, mrbgem dependencies solver will reference -mrbgem from core or mgem-list.

                  +

                  NOTE: :bitbucket option supports only git. Hg is unsupported in this version.

                  -

                  To pull all gems from remote GIT repository on build, call ./minirake -p, -or ./minirake --pull-gems.

                  +

                  You can specify the subdirectory of the repository with :path option:

                  -

                  NOTE: :bitbucket option supports only git. Hg is unsupported in this version.

                  +
                  conf.gem github: 'mruby/mruby', path: 'mrbgems/mruby-socket'
                  +
                  + +

                  To use mrbgem from mgem-list use :mgem option:

                  + +
                  conf.gem :mgem => 'mruby-yaml'
                  +conf.gem :mgem => 'yaml' # 'mruby-' prefix could be omitted
                  +
                  + +

                  For specifying the commit hash to checkout use :checksum_hash option:

                  + +
                  conf.gem mgem: 'mruby-redis', checksum_hash: '3446d19fc4a3f9697b5ddbf2a904f301c42f2f4e'
                  +
                  + +

                  If there are missing dependencies, mrbgem dependencies solver will reference mrbgem from the core or mgem-list.

                  + +

                  Note that if more than one git-based gem has the same base name (i.e. the default checkout directory name), it is (now) an error UNLESS they have the same repository URL, branch name and commit-id (i.e. checksum hash). You can bypass this by explicitly importing your preferred version first and setting the canonical: option to true:

                  + +
                  conf.gem github: 'me/mruby-yaml', branch: 'my-hacked-branch', canonical: true
                  +
                  + +

                  If you do this, the system will (mostly) silently ignore other attempts to clone a gem with this name.

                  + +

                  Note that this only affects cloning the gem from git. It does not resolve version conflicts. If the version as specified in the gem’s rakefile is incompatible with a dependency, your build will still fail.

                  -

                  GemBox

                  - -

                  There are instances when you wish to add a collection of mrbgems into mruby at -once, or be able to substitute mrbgems based on configuration, without having to -add each gem to the build_config.rb file. A packaged collection of mrbgems -is called a GemBox. A GemBox is a file that contains a list of mrbgems to load -into mruby, in the same format as if you were adding them to build_config.rb -via config.gem, but wrapped in an MRuby::GemBox object. GemBoxes are -loaded into mruby via config.gembox 'boxname'.

                  - -

                  Below we have created a GemBox containing mruby-time and mrbgems-example: -ruby -MRuby::GemBox.new do |conf| - conf.gem "#{root}/mrbgems/mruby-time" - conf.gem :github => 'masuidrive/mrbgems-example' -end -

                  - -

                  As mentioned, the GemBox uses the same conventions as MRuby::Build. The GemBox -must be saved with a .gembox extension inside the mrbgems directory to to be -picked up by mruby.

                  - -

                  To use this example GemBox, we save it as custom.gembox inside the mrbgems -directory in mruby, and add the following to our build_config.rb file inside -the build block: -ruby -conf.gembox 'custom' - -This will cause the custom GemBox to be read in during the build process, -adding mruby-time and mrbgems-example to the build.

                  - -

                  If you want, you can put GemBox outside of mruby directory. In that case you must -specify an absolute path like below. -ruby -conf.gembox "#{ENV["HOME"]}/mygemboxes/custom" -

                  - -

                  There are two GemBoxes that ship with mruby: default -and full-core. The default GemBox -contains several core components of mruby, and full-core -contains every gem found in the mrbgems directory.

                  - -

                  GEM Structure

                  +

                  Tweak the gem in your build configuration file

                  + +

                  You can give blocks in the conf.gem call to make adjustments for environments where the original gem does not expect them:

                  + +
                  conf.gem core: "mruby-bin-mirb" do |g|
                  +  # For cross build to NetBSD
                  +  g.linker.libraries = %w(edit termcap)
                  +end
                  +
                  + +

                  However, it should be used with caution, as it may deviate from the intent of the gem’s author.

                  + +

                  Gem Testing

                  + +

                  If you enable unit tests in your build with enable_test, tests will be generated for all gems and their dependencies by default. If necessary, it is possible to suppress tests for a specific gem like so:

                  + +
                  conf.gem 'mruby-noisygem' do |g|
                  +  g.skip_test = true
                  +end
                  +
                  + +

                  However, it is considered best practice to leave all tests enabled whenever possible. A warning message will be generated for each gem with disabled tests.

                  + +

                  GemBox

                  + +

                  There are instances when you wish to add a collection of mrbgems into mruby at once, or be able to substitute mrbgems based on configuration, without having to add each gem to your build configuration file. A packaged collection of mrbgems is called a GemBox. A GemBox is a file that contains a list of mrbgems to load into mruby, in the same format as if you were adding them to the build config via config.gem, but wrapped in an MRuby::GemBox object. GemBoxes are loaded into mruby via config.gembox 'boxname'.

                  + +

                  Below we have created a GemBox containing mruby-time and mrbgems-example:

                  + +
                  MRuby::GemBox.new do |conf|
                  +  conf.gem "#{root}/mrbgems/mruby-time"
                  +  conf.gem :github => 'masuidrive/mrbgems-example'
                  +end
                  +
                  + +

                  As mentioned, the GemBox uses the same conventions as MRuby::Build. The GemBox must be saved with a .gembox extension inside the mrbgems directory to be picked up by mruby.

                  + +

                  To use this example GemBox, we save it as custom.gembox inside the mrbgems directory in mruby, and add the following to your build configuration file inside the build block:

                  + +
                  conf.gembox 'custom'
                  +
                  + +

                  This will cause the custom GemBox to be read in during the build process, adding mruby-time and mrbgems-example to the build.

                  + +

                  If you want, you can put GemBox outside the mruby directory. In that case you must specify an absolute path like below.

                  + +
                  conf.gembox "#{ENV["HOME"]}/mygemboxes/custom"
                  +
                  + +

                  There are two GemBoxes that ship with mruby: default and full-core. The default GemBox contains several core components of mruby, and full-core contains every gem found in the mrbgems directory.

                  + +

                  GEM Structure

                  The maximal GEM structure looks like this:

                  -
                  +- GEM_NAME         <- Name of GEM
                  -   |
                  -   +- include/      <- Header for Ruby extension (will exported)
                  -   |
                  -   +- mrblib/       <- Source for Ruby extension
                  -   |
                  -   +- src/          <- Source for C extension
                  -   |
                  -   +- test/         <- Test code (Ruby)
                  -   |
                  -   +- mrbgem.rake   <- GEM Specification
                  -   |
                  -   +- README.md     <- Readme for GEM
                  +
                  +- GEM_NAME             <- Name of GEM
                  +    |
                  +    +- README.md        <- Readme for GEM
                  +    |
                  +    +- mrbgem.rake      <- GEM Specification
                  +    |
                  +    +- include/         <- Header for Ruby extension (will exported)
                  +    |
                  +    +- mrblib/          <- Source for Ruby extension
                  +    |
                  +    +- src/             <- Source for C extension
                  +    |
                  +    +- tools/           <- Source for Executable (in C)
                  +    |
                  +    +- test/            <- Test code (Ruby)
                  +
                  + +

                  The mrblib directory contains pure Ruby files to extend mruby. The src directory contains C/C++ files to extend mruby. The include directory contains C/C++ header files. The test directory contains C/C++ and pure Ruby files for testing purposes which will be used by mrbtest. mrbgem.rake contains the specification to compile C and Ruby files. README.md is a short description of your GEM.

                  + +

                  Build process

                  + +

                  mrbgems expects a specification file called mrbgem.rake inside of your GEM directory. A typical GEM specification could look like this for example:

                  + +
                  MRuby::Gem::Specification.new('c_and_ruby_extension_example') do |spec|
                  +  spec.license = 'MIT'
                  +  spec.author  = 'mruby developers'
                  +  spec.summary = 'Example mrbgem using C and Ruby'
                  +end
                   
                  -

                  The folder mrblib contains pure Ruby files to extend mruby. The folder src -contains C/C++ files to extend mruby. The folder include contains C/C++ header -files. The folder test contains C/C++ and pure Ruby files for testing purposes -which will be used by mrbtest. mrbgem.rake contains the specification -to compile C and Ruby files. README.md is a short description of your GEM.

                  - -

                  Build process

                  - -

                  mrbgems expects a specification file called mrbgem.rake inside of your -GEM directory. A typical GEM specification could look like this for example: -ruby -MRuby::Gem::Specification.new('c_and_ruby_extension_example') do |spec| - spec.license = 'MIT' - spec.author = 'mruby developers' - spec.summary = 'Example mrbgem using C and ruby' -end -

                  - -

                  The mrbgems build process will use this specification to compile Object and Ruby -files. The compilation results will be added to lib/libmruby.a. This file exposes -the GEM functionality to tools like mruby and mirb.

                  - -

                  The following properties can be set inside of your MRuby::Gem::Specification for -information purpose:

                  - -
                    -
                  • spec.license or spec.licenses (A single license or a list of them under which this GEM is licensed)
                  • -
                  • spec.author or spec.authors (Developer name or a list of them)
                  • -
                  • spec.version (Current version)
                  • -
                  • spec.description (Detailed description)
                  • -
                  • spec.summary -
                      -
                    • One line short description of mrbgem.
                    • -
                    • Printed in build summary of rake when set.
                    • -
                    -
                  • -
                  • spec.homepage (Homepage)
                  • -
                  • spec.requirements (External requirements as information for user)
                  • -
                  +

                  The mrbgems build process will use this specification to compile Object and Ruby files. The compilation results will be added to lib/libmruby.a. This file exposes the GEM functionality to tools like mruby and mirb.

                  + +

                  The following properties can be set inside your MRuby::Gem::Specification for information purpose:

                  +
                  • +

                    spec.license or spec.licenses (A single license or a list of them under which this GEM is licensed)

                    +
                  • +

                    spec.author or spec.authors (Developer name or a list of them)

                    +
                  • +

                    spec.version (Current version)

                    +
                  • +

                    spec.description (Detailed description)

                    +
                  • +

                    spec.summary

                    +
                  • +

                    One line short description of mrbgem.

                    +
                  • +

                    Printed in build summary of rake when set.

                    +
                  • +

                    spec.homepage (Homepage)

                    +
                  • +

                    spec.requirements (External requirements as information for user)

                    +

                  The license and author properties are required in every GEM!

                  -

                  In case your GEM is depending on other GEMs please use -spec.add_dependency(gem, *requirements[, default_get_info]) like: -```ruby -MRuby::Gem::Specification.new(‘c_and_ruby_extension_example’) do |spec| - spec.license = ‘MIT’ - spec.author = ‘mruby developers’

                  +

                  In case your GEM is depending on other GEMs please use spec.add_dependency(gem, *requirements[, default_get_info]) like:

                  -

                  # Add GEM dependency mruby-parser. - # The version must be between 1.0.0 and 1.5.2 . - spec.add_dependency(‘mruby-parser’, ‘>= 1.0.0’, ‘<= 1.5.2’)

                  +
                  MRuby::Gem::Specification.new('c_and_ruby_extension_example') do |spec|
                  +  spec.license = 'MIT'
                  +  spec.author  = 'mruby developers'
                   
                  -

                  # Use any version of mruby-uv from github. - spec.add_dependency(‘mruby-uv’, ‘>= 0.0.0’, :github => ‘mattn/mruby-uv’)

                  + # Add GEM dependency mruby-parser. + # The version must be between 1.0.0 and 1.5.2 . + spec.add_dependency('mruby-parser', '>= 1.0.0', '<= 1.5.2') -

                  # Use latest mruby-onig-regexp from github. (version requirements can be omitted) - spec.add_dependency(‘mruby-onig-regexp’, :github => ‘mattn/mruby-onig-regexp’)

                  + # Use any version of mruby-uv from GitHub. + spec.add_dependency('mruby-uv', '>= 0.0.0', :github => 'mattn/mruby-uv') -

                  # You can add extra mgems active only on test - spec.add_test_dependency(‘mruby-process’, :github => ‘iij/mruby-process’) -end -```

                  + # Use latest mruby-onig-regexp from GitHub. (version requirements can be omitted) + spec.add_dependency('mruby-onig-regexp', :github => 'mattn/mruby-onig-regexp') + + # You can add extra mgems active only on test + spec.add_test_dependency('mruby-process', :github => 'iij/mruby-process') +end +

                  The version requirements and default gem information are optional.

                  -

                  Version requirement supports following operators: -* ‘=’: is equal -* ‘!=’: is not equal -* ‘>’: is greater -* ‘<’: is lesser -* ‘>=’: is equal or greater -* ‘<=’: is equal or lesser -* ‘~>’: is equal or greater and is lesser than the next major version - * example 1: ‘~> 2.2.2’ means ‘>= 2.2.2’ and ‘< 2.3.0’ - * example 2: ‘~> 2.2’ means ‘>= 2.2.0’ and ‘< 3.0.0’

                  +

                  Version requirement supports following operators:

                  +
                  • +

                    ‘=’: is equal

                    +
                  • +

                    ‘!=’: is not equal

                    +
                  • +

                    ‘>’: is greater

                    +
                  • +

                    ‘<’: is lesser

                    +
                  • +

                    ‘>=’: is equal or greater

                    +
                  • +

                    ‘<=’: is equal or lesser

                    +
                  • +

                    ‘~>’: is equal or greater and is lesser than the next major version

                    +
                  • +

                    example 1: ‘~> 2.2.2’ means ‘>= 2.2.2’ and ‘< 2.3.0’

                    +
                  • +

                    example 2: ‘~> 2.2’ means ‘>= 2.2.0’ and ‘< 3.0.0’

                    +

                  When more than one version requirements is passed, the dependency must satisfy all of it.

                  -

                  You can have default gem to use as dependency when it’s not defined in build_config.rb. -When the last argument of add_dependency call is Hash, it will be treated as default gem information. -Its format is same as argument of method MRuby::Build#gem, expect that it can’t be treated as path gem location.

                  - -

                  When a special version of dependency is required, -use MRuby::Build#gem in build_config.rb to override default gem.

                  - -

                  If you have conflicting GEMs use the following method: -* spec.add_conflict(gem, *requirements) - * The requirements argument is same as in add_dependency method.

                  - -

                  like following code: -```ruby -MRuby::Gem::Specification.new ‘some-regexp-binding’ do |spec| - spec.license = ‘BSD’ - spec.author = ‘John Doe’

                  - -

                  spec.add_conflict ‘mruby-onig-regexp’, ‘> 0.0.0’ - spec.add_conflict ‘mruby-hs-regexp’ - spec.add_conflict ‘mruby-pcre-regexp’ - spec.add_conflict ‘mruby-regexp-pcre’ -end -```

                  - -

                  In case your GEM has more complex build requirements you can use -the following options additionally inside of your GEM specification:

                  - -
                    -
                  • spec.cc.flags (C compiler flags)
                  • -
                  • spec.cc.defines (C compiler defines)
                  • -
                  • spec.cc.include_paths (C compiler include paths)
                  • -
                  • spec.linker.flags (Linker flags)
                  • -
                  • spec.linker.libraries (Linker libraries)
                  • -
                  • spec.linker.library_paths (Linker additional library path)
                  • -
                  • spec.bins (Generate binary file)
                  • -
                  • spec.rbfiles (Ruby files to compile)
                  • -
                  • spec.objs (Object files to compile)
                  • -
                  • spec.test_rbfiles (Ruby test files for integration into mrbtest)
                  • -
                  • spec.test_objs (Object test files for integration into mrbtest)
                  • -
                  • spec.test_preload (Initialization files for mrbtest)
                  • -
                  - -

                  You also can use spec.mruby.cc and spec.mruby.linker to add extra global parameters for compiler and linker.

                  - -

                  include_paths and dependency

                  - -

                  Your GEM can export include paths to another GEMs that depends on your GEM. -By default, /...absolute path.../{GEM_NAME}/include will be exported. -So it is recommended not to put GEM’s local header files on include/.

                  - -

                  These exports are retroactive. -For example: when B depends to C and A depends to B, A will get include paths exported by C.

                  - -

                  Exported include_paths are automatically appended to GEM local include_paths by Minirake. -You can use spec.export_include_paths accessor if you want more complex build.

                  - -

                  C Extension

                  - -

                  mruby can be extended with C. This is possible by using the C API to -integrate C libraries into mruby.

                  - -

                  Preconditions

                  - -

                  mrbgems expects that you have implemented a C method called -mrb_YOURGEMNAME_gem_init(mrb_state). YOURGEMNAME will be replaced -by the name of your GEM. If you call your GEM c_extension_example, your -initialisation method could look like this: -C -void +

                  You can have default gem to use as dependency when it’s not defined in your build configuration. When the last argument of add_dependency call is Hash, it will be treated as default gem information. Its format is same as argument of method MRuby::Build#gem, expect that it can’t be treated as path gem location.

                  + +

                  When a special version of dependency is required, use MRuby::Build#gem in the build configuration to override default gem.

                  + +

                  If you have conflicting GEMs use the following method:

                  +
                  • +

                    spec.add_conflict(gem, *requirements)

                    +
                  • +

                    The requirements argument is same as in add_dependency method.

                    +
                  + +

                  like following code:

                  + +
                  MRuby::Gem::Specification.new 'some-regexp-binding' do |spec|
                  +  spec.license = 'BSD'
                  +  spec.author = 'John Doe'
                  +
                  +  spec.add_conflict 'mruby-onig-regexp', '> 0.0.0'
                  +  spec.add_conflict 'mruby-hs-regexp'
                  +  spec.add_conflict 'mruby-pcre-regexp'
                  +  spec.add_conflict 'mruby-regexp-pcre'
                  +end
                  +
                  + +

                  In case your GEM has more complex build requirements you can use the following options additionally inside your GEM specification:

                  +
                  • +

                    spec.cc.flags (C compiler flags)

                    +
                  • +

                    spec.cc.defines (C compiler defines)

                    +
                  • +

                    spec.cc.include_paths (C compiler include paths)

                    +
                  • +

                    spec.linker.flags (Linker flags)

                    +
                  • +

                    spec.linker.libraries (Linker libraries)

                    +
                  • +

                    spec.linker.library_paths (Linker additional library path)

                    +
                  • +

                    spec.bins (Generate binary file)

                    +
                  • +

                    spec.rbfiles (Ruby files to compile)

                    +
                  • +

                    spec.objs (Object files to compile)

                    +
                  • +

                    spec.test_rbfiles (Ruby test files for integration into mrbtest)

                    +
                  • +

                    spec.test_objs (Object test files for integration into mrbtest)

                    +
                  • +

                    spec.test_preload (Initialization files for mrbtest)

                    +
                  + +

                  You also can use spec.mruby.cc and spec.mruby.linker to add extra global parameters for the compiler and linker.

                  + +

                  include_paths and dependency

                  + +

                  Your GEM can export include paths to another GEMs that depends on your GEM. By default, /...absolute path.../{GEM_NAME}/include will be exported. So it is recommended not to put GEM’s local header files on include/.

                  + +

                  These exports are retroactive. For example: when B depends on C and A depends on B, A will get include paths exported by C.

                  + +

                  Exported include_paths are automatically appended to GEM local include_paths by rake. You can use spec.export_include_paths accessor if you want more complex build.

                  + +

                  C Extension

                  + +

                  mruby can be extended with C. This is possible by using the C API to integrate C libraries into mruby.

                  + +

                  Preconditions

                  + +

                  mrbgems expects that you have implemented a C method called mrb_YOURGEMNAME_gem_init(mrb_state). YOURGEMNAME will be replaced by the name of your GEM. If you call your GEM c_extension_example, your initialisation method could look like this:

                  + +
                  void
                   mrb_c_extension_example_gem_init(mrb_state* mrb) {
                  -  struct RClass *class_cextension = mrb_define_module(mrb, "CExtension");
                  -  mrb_define_class_method(mrb, class_cextension, "c_method", mrb_c_method, MRB_ARGS_NONE());
                  +  struct RClass *class_cextension = mrb_define_module(mrb, "CExtension");
                  +  mrb_define_class_method(mrb, class_cextension, "c_method", mrb_c_method, MRB_ARGS_NONE());
                   }
                  -

                  +
                  -

                  Finalize

                  +

                  Finalize

                  -

                  mrbgems expects that you have implemented a C method called -mrb_YOURGEMNAME_gem_final(mrb_state). YOURGEMNAME will be replaced -by the name of your GEM. If you call your GEM c_extension_example, your -finalizer method could look like this:

                  +

                  mrbgems expects that you have implemented a C method called mrb_YOURGEMNAME_gem_final(mrb_state). YOURGEMNAME will be replaced by the name of your GEM. If you call your GEM c_extension_example, your finalizer method could look like this:

                  -

                  C -void +

                  void
                   mrb_c_extension_example_gem_final(mrb_state* mrb) {
                     free(someone);
                   }
                  -

                  +
                  -

                  Example

                  +

                  Example

                  +- c_extension_example/
                  -   |
                  -   +- src/
                  -   |  |
                  -   |  +- example.c         <- C extension source
                  -   |
                  -   +- test/
                  -   |  |
                  -   |  +- example.rb        <- Test code for C extension
                  -   |
                  -   +- mrbgem.rake          <- GEM specification
                  -   |
                  -   +- README.md
                  +    |
                  +    +- README.md        (Optional)
                  +    |
                  +    +- src/
                  +    |   |
                  +    |   +- example.c    <- C extension source
                  +    |
                  +    +- test/
                  +    |   |
                  +    |   +- example.rb   <- Test code for C extension
                  +    |
                  +    +- mrbgem.rake      <- GEM specification
                   
                  -

                  Ruby Extension

                  +

                  Ruby Extension

                  -

                  mruby can be extended with pure Ruby. It is possible to override existing -classes or add new ones in this way. Put all Ruby files into the mrblib -folder.

                  +

                  mruby can be extended with pure Ruby. It is possible to override existing classes or add new ones in this way. Put all Ruby files into the mrblib directory.

                  -

                  Pre-Conditions

                  +

                  Pre-Conditions

                  none

                  -

                  Example

                  +

                  Example

                  +- ruby_extension_example/
                  -   |
                  -   +- mrblib/
                  -   |  |
                  -   |  +- example.rb        <- Ruby extension source
                  -   |
                  -   +- test/
                  -   |  |
                  -   |  +- example.rb        <- Test code for Ruby extension
                  -   |
                  -   +- mrbgem.rake          <- GEM specification
                  -   |
                  -   +- README.md
                  +    |
                  +    +- README.md        (Optional)
                  +    |
                  +    +- mrblib/
                  +    |   |
                  +    |   +- example.rb   <- Ruby extension source
                  +    |
                  +    +- test/
                  +    |   |
                  +    |   +- example.rb   <- Test code for Ruby extension
                  +    |
                  +    +- mrbgem.rake      <- GEM specification
                   
                  -

                  C and Ruby Extension

                  +

                  C and Ruby Extension

                  -

                  mruby can be extended with C and Ruby at the same time. It is possible to -override existing classes or add new ones in this way. Put all Ruby files -into the mrblib folder and all C files into the src folder.

                  +

                  mruby can be extended with C and Ruby at the same time. It is possible to override existing classes or add new ones in this way. Put all Ruby files into the mrblib directory and all C files into the src directory.

                  -

                  mruby codes under mrblib directory would be executed after gem init C -function is called. Make sure mruby script depends on C code and -C code doesn’t depend on mruby script.

                  +

                  mruby codes under mrblib directory would be executed after gem init C function is called. Make sure mruby script depends on C code and C code doesn’t depend on mruby script.

                  -

                  Pre-Conditions

                  +

                  Pre-Conditions

                  See C and Ruby example.

                  -

                  Example

                  +

                  Example

                  +- c_and_ruby_extension_example/
                  -   |
                  -   +- mrblib/
                  -   |  |
                  -   |  +- example.rb        <- Ruby extension source
                  -   |
                  -   +- src/
                  -   |  |
                  -   |  +- example.c         <- C extension source
                  -   |
                  -   +- test/
                  -   |  |
                  -   |  +- example.rb        <- Test code for C and Ruby extension
                  -   |
                  -   +- mrbgem.rake          <- GEM specification
                  -   |
                  -   +- README.md
                  +    |
                  +    +- README.md        (Optional)
                  +    |
                  +    +- mrblib/
                  +    |   |
                  +    |   +- example.rb   <- Ruby extension source
                  +    |
                  +    +- src/
                  +    |   |
                  +    |   +- example.c    <- C extension source
                  +    |
                  +    +- test/
                  +    |   |
                  +    |   +- example.rb   <- Test code for C and Ruby extension
                  +    |
                  +    +- mrbgem.rake      <- GEM specification
                  +
                  + +

                  Binary gems

                  + +

                  Some gems can generate executables under bin directory. Those gems are called binary gems. Names of binary gems are conventionally prefixed by mruby-bin, e.g. mruby-bin-mirb and mruby-bin-strip.

                  + +

                  To specify the name of executable, you need to specify spec.bins in the mrbgem.rake. The entry point main() should be in the C source file under tools/<bin>/*.c where <bin> is a name of the executable. C files under the <bin> directory are compiled and linked to the executable, but not included in libmruby.a, whereas files under mrblib and src are.

                  + +

                  It is strongly recommended not to include mrblib and src directories in the binary gems, to separate normal gems and binary gems.

                  + +

                  Example

                  + +
                  +- mruby-bin-example/
                  +    |
                  +    +- README.md          (Optional)
                  +    |
                  +    +- bintest/
                  +    |   |
                  +    |   +- example.rb     <- Test code for binary gem
                  +    |
                  +    +- mrbgem.rake        <- Gem specification
                  +    |
                  +    +- mrblib/            <- Source for Ruby extension (Optional)
                  +    |
                  +    +- src/               <- Source for C extension (Optional)
                  +    |
                  +    +- tools/
                  +        |
                  +        +- example/       <- Executable name directory
                  +            |
                  +            +- example.c  <- Source for Executable (includes main)
                   
                  - +
                  diff --git a/docs/api/file.mruby3.0.html b/docs/api/file.mruby3.0.html new file mode 100644 index 0000000..385a6a1 --- /dev/null +++ b/docs/api/file.mruby3.0.html @@ -0,0 +1,282 @@ + + + + + + + File: mruby3.0 + + — Documentation by YARD 0.9.37 + + + + + + + + + + + + + + + + + + + + + + + +
                  + + +
                  +

                  User visible changes in mruby3.0

                  + +

                  Build System

                  + +

                  build_config directory

                  + +

                  Typical build configuration files are located in build_config directory. For examples:

                  +
                  • +

                    default: the default configuration

                    +
                  • +

                    host-gprof: compiles with gprof for performance tuning

                    +
                  • +

                    host-m32: compiles in gcc 32-bit mode on 64-bit platforms

                    +
                  • +

                    boxing: compiles all three boxing options

                    +
                  • +

                    clang-asan: compiles with clang‘s Address Sanitizer

                    +
                  + +

                  You can specify the build configuration file with the MRUBY_CONFIG environment variable (or CONFIG in short). If the value specified by MRUBY_CONFIG is not the path to the configuration file, build_config/${MRUBY_CONFIG}.rb is used. So you can specify it as rake MRUBY_CONFIG=boxing, for example.

                  + +

                  Build Configuration Contribution

                  + +

                  When you write a new build configuration description, please contribute. We welcome your contribution as a GitHub pull-request.

                  + +

                  Language Changes

                  + +

                  New Syntax

                  + +

                  We have ported some new syntax from CRuby.

                  +
                  • +

                    Single line pattern matching (12 => x); mruby matches only with local variables at the moment

                    +
                  • +

                    Numbered block parameter (x.map{_1 * 2})

                    +
                  • +

                    End-less def (def double(x) = x*2)

                    +
                  + +

                  Configuration Options Changed

                  + +

                  Renamed for consistency

                  + +

                  Some configuration macro names are changed for consistency (use MRB_USE_XXX or MRB_NO_XXX).

                  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                  mruby2mruby3
                  ‘MRB_ENABLE_ALL_SYMBOLS`‘MRB_USE_ALL_SYMBOLS`
                  ‘MRB_ENABLE_CXX_ABI`‘MRB_USE_CXX_ABI`
                  ‘MRB_ENABLE_CXX_EXCEPTION`‘MRB_USE_CXX_EXCEPTION`
                  ‘MRB_ENABLE_DEBUG_HOOK`‘MRB_USE_DEBUG_HOOK`
                  ‘MRB_DISABLE_DIRECT_THREADING`‘MRB_NO_DIRECT_THREADING`
                  ‘MRB_DISABLE_STDIO`‘MRB_NO_STDIO`
                  ‘MRB_METHOD_T_STRUCT`‘MRB_USE_METHOD_T_STRUCT`
                  ‘MRB_USE_FLOAT`‘MRB_USE_FLOAT32`
                  ‘MRB_WITHOUT_FLOAT`‘MRB_NO_FLOAT`
                  ‘ENABLE_LINENOISE`‘MRB_USE_LINENOISE`
                  ‘ENABLE_READLINE`‘MRB_USE_READLINE`
                  ‘DISABLE_MIRB_UNDERSCORE`‘MRB_NO_MIRB_UNDERSCORE`
                  +
                  • +

                    MRB_USE_FLOAT32 is changed from MRB_USE_FLOAT to make sure float here means using single-precision float, and not the opposite of MRB_NO_FLOAT.

                    +
                  • +

                    MRB_USE_METHOD_T_STRUCT uses struct version of mrb_method_t. More portable but consumes more memory. Turned on by default on 32-bit platforms.

                    +
                  • +

                    MRB_ prefix is added to those without.

                    +
                  + +

                  MRB_NO_BOXING

                  + +

                  Uses struct to represent mrb_value. Consumes more memory but easier to investigate the internal and to debug. It used to be default mrb_value representation. Now the default is MRB_WORD_BOXING.

                  + +

                  MRB_WORD_BOXING

                  + +

                  Pack mrb_value in an intptr_t integer. Consumes less memory compared to MRB_NO_BOXING especially on 32-bit platforms. Fixnum size is 31 bits so some integer values does not fit in Fixnum integers.

                  + +

                  MRB_NAN_BOXING

                  + +

                  Pack mrb_value in a floating-point number. Nothing changed from previous versions.

                  + +

                  MRB_USE_MALLOC_TRIM

                  + +

                  Call malloc_trim(0) from mrb_full_gc() if this macro is defined. If you are using glibc malloc, this macro could reduce memory consumption.

                  + +

                  Command Line Program

                  + +

                  bin/mruby (by mrbgems/mruby-bin-mruby)

                  + +

                  The mruby3 now automatically detects *.mrb files without the -b switch. Therefore, it can be mixed with the *.rb file in combination with the -r switch and specified at the same time. Here’s an example that works fine:

                  + +
                  $ bin/mruby app.mrb
                  +$ bin/mruby -r lib1.mrb -r lib2.rb app.rb
                  +$ bin/mruby -r lib1.rb -r lib2.rb < app.mrb
                  +
                  + +

                  Internal Changes

                  + +

                  New Instructions

                  + +

                  mruby3 introduces a few new instructions.

                  + +

                  Instructions that access pool/syms where i>255.

                  +
                  • +

                    OP_LOADL16

                    +
                  • +

                    OP_STRING16

                    +
                  • +

                    OP_LOADSYM16

                    +
                  + +

                  Instructions that load a 32-bit integer.

                  +
                  • +

                    OP_LOADI32

                    +
                  + +

                  Instruction that unwinds jump table for rescue/ensure.

                  +
                  • +

                    OP_JMPUW

                    +
                  + +

                  Renamed from OP_RAISE

                  +
                  • +

                    OP_RAISEIF

                    +
                  + +

                  Instruction that is reserved for the future keyword argument support.

                  +
                  • +

                    OP_SENDVK

                    +
                  + +

                  Removed Instructions

                  + +

                  Instructions for old exception handling

                  +
                  • +

                    OP_ONERR

                    +
                  • +

                    OP_POPERR

                    +
                  • +

                    OP_EPUSH

                    +
                  • +

                    OP_EPOP

                    +
                  + +

                  No more operand extension

                  +
                  • +

                    OP_EXT1

                    +
                  • +

                    OP_EXT2

                    +
                  • +

                    OP_EXT3

                    +
                  + +

                  Changed Instructions

                  + +

                  Jump addresses used to be specified by absolute offset from the start of iseq. Now they are relative offset from the address of the next instruction.

                  + +

                  Random now use xoshiro128++.

                  + +

                  For better and faster random number generation.

                  + +

                  Preallocated Symbol

                  + +

                  Preallocated symbols are interned at compile-time. They can be accessed via symbols macros (e.g. MRB_SYM()).

                  + +

                  See Symbols.

                  +
                  + + + +
                  + + \ No newline at end of file diff --git a/docs/api/file.mruby3.1.html b/docs/api/file.mruby3.1.html new file mode 100644 index 0000000..182061f --- /dev/null +++ b/docs/api/file.mruby3.1.html @@ -0,0 +1,407 @@ + + + + + + + File: mruby3.1 + + — Documentation by YARD 0.9.37 + + + + + + + + + + + + + + + + + + + + + + + +
                  + + +
                  +

                  User visible changes in mruby3.1 from mruby3.0

                  + +

                  New Features

                  + +

                  Core Language Features

                  + +

                  Keyword Arguments

                  + +

                  CRuby3.0 compatible keyword arguments are introduced. Keyword arguments are basically separated from ordinal arguments.

                  + +

                  Other Language Enhancement

                  + + +

                  Configuration Options Changed

                  + +

                  Some configuration macros are available:

                  +
                  • +

                    MRB_WORDBOX_NO_FLOAT_TRUNCATE: by default, float values are packed in the word if possible, but define this macro to allocate float values in the heap.

                    +
                  • +

                    MRB_USE_RO_DATA_P_ETEXT: define this macro if _etext is available on your platform.

                    +
                  • +

                    MRB_NO_DEFAULT_RO_DATA_P: define this macro to avoid using predefined mrb_ro_data_p() function

                    +
                  +
                  + +

                  Updated Features

                  + +

                  New build configurations

                  + +

                  We have added several new build configurations in the build_config directory.

                  +
                  • +

                    cross-mingw-winetest.rb

                    +
                  • +

                    cross-mingw.rb

                    +
                  • +

                    nintendo_switch.rb

                    +
                  • +

                    serenity.rb

                    +
                  • +

                    minimal: minimal configuration

                    +
                  • +

                    host-f32: compiles with mrb_float as 32-bit float

                    +
                  • +

                    host-nofloat: compiles with no float configuration

                    +
                  • +

                    android_arm64_v8a.rb: renamed from android_arm64-v8a.rb

                    +
                  + +

                  Core Libraries

                  + +

                  New Methods

                  +
                  • +

                    Array#product

                    +
                  • +

                    Array#repeated_combination

                    +
                  • +

                    Array#repeated_permutation

                    +
                  • +

                    Kernel#__ENCODING__

                    +
                  • +

                    Random.bytes

                    +
                  • +

                    Random#bytes

                    +
                  • +

                    String#center

                    +
                  + +

                  New Gem Enhancement

                  +
                  • +

                    mrbgems/mruby-pack now supports M directive (Q encoding)

                    +
                  • +

                    mrbgems/mruby-pack now supports X directive (back-up by bytes)

                    +
                  • +

                    mrbgems/mruby-pack now supports @ directive (absolute position)

                    +
                  • +

                    mrbgems/mruby-pack now supports w directive (BER compression)

                    +
                  + +

                  Tools

                  +
                  • +

                    mruby-config now supports --cc and --ld options.

                    +
                  • +

                    Remove OP_ prefix from mruby -v code dump output.

                    +
                  • +

                    Prohibit use of OP_EXT{1,2,3} by mrbc with --no-ext-ops option.

                    +
                  + +

                  Features for mruby Developer

                  +
                  • +

                    Add new specifier c to mrb_get_args() for receive Class/Module.

                    +
                  +
                  + +

                  Breaking Changes

                  + +

                  Incompatibly Changed Methods

                  +
                  • +

                    Kernel#printf (mruby-sprintf) Format specifiers %a and %A are removed.

                    +
                  • +

                    Kernel#puts (mruby-print) Now expand Array arguments.

                    +
                  + +

                  mruby VM and bytecode

                  + +

                  Due to improvements in the binary format, mruby binaries are no longer backward compatible. To run the mruby binaries on mruby 3.1, recompile with the mruby 3.1 mrbc.

                  +
                  • +

                    Upgrade mruby VM version RITE_VM_VER to 0300 (means mruby 3.0 or after).

                    +
                  • +

                    Upgrade mruby binary version RITE_BINARY_FORMAT_VER to 0300.

                    +
                  + +

                  Reintroduced Instructions

                  + +

                  mruby3.0 removed OP_EXT1, OP_EXT2, OP_EXT3 for operand extension. But the operand size limitations was too tight for real-world application. mruby3.1 reintroduces those extension instructions.

                  + +

                  Removed Instructions

                  + +

                  mruby3.1 removed following instructions.

                  +
                  • +

                    OP_LOADL16

                    +
                  • +

                    OP_LOADSYM16

                    +
                  • +

                    OP_STRING16

                    +
                  • +

                    OP_LAMBDA16

                    +
                  • +

                    OP_BLOCK16

                    +
                  • +

                    OP_METHOD16

                    +
                  • +

                    OP_EXEC16

                    +
                  + +

                  Those instructions are no longer needed by reintroduction of extension instructions.

                  +
                  • +

                    OP_SENDV

                    +
                  • +

                    OP_SENDVB

                    +
                  + +

                  Those instructions for method calls with variable number of arguments are no longer needed. They are covered by OP_SEND instruction with n=15.

                  + +

                  New Instructions

                  + +

                  mruby3.1 introduces following new instructions.

                  +
                  • +

                    OP_GETIDX: takes 1 operands R[a][a+1]

                    +
                  • +

                    OP_SETIDX: takes 1 operands R[a][a+1]=R[a+2]

                    +
                  • +

                    OP_SSEND: takes 3 operands a=self.b(c...); see OP_SEND

                    +
                  • +

                    OP_SSENDB: takes 3 operands a=self.b(c...){...}; see OP_SEND

                    +
                  • +

                    OP_SYMBOL: takes 2 operands R[a] = intern(Pool[b])

                    +
                  + +

                  OP_GETIDX and OP_SETIDX

                  + +

                  Execute obj[int] and obj[int] = value respectively, where obj is string|array|hash.

                  + +

                  OP_SSEND and OP_SSENDB

                  + +

                  They are similar to OP_SEND and OP_SENDB respectively. They initialize the R[a] by self first so that we can skip one OP_LOADSELF instruction for each call.

                  + +

                  OP_SYMBOL

                  + +

                  Extracts the character string placed in the pool as a symbol.

                  + +

                  Changed Instructions

                  + +

                  OP_SEND and OP_SENDB

                  + +

                  Method calling instructions are unified. Now OP_SEND and OP_SENDB (method call with a block) can support both splat arguments and keyword arguments as well.

                  + +

                  The brief description of the instructions:

                  + +

                  |OP_SEND | BBB | R[a] = R[a].call(Syms[b],R[a+1..n],R[a+n+1],R[a+n+2]..nk) c=n|nk<<4 | |OP_SENDB | BBB | R[a] = R[a].call(Syms[b],R[a+1..n],R[a+n+1..nk],R[a+n+2..nk],&R[a+n+2*nk+2]) c=n|nk<<4 |

                  + +

                  Operand C specifies the number of arguments. Lower 4 bits (n) represents the number of ordinal arguments, and higher 4 bits (nk) represents the number of keyword arguments. When n == 15, the method takes arguments packed in an array. When nk == 15, the method takes keyword arguments are packed in a hash.

                  + +

                  OP_ARYPUSH

                  + +

                  Now takes 2 operands and pushes multiple entries to an array.

                  + +

                  Boxing Updated

                  + +

                  Word Boxing

                  + +

                  MRB_WORD_BOXING now packs floating-point numbers in the word, if the size of mrb_float is equal or smaller than the size of mrb_int by default. If the size of mrb_float and mrb_int are same, the last 2 bits in the mrb_float are trimmed and used as flags. If you need full precision, you need to define MRB_WORDBOX_NO_FLOAT_TRUNCATE as described above.

                  + +

                  NaN Boxing

                  + +

                  Previous NaN boxing packs values in NaN representation, but pointer retrievals are far more frequent than floating-point number references. So we add constant offset to NaN representation to clear higher bits of pointer representation. This representation is called “Favor Pointer” NaN Boxing.

                  + +

                  Also, previous NaN boxing limit the size of mrb_int to 4 bytes (32 bits) to fit in NaN values. Now we allocate integer values in the heap, if the value does not fit in the 32 bit range, just like we did in Word Boxing.

                  + +

                  Constant Folding

                  + +

                  The code generator was updated to reduce the number of instructions, e.g.

                  + +
                  a = 2 * 5
                  +
                  + +

                  will be interpreted as

                  + +
                  a = 10
                  +
                  + +

                  In addition, we have improved peephole optimizations, for example:

                  + +
                  GETIV R4 :@foo
                  +MOVE R1 R4
                  +
                  + +

                  to

                  + +
                  GETIV R1 :@foo
                  +
                  + +

                  String#hash now use FNV1a algorithm

                  + +

                  For better and faster hash values.

                  +
                  + +

                  Major bug fixes

                  +
                  • +

                    Fix infinite recursive call bugs in integer division 98799aa6

                    +
                  • +

                    Fix to raise TypeError with super inside instance_eval / class_eval #5476

                    +
                  • +

                    Fix to call method_added hooks on method definitions; #2339

                    +
                  • +

                    Fix a potential buffer overflow in time_zonename 26340a88

                    +
                  • +

                    Fix Module.instance_eval bug #5528

                    +
                  • +

                    Fix fix M packing bug bfe2bd49

                    +
                  • +

                    Fix a bug regarding attribute assignment with kargs de2b4bd0

                    +
                  • +

                    Fix SIGSEGV with mrbgems/mruby-method #5580

                    +
                  • +

                    Fix print error before cleanup in codegen_error() #5603

                    +
                  • +

                    Fix a bug in unpacking BER #5611

                    +
                  • +

                    Fix a bug with numbered parameters as arguments #5605

                    +
                  • +

                    Fix mrb_ary_shift_m initialization bug 27d1e013

                    +
                  • +

                    Fix keyword argument with super #5628

                    +
                  • +

                    Fix a bug with numbered parameters on toplevel 7e7f1b2f

                    +
                  • +

                    Fix keyword argument bug #5632

                    +
                  • +

                    Fix multiple assignments in parameters #5647

                    +
                  • +

                    Fix keyword parameters not passing through super #5660

                    +
                  • +

                    Fix infinite loop from unclosed here-doc #5676

                    +
                  • +

                    Fix negative integer division bug #5678

                    +
                  + +

                  CVEs

                  + +

                  Fixed CVEs

                  + +

                  Following CVEs are fixed in this release.

                  + + +

                  Unaffected CVEs

                  + +

                  Following CVEs do not cause problems in this release. They are fixed in the later release.

                  + +
                  + + + +
                  + + \ No newline at end of file diff --git a/docs/api/file.mruby3.2.html b/docs/api/file.mruby3.2.html new file mode 100644 index 0000000..8c8bbdb --- /dev/null +++ b/docs/api/file.mruby3.2.html @@ -0,0 +1,185 @@ + + + + + + + File: mruby3.2 + + — Documentation by YARD 0.9.37 + + + + + + + + + + + + + + + + + + + + + + + +
                  + + +
                  +

                  User visible changes in mruby3.2 from mruby3.1

                  + +

                  The language

                  +
                  • +

                    Now a::B = c should evaluate a then c.

                    +
                  • +

                    Anonymous arguments *, **, & can be passed for forwarding.

                    +
                  • +

                    Multi-precision integer is available now via mruby-bigint gem.

                    +
                  + +

                  mruby VM and bytecode

                  +
                  • +

                    OP_ARYDUP was renamed to OP_ARYSPLAT. The instruction name was changed but instruction number and basic behavior have not changed (except that ARYDUP nil makes []).

                    +
                  + +

                  Tools

                  + +

                  mruby

                  +
                  • +

                    -b only specifies the script is the binary. The files loaded by -r are not affected by the option.

                    +
                  • +

                    mruby now loads complied binary if the suffix is .mrb.

                    +
                  + +

                  mrbc

                  +
                  • +

                    Add --no-optimize option to disable optimization.

                    +
                  + +

                  mrbgems

                  + +

                  mruby-class-ext

                  +
                  • +

                    Add Class#subclasses method.

                    +
                  • +

                    Add Module#undefined_instance_methods method.

                    +
                  + +

                  New bundled gems

                  + + +

                  Breaking Changes

                  + +

                  mrb_vm_run() may detach top-level local variables referenced from blocks

                  + +

                  When the mrb_vm_run() function (including mrb_top_run()) is called, the previous top-level local variables referenced from blocks is detached under either of the following conditions.

                  +
                  • +

                    If the stack_keep parameter is given as 0.

                    +
                  • +

                    If the number of variables in irep to be executed is less than the number of previous top-level local variables.

                    +
                  + +

                  This change also affects API functions such as mrb_load_string() and mrb_load_file(). The conditions under which the previous top-level local variables referenced from blocks is detached in these functions are as follows:

                  +
                  • +

                    If the function has no mrbc_context pointer parameter, or the mrbc_context pointer parameter is set to NULL.

                    +
                  • +

                    If the number of variables held in the mrbc_context pointer is less than the number of previous top-level local variables.

                    +
                  + +

                  Intentional reliance on previous behavior may cause compatibility problems in your application.

                  + +

                  CVEs

                  + +

                  Following CVEs are fixed.

                  + +
                  + + + +
                  + + \ No newline at end of file diff --git a/docs/api/file.mruby3.3.html b/docs/api/file.mruby3.3.html new file mode 100644 index 0000000..872c475 --- /dev/null +++ b/docs/api/file.mruby3.3.html @@ -0,0 +1,385 @@ + + + + + + + File: mruby3.3 + + — Documentation by YARD 0.9.37 + + + + + + + + + + + + + + + + + + + + + + + +
                  + + +
                  +

                  User visible changes in mruby3.3 from mruby3.2

                  + +

                  NOTE:” are changes to be aware of.

                  + +

                  The language

                  + + +

                  Configuration

                  +
                  • +

                    mruby can be built using Docker now. Try docker-compose build for example. (#5961)

                    +
                  • +

                    New Platform: DJGPP (MS-DOS) (#6022)

                    +
                  • +

                    New Platform: Nintendo Wii (#6086)

                    +
                  • +

                    Improved Platform: Android (#6013)

                    +
                  • +

                    Improved Platform: Dreamcast (#6130)

                    +
                  • +

                    Allow tests to be disabled for specific gems; warn about disabled tests (#6012)

                    +
                  • +

                    Replace MRB_NO_DIRECT_THREADING with MRB_USE_VM_SWITCH_DISPATCH (#5902)

                    +
                  + +

                  mruby memory API

                  +
                  • +

                    mrb_default_allocf can be overridden by the application (34c5d96)

                    +
                  • +

                    mrb_open_allocf will be deprecated (cfee5c2)

                    +
                  + +

                  Changes in C API

                  +
                  • +

                    add new error handling API functions (8c8bbd9)

                    +
                  • +

                    Add mrb_vm_ci_env_clear() function with MRB_API (#5945)

                    +
                  • +

                    a new function mrb_check_frozen_value() (ccdf75c)

                    +
                  • +

                    avoid formatting in mrb_bug() (82a48bd)
                    NOTE: If you are using it, you must give a simple string or replace it with a call to mrb_raise() series.

                    +
                  • +

                    stop using mrbc_ prefix for compiler context (c5e3cbe)
                    The same names are provided as before, but we recommend replacing them.

                    +
                  • +

                    Allow Class#allocate to be prohibited (#5979, #6122, #6123)
                    To disable #allocate, use MRB_UNDEF_ALLOCATOR(). This is also automatically applied when the subclass is created, but to explicitly allow it, use MRB_DEFINE_ALLOCATOR().

                    +
                  + +

                  Changes in mrbgems

                  +
                  • +

                    default.gembox: Add mruby debugger mrdb (mruby-bin-debugger) (#5966)

                    +
                  • +

                    mruby-bin-config: new options --cxx, --cxxflags, --as, --asflags, --objc, --objcflags (#6054)

                    +
                  • +

                    mruby-binding: renamed from mruby-binding-core of mruby3.2 (11af5db)
                    NOTE: If using mruby-binding-core of mruby 3.2, replace it with mruby-binding.

                    +
                  • +

                    mruby-binding: implemented Binding#initialize_copy method (#5517)

                    +
                  • +

                    mruby-binding: Kernel#binding responds only to calls from Ruby (#5981)

                    +
                  • +

                    mruby-compar-ext: Comparable#clamp to accept nil as arguments (836bebc)

                    +
                  • +

                    mruby-compiler: add print name for identifier tokens (d7b2e3a)

                    +
                  • +

                    mruby-data: allow empty Data (927a9df)

                    +
                  • +

                    mruby-enumerator: remove internal attribute methods obj, args, kwd, meth, fib. (735fa24)

                    +
                  • +

                    mruby-enumerator: add Enumerator#size (861f8bd)

                    +
                  • +

                    mruby-eval: merged mruby-binding of mruby3.2 (501b22a, #5989)
                    NOTE: If using mruby-binding of mruby 3.2, replace it with mruby-eval.

                    +
                  • +

                    mruby-fiber: Add a new mrb_fiber_new() with MRB_API (#6097)

                    +
                  • +

                    mruby-fiber: Allows calling Fiber#resume from C (#6106)

                    +
                  • +

                    mruby-fiber: Fiber#to_s format changed (#6105)

                    +
                  • +

                    mruby-io: add File#atime and File#ctime (321cfe9)

                    +
                  • +

                    mruby-io: Add “x” mode option for IO.open (#6081)

                    +
                  • +

                    mruby-io: File.new should not take blocks (53de964)

                    +
                  • +

                    mruby-method: Method#to_s format changed (f5bc82f, 02f189c)

                    +
                  • +

                    mruby-numeric-ext: int.pow(n,m) to take bigint as exponential (d482eab)

                    +
                  • +

                    mruby-pack: support new directives j, J, b, B, # (2a1e3a5, e7021f1, e17f325)

                    +
                  • +

                    mruby-range-ext: new method Range#overlap? (384d0e2)

                    +
                  • +

                    mruby-string-ext: Add String#valid_encoding? method (eabe2d9)

                    +
                  • +

                    mruby-struct: allow empty Struct when a name is not given (c212ede)

                    +
                  • +

                    mruby-time: should allow year before 1900 (e5de08b)

                    +
                  • +

                    mruby-time: support bigint to time_t if necessary (7096d27)

                    +
                  • +

                    mruby-time: need to handle negative time_t (b064d7e)

                    +
                  + +

                  Changes in build system

                  +
                  • +

                    Extended rake install task (#5928)
                    NOTE: Due to this impact, executable files in the mruby/bin/ directory by default are now symbolic links (batch files on Windows). If previously relied on those executables, should be replaced with direct references to the entity created under the build directory (e.g. mruby/build/host/bin/).

                    +
                  • +

                    Encode and decode escape characters for presym (#6011)

                    +
                  • +

                    Rakefile: remove default build target directories in deep_clean (#6032, 1e38569)

                    +
                  + +

                  Other breaking changes

                  +
                  • +

                    mrb_f_raise() is now an internal function (#5923, #6070)

                    +
                  • +

                    mrb_make_exception() is now an internal function with different parameters (431f83e, 78137f3)

                    +
                  • +

                    The File#path method no longer uses the #to_path method for implicit conversion (d86c4a7)

                    +
                  • +

                    stop mrb isolation for each test file (a20fbe5)

                    +
                  • +

                    RBreak remembers the CI location (#6103)

                    +
                  + +

                  Bugs Fixed

                  +
                  • +

                    #5724 Rational#** is missing

                    +
                  • +

                    #5725 weird const_missing exceptions in mrblib code

                    +
                  • +

                    #5789 No memory release of backtrace information due to stack error

                    +
                  • +

                    #5932 How to create a block using the C API? mrb_yield keeps crashing!

                    +
                  • +

                    #5943 TCPSocket#write is failed

                    +
                  • +

                    #5944 Behavior of calling method with a hash variable

                    +
                  • +

                    #5946 Don’t switch constant search path from modules to Object

                    +
                  • +

                    #5949 Caller appears to report wrong line when block passed and brackets omitted

                    +
                  • +

                    0906cd7 numeric.c: fix rounding function issues with big numbers

                    +
                  • +

                    #5974 Invalid escape sequences in gem_init.c on windows

                    +
                  • +

                    #5975 Equals comparison fails on extreme ends of 64-bit integers

                    +
                  • +

                    #5985 Sign extension with OP_LOADI32 in get_int_operand()

                    +
                  • +

                    #5986 Fix bugs in String#bytesplice

                    +
                  • +

                    #5987 ~(-1 << 64) is incorrect

                    +
                  • +

                    #5991 ‘gets’ method not working in mruby-3.2.0

                    +
                  • +

                    #5994 fix typo in mrbgems/mruby-io/src/io.c

                    +
                  • +

                    #5995 One seemingly unnecessary parameter is passed in the block parameters

                    +
                  • +

                    #6008 Make “bintest” independent of directory

                    +
                  • +

                    b47c8b7 gc.c (clear_all_old): fix a generational GC bug

                    +
                  • +

                    #6029 mruby build fails under mrbgems directory

                    +
                  • +

                    a264965 mruby-os-memsize/memsize.c: fix irep size calculation

                    +
                  • +

                    3310e10 mruby-test/mrbgem.rake: fix mrb_state handling bug

                    +
                  • +

                    #6041 GC Performance may have degraded

                    +
                  • +

                    #6044 Generated presym/table.h contains invalid characters

                    +
                  • +

                    #6051 Null pointer dereference in mrb_addrinfo_unix_path

                    +
                  • +

                    #6052 Null pointer dereference while handling the Proc class

                    +
                  • +

                    #6055 Fix libmruby name for VisualC++

                    +
                  • +

                    #6060 SEGFAULT Issue Related to Fiber Usage in ngx_mruby Development

                    +
                  • +

                    #6061 Performance issue in String#codepoints

                    +
                  • +

                    #6064 MRUBY_PACKAGE_DIR does not always have a value.

                    +
                  • +

                    #6065 Null pointer dereference while handling the Proc class

                    +
                  • +

                    #6066 Null pointer dereference involving Struct.new()

                    +
                  • +

                    #6067 Null pointer dereference in mrb_string_value_cstr

                    +
                  • +

                    #6068 Stack overflow in mrb_vm_exec

                    +
                  • +

                    #6076 Fixed unwinding block that could point to invalid PC

                    +
                  • +

                    #6084 Incorrect symbolic sinks in binary built on Linux

                    +
                  • +

                    #6087 ‘Remote branch HEAD not found in upstream origin’ error on build

                    +
                  • +

                    #6089 binding.eval() handles def expressions differently from CRuby

                    +
                  • +

                    #6098 Fails to call superclass of wrapped method

                    +
                  • +

                    #6099 ensure section is not executed if the function exits via a return in a proc

                    +
                  • +

                    #6108 VM crashes with break

                    +
                  • +

                    #6118 Fixed IO#read with buf

                    +
                  • +

                    #6120 Set EBADF if check_file_descriptor() fails

                    +
                  • +

                    #6126 Fixed return value of OP_RETURN_BLK called directly under C function

                    +
                  • +

                    #6134 String#unpack1 returns an array instead of a single string

                    +
                  • +

                    #6136 Fixed when combined mrb_fiber_resume() and Fiber#transfer

                    +
                  + +

                  Pull Requests (User Visible Ones)

                  +
                  • +

                    #5517 Fixed local variables not separated between copied binding objects

                    +
                  • +

                    #5902 Replace MRB_NO_DIRECT_THREADING with MRB_USE_VM_SWITCH_DISPATCH

                    +
                  • +

                    #5923 Demotion mrb_f_raise() from MRB_API

                    +
                  • +

                    #5928 Improved rake install

                    +
                  • +

                    #5945 Avoid exposure for REnv objects

                    +
                  • +

                    #5946 Don’t switch constant search path from modules to Object

                    +
                  • +

                    #5966 Update default.gembox add mruby debugger mrdb

                    +
                  • +

                    #5979 Allow Class#allocate to be prohibited

                    +
                  • +

                    #5981 Kernel#binding responds only to calls from Ruby

                    +
                  • +

                    #5989 Integrate mruby-binding-eval into mruby-eval

                    +
                  • +

                    #5961 Add Docker to build and run all mruby tests. Run pre-commit and generate YARD docs with Docker

                    +
                  • +

                    #5994 fix typo in mrbgems/mruby-io/src/io.c

                    +
                  • +

                    #6008 Make “bintest” independent of directory

                    +
                  • +

                    #6009 Avoid adding <MRUBY_ROOT>/bintest which does not exist

                    +
                  • +

                    #6011 Encode and decode escape characters for presym

                    +
                  • +

                    #6012 Allow tests to be disabled for specific gems; warn about disabled tests

                    +
                  • +

                    #6013 Fix Android toolchain

                    +
                  • +

                    #6022 Build configuration for MS-DOS and DJGPP

                    +
                  • +

                    #6032 Rake: update task clean to remove bin and build folders

                    +
                  • +

                    #6045 Fixes escape sequence bug and enhancements in Presym scanning

                    +
                  • +

                    #6054 Extends bin/mruby-config

                    +
                  • +

                    #6055 Fix libmruby name for VisualC++

                    +
                  • +

                    #6070 Demotion mrb_f_raise() in kernel.c from MRB_API too

                    +
                  • +

                    #6076 Fixed unwinding block that could point to invalid PC

                    +
                  • +

                    #6081 Add “x” mode option for IO.open

                    +
                  • +

                    #6086 Add build config for Nintendo Wii

                    +
                  • +

                    #6097 Add a new mrb_fiber_new() with MRB_API

                    +
                  • +

                    #6103 RBreak remembers the CI location

                    +
                  • +

                    #6105 Implement Fiber#to_s method

                    +
                  • +

                    #6106 Ease fiber limitations

                    +
                  • +

                    #6118 Fixed IO#read with buf

                    +
                  • +

                    #6120 Set EBADF if check_file_descriptor() fails

                    +
                  • +

                    #6122 Prohibit Class#allocate in a different way

                    +
                  • +

                    #6123 Inherit MRB_FL_UNDEF_ALLOCATE in subclasses

                    +
                  • +

                    #6125 Allow OP_RETURN_BLK to cross C boundaries

                    +
                  • +

                    #6126 Fixed return value of OP_RETURN_BLK called directly under C function

                    +
                  • +

                    #6130 dreamcast_shelf build config: complete overhaul

                    +
                  • +

                    #6136 Fixed when combined mrb_fiber_resume() and Fiber#transfer

                    +
                  +
                  + + + +
                  + + \ No newline at end of file diff --git a/docs/api/file.mruby3.4.html b/docs/api/file.mruby3.4.html new file mode 100644 index 0000000..5c9e32d --- /dev/null +++ b/docs/api/file.mruby3.4.html @@ -0,0 +1,556 @@ + + + + + + + File: mruby3.4 + + — Documentation by YARD 0.9.37 + + + + + + + + + + + + + + + + + + + + + + + +
                  + + +
                  +

                  User visible changes in mruby3.4 from mruby3.3

                  + +

                  NOTE:” are changes to be aware of.

                  + +

                  The language

                  +
                  • +

                    mruby now supports private and protected visibitily (b0db0bd)

                    +
                  • +

                    Maximum length of inlined symbols reduced from 5 to 4 characters to provide space for visibility flags (6442a01)

                    +
                  • +

                    Many methods are made private according to CRuby visibility (4a0e806)

                    +
                  • +

                    Generate OP_SSEND for self.method type calls (111fe4b)

                    +
                  • +

                    initialize method will be always private (eb8b412)

                    +
                  • +

                    Add new hooks method_removed, method_undefined (9c74f6e)

                    +
                  • +

                    Add new hooks singleton_method_removed, singleton_method_undefined (0863c08)

                    +
                  • +

                    Updated OP_DEF output from codedump (3a3e877)

                    +
                  • +

                    Better handling of binary strings, e.g. String#b (b0127f0)

                    +
                  • +

                    Hash to_s format has changed (baeeb5e)

                    +
                  • +

                    Some encoding related method such as #force_encoding (e47b4ca), #b (b0127f0)

                    +
                  • +

                    Constant folding for String#+ (6687bdd)

                    +
                  • +

                    Remove Float bit-operation (db8368f)

                    +
                  • +

                    use SWAR technique for strlen performance (cbb31e6)

                    +
                  • +

                    use merge sort for Array#sort (5bd63d6)

                    +
                  + +

                  Changes in C API

                  +
                  • +

                    pool.c renamed to mempool.c (and mrb_pool to mrb_mempool) (49525fa)

                    +
                  • +

                    mrb_pool_value renamed to mrb_irep_pool to reduce confusion (62ef5db)

                    +
                  • +

                    rename BOXNIX_SET_VALUE to BOXNO_SET_VALUE (#6397)

                    +
                  • +

                    MRB_FROZEN_P() is replaced by mrb_frozen_p() (c11d18e)

                    +
                  • +

                    rename color to gc_color (0e79f6b, 1e36d76)

                    +
                  • +

                    add obj->frozen instead of flags MRB_SET_FROZEN_FLAG/MRB_UNSET_FROZEN_FLAG (8276143)

                    +
                  + +

                  Build & Configuration

                  +
                  • +

                    New Build Target: test:run:serial, test:run:serial:lib, test:run:serial:bin (#6423)

                    +
                  • +

                    New Platform: Playstation Portable (#6022)

                    +
                  • +

                    New Platform: emscripten (#6487)

                    +
                  • +

                    New Config: no-float (with MRB_NO_FLOAT) (32200f1)

                    +
                  + +

                  Changes in mrbgems

                  +
                  • +

                    mruby-print: removed; if you do not use mruby-io, mruby use #print etc. in the core (8c8bbd9)

                    +
                  • +

                    mruby-enum-lazy: Add Enumerable::Lazy#grep_v to mruby-enum-lazy (#6171)

                    +
                  • +

                    mruby-io: Add level argument to File.dirname (#6463)

                    +
                  • +

                    mruby-io: File.absolute_path? (#6482)

                    +
                  • +

                    mruby-io: File.absolute_path (96113a2)

                    +
                  • +

                    mruby-toplevel-ext: top-level public/private/protected moved to the core (2a876d2)

                    +
                  • +

                    mruby-metaprog: method list methods now works according to the visibility (9229da1)

                    +
                  • +

                    mruby-metaprog: public_instance_methods, private_instance_methods, protected_instance_methods (9e3e7b2)

                    +
                  • +

                    mruby-encoding: MRB_UTF8_STRING turned on automatically with this gem (74bdae9)

                    +
                  + +

                  Fixed GitHub Issues

                  +
                  • +

                    #6173 Fails to build with tcc(Tiny C Compiler)

                    +
                  • +

                    #6156 ‘/LIBPATH’ issue

                    +
                  • +

                    #6183 “.e”.to_f returns NAN

                    +
                  • +

                    #6182 mrb_read_float() converts “0.3” with a small error compared to strtod()

                    +
                  • +

                    #6210 Unary minus seems broken

                    +
                  • +

                    #6255 Wrong number of characters in broken UTF-8 string

                    +
                  • +

                    #4038 Heap buffer overflow in OP_ENTER

                    +
                  • +

                    #6262 Unable to define == for objects when using Array#delete

                    +
                  • +

                    #6267 When MRB_UTF8_STRING is enabled, giving byte characters for String#index and String#split gives wrong results

                    +
                  • +

                    #6277 MSVC: can’t use malloc() in string.c with WIN32_LEAN_AND_MEAN

                    +
                  • +

                    #6240 Differentiate between lib and lib64 in the build settings.

                    +
                  • +

                    #6304 Calling method_missing with only Kwargs passes arguments incorrectly

                    +
                  • +

                    #6317 mrb_gc_register() may cause GC and collect the object being protected

                    +
                  • +

                    #6307 Planned change patch for mrb_vm_exec()

                    +
                  • +

                    #6298 foo :bar {} is legal in mruby?

                    +
                  • +

                    #6326 Detect “Use-after-free” with address sanitizer

                    +
                  • +

                    #5358 static warning from getpwnam

                    +
                  • +

                    #6339 mrb_ary_delete() may refer to an invalid address (use-after-free)

                    +
                  • +

                    #6346 Block kwargs are passed as last positional arg when using yield

                    +
                  • +

                    #6365 powl() not available when compiling for Dreamcast

                    +
                  • +

                    #6369 100x Performance Regression from 3.1

                    +
                  • +

                    #6270 NODE_ZSUPER from deeply nested blocks will result in a truncated digits for block index in OP_ARGARY

                    +
                  • +

                    #6297 Assigning to a block variable changes the actual block (thus affecting block_given? and yield)

                    +
                  • +

                    #6389 instance_exec named block args don’t work properly

                    +
                  • +

                    #6388 Recent commit broke my windows build

                    +
                  • +

                    #6411 Wrong function unwinding when using return in a block

                    +
                  • +

                    #6439 OP_JMPUW does not call the ensure block when it jumps to the beginning of the begin block

                    +
                  • +

                    #6441 break inside while loop will execute the ensure block outside of the while loop

                    +
                  • +

                    #6453 Bigint: incorrect behavior of ^ operator

                    +
                  • +

                    #6452 Bigint: weird mod behavior

                    +
                  • +

                    #6451 Bigint: incorrect division behavior

                    +
                  • +

                    #6456 bigint: bug with division of a small number by a bigint

                    +
                  • +

                    #6466 mruby-bin-mruby using Kernel#p and Kernel#print in bintest fails test

                    +
                  • +

                    #6467 Heap-Use-After-Free due to Recursive group_by Calls

                    +
                  • +

                    #6471 Discrepancy in codegen for binary operations between master branch and 3.3.0

                    +
                  • +

                    #6477 heap-buffer-overflow in mrb_vm_exec

                    +
                  • +

                    #6485 Hash#rehash does not check if the hash is frozen

                    +
                  • +

                    #6483 Hash#default_proc= accepts arbitrary objects that are not callable

                    +
                  • +

                    #6491 Destroy existing string literals when composing string literals

                    +
                  + +

                  Merged Pull Requests (User Visible Ones)

                  +
                  • +

                    #6171 Add Enumerable::Lazy#grep_v to mruby-enum-lazy

                    +
                  • +

                    #6174 Fix MRUBY_PACKAGE_DIR in mruby-config.bat

                    +
                  • +

                    #6175 Corrected strange conditional in mrb_vm_run()

                    +
                  • +

                    #6176 Stop assuming alias proc in CI_PROC_SET()

                    +
                  • +

                    #6177 gha: add macOS 14 to the build

                    +
                  • +

                    #6184 Remove the L_STOP label

                    +
                  • +

                    #6185 Added mrb_callinfo::u.keep_context for clarity

                    +
                  • +

                    #6186 Omit NULL check of e->cxt in OP_RETURN_BLK

                    +
                  • +

                    #6191 Speed up symbol equality comparison

                    +
                  • +

                    #6192 Fix OP_STOP with exception

                    +
                  • +

                    #6193 Fix wrong assertion in OP_SENDB.

                    +
                  • +

                    #6194 Simplify the calculation of the number of closures in MRB_TT_FIBER

                    +
                  • +

                    #6197 Fix int_xor to call flo_xor.

                    +
                  • +

                    #6201 tasks/doc.rake: standardize the rake doc error messages

                    +
                  • +

                    #6202 Remove the .yardoc folder with rake doc:clean:api

                    +
                  • +

                    #6204 Clean up the .editorconfig file

                    +
                  • +

                    #6209 Minor .gitignore clean up

                    +
                  • +

                    #6211 Minor .gitignore clean up; order entries

                    +
                  • +

                    #6216 Shared empty iv_tbl of module

                    +
                  • +

                    #6217 Strict declaration for mrb_istruct_size()

                    +
                  • +

                    #6219 Avoid assigning a fixed value in the loop

                    +
                  • +

                    #6220 Reorganize mrb_cache_entry and mrb_method_t types

                    +
                  • +

                    #6221 Arranging each_backtrace()

                    +
                  • +

                    #6222 Need to synchronize dbg->regs after VM call in mrdb

                    +
                  • +

                    #6224 mrb_env_unshare() to break the link to fiber

                    +
                  • +

                    #6225 Revert “Adjust environment when mrb_exec_irep happened.”

                    +
                  • +

                    #6227 fix: Array#shuffle(!) result distribution

                    +
                  • +

                    #6228 Revert “env referred from top-level callinfo should not be unshared; fix #4019”

                    +
                  • +

                    #6230 Fix status of fiber after switched by exception raised

                    +
                  • +

                    #6231 Add a way to let other gems handle closing of fds in mruby-io

                    +
                  • +

                    #6232 Fold the code for freeing env

                    +
                  • +

                    #6233 Free stack memory at end of fiber

                    +
                  • +

                    #6235 fix Array#delete always firing the block when deleting nil

                    +
                  • +

                    #6236 unify the code for filter methods (and speed up #reject!)

                    +
                  • +

                    #6237 Stricter env objects to attach to ci

                    +
                  • +

                    #6238 Minimize zero initialization of the stack

                    +
                  • +

                    #6243 Fixed base64 decoding in mruby-pack

                    +
                  • +

                    #6244 Revise scope of role of mrb_vm_run()

                    +
                  • +

                    #6246 Fix typo in test/t/hash.rb

                    +
                  • +

                    #6249 Fix grammar in src/vm.c; catched -> caught

                    +
                  • +

                    #6250 Fix spelling

                    +
                  • +

                    #6251 Clean up root move CODEOWNERS to .github directory

                    +
                  • +

                    #6253 Allow recycling fibers by GC if not referenced directly

                    +
                  • +

                    #6256 Update documentation for mrb_top_run()

                    +
                  • +

                    #6257 fix some mrbconf.md typos

                    +
                  • +

                    #6260 Remove exc_caught from mrb_vm_exec()

                    +
                  • +

                    #6261 fix: to_a integer ranges with begin > end failing

                    +
                  • +

                    #6263 fix: Array#delete mistakenly calling block even if not passed

                    +
                  • +

                    #6264 Must pass keyword arguments for Kernel#to_enum

                    +
                  • +

                    #6265 Fixes Dir.children and Dir.each_child

                    +
                  • +

                    #6266 Passes the nonexistent key as a block argument in Array#delete

                    +
                  • +

                    #6273 Improvements to mrb_protect_atexit()

                    +
                  • +

                    #6275 Fixed Binding#eval that failed to assign to the same variable

                    +
                  • +

                    #6276 Always run atexit on the top-level call frame

                    +
                  • +

                    #6279 Include headers for malloc() explicitly; fix #6277

                    +
                  • +

                    #6280 Remove MRB_ENV_CLOSED flag

                    +
                  • +

                    #6281 Fixes local variables in mruby-binding.

                    +
                  • +

                    #6283 Simplify uvenv()

                    +
                  • +

                    #6288 Detach env of ci explicitly on atexit

                    +
                  • +

                    #6289 Simplify OP_RETURN_BLK and OP_BREAK

                    +
                  • +

                    #6290 Allow to change the output directory name of the libmruby file

                    +
                  • +

                    #6293 Changed the instruction table in opcode.md

                    +
                  • +

                    #6294 Optimise mrb_iv_get

                    +
                  • +

                    #6302 Minor cleanup in mrb_str_init

                    +
                  • +

                    #6303 mrb_str_aset_m() should return replace instead of str

                    +
                  • +

                    #6305 Protect keyword arguments in prepare_missing()

                    +
                  • +

                    #6308 Assume that MRB_CATCH() has mrb->exc set

                    +
                  • +

                    #6310 Doubling the call stack when extending it

                    +
                  • +

                    #6311 Added fast-path for positional arguments less than 15 in OP_SEND

                    +
                  • +

                    #6312 Omit error checking at OP_RETURN, OP_RETURN_BLK and OP_BREAK

                    +
                  • +

                    #6313 Fix wrong column number in opcode.md

                    +
                  • +

                    #6314 Optimize even?/odd? for big integers

                    +
                  • +

                    #6318 Shrink variables in mrb_vm_exec()

                    +
                  • +

                    #6320 Shrinking the code in OP_BREAK and OP_RETURN_BLK

                    +
                  • +

                    #6321 Avoid warnings in lib/*/.rb

                    +
                  • +

                    #6322 Fix mrb_ro_data_p on Intel Mac

                    +
                  • +

                    #6324 Remove localjump_error()

                    +
                  • +

                    #6327 fix ncurses linking issues

                    +
                  • +

                    #6328 Fix use-after-free in obj_free() for env objects

                    +
                  • +

                    #6329 Fix use-after-free in mrb_obj_alloc()

                    +
                  • +

                    #6330 Add a precondition to call mrb_env_unshare().

                    +
                  • +

                    #6331 Restore the GC arena with tests

                    +
                  • +

                    #6332 Must not depend on the “host” build to generate mruby-compiler/core/y.tab.c

                    +
                  • +

                    #6333 Reduce the number of branch instructions in the heap_p()

                    +
                  • +

                    #6335 Add return_ci in CHECKPOINT_MAIN() of OP_RETURN

                    +
                  • +

                    #6338 Need to place static proc objects into 8-byte alignments

                    +
                  • +

                    #6340 Fix use-after-free for Array#<=>

                    +
                  • +

                    #6341 Need to restore the GC arena after some function calls

                    +
                  • +

                    #6344 prefer using mrb_yield to call block arguments

                    +
                  • +

                    #6347 codegen.c,parse.y: remove flattening of yield arguments; fix #6346

                    +
                  • +

                    #6348 Cancel the warning disablement

                    +
                  • +

                    #6349 Perform GC before deleting directories

                    +
                  • +

                    #6350 Fixed character encoding conversion function mismatch

                    +
                  • +

                    #6351 Remove unnecessary mrb_gc_arena_restore()

                    +
                  • +

                    #6353 Fix use-after-free in mrb_ary_delete()

                    +
                  • +

                    #6356 Making splat argument objects invisible from Ruby side

                    +
                  • +

                    #6373 Add build config for Milk-V Duo (RISC-V Linux) board

                    +
                  • +

                    #6382 Make array objects invisible in mrb_gc_register()

                    +
                  • +

                    #6385 Small improvements for mrb_gc_register()

                    +
                  • +

                    #6386 Avoid calling mrb_gv_set() from mrb_gc_unregister()

                    +
                  • +

                    #6387 Small improvements for mrb_gc_unregister()

                    +
                  • +

                    #6390 Fix use-after-free by mrb_gc_unregistor()

                    +
                  • +

                    #6391 Fixed argument forwarding in instance_exec

                    +
                  • +

                    #6392 Fix argument forwarding in mrb_exec_irep()

                    +
                  • +

                    #6393 Follow-up to #6391

                    +
                  • +

                    #6395 Storing method-id inside Symbol#to_proc

                    +
                  • +

                    #6396 Milk-V Build Config: update GPIO gem URL

                    +
                  • +

                    #6397 boxing_no.h: rename BOXNIX_SET_VALUE -> BOXNO_SET_VALUE

                    +
                  • +

                    #6399 Add macOS 15 to the build

                    +
                  • +

                    #6405 io_read: use %i instead of %d in call to mrb_raisef

                    +
                  • +

                    #6407 Allow to exclude specific files in rake install

                    +
                  • +

                    #6408 Improve compliance with C++ standards

                    +
                  • +

                    #6410 Put #include <stdlib.h> in parse.y

                    +
                  • +

                    #6412 Distinguish the call frame of the generator with OP_RETURN_BLK

                    +
                  • +

                    #6413 Add links to documentation in README.md

                    +
                  • +

                    #6415 Fix numbered parameters when used as a singleton

                    +
                  • +

                    #6416 Optimize the “new” method’s iseq

                    +
                  • +

                    #6419 Follow Ruby’s behavior for numbered parameters in -> {}

                    +
                  • +

                    #6420 Update labeler.yml: add label for the tools directory

                    +
                  • +

                    #6422 Add annotations for function names defined in the preprocessor

                    +
                  • +

                    #6423 Adding a serialized test task

                    +
                  • +

                    #6427 Need to update ci variable after re-entry to VM

                    +
                  • +

                    #6428 Change the limits of OP_ADDI and OP_SUBI from 0-127 to 0-255.

                    +
                  • +

                    #6429 Fix numbered parameters when used as hash keys

                    +
                  • +

                    #6432 Moving code in macro arguments out of macros

                    +
                  • +

                    #6434 Added document “Layout of the mruby filesystem”

                    +
                  • +

                    #6436 Make rake doc:update-index prettier friendly

                    +
                  • +

                    #6437 Add more details to the pre-commit config

                    +
                  • +

                    #6438 Remove unused MRuby::Build#list_install_excludes method

                    +
                  • +

                    #6440 Fix redo keyword

                    +
                  • +

                    #6442 Fixed wrong range condition in OP_JMPUW

                    +
                  • +

                    #6443 Fix NODE_NEGATE for bigints

                    +
                  • +

                    #6444 Add test cases for bigints

                    +
                  • +

                    #6446 Omit the _WIN64 definition check

                    +
                  • +

                    #6447 Fixed File.expand_path

                    +
                  • +

                    #6448 Suppress presym in mruby/ext/io.h file

                    +
                  • +

                    #6449 Using presym in the mruby-io/src/file_test.c file

                    +
                  • +

                    #6450 Change MRB_WITH_IO_PREAD_PWRITE configuration name

                    +
                  • +

                    #6454 mruby-bigint: handle rhs bigint in int_mod and int_divmod functions

                    +
                  • +

                    #6455 mruby-bigint: fix rounding behavior in mpz_mdiv and mpz_mdivmod functions

                    +
                  • +

                    #6457 bigint: fix bug with division of a small number by a bigint

                    +
                  • +

                    #6459 FileTest is a module

                    +
                  • +

                    #6461 To create a release package file in draft

                    +
                  • +

                    #6462 Properly cast the return value of memchr()

                    +
                  • +

                    #6463 Add level argument to File.dirname

                    +
                  • +

                    #6465 Add initial playstation portable crossbuild support

                    +
                  • +

                    #6468 Fixed missing changes to IB_FIND_BY_KEY() parameter names

                    +
                  • +

                    #6469 Add more const qualifier for RProc

                    +
                  • +

                    #6472 Moved tests for Integer#quo

                    +
                  • +

                    #6473 Hide mpz_and() symbol

                    +
                  • +

                    #6473 Hide mpz_and() symbol

                    +
                  • +

                    #6474 Avoid array object creation with “unknown keyword” error

                    +
                  • +

                    #6475 Don’t include deleted mruby-print

                    +
                  • +

                    #6478 Fixed buffer overrun in function chars2bytes()

                    +
                  • +

                    #6479 Reimplementation of File.expand_path method

                    +
                  • +

                    #6482 Add File.absolute_path? method

                    +
                  • +

                    #6487 Add Emscripten toolchain & build_config

                    +
                  +
                  + + + +
                  + + \ No newline at end of file diff --git a/docs/api/file.opcode.html b/docs/api/file.opcode.html new file mode 100644 index 0000000..1d95e92 --- /dev/null +++ b/docs/api/file.opcode.html @@ -0,0 +1,746 @@ + + + + + + + File: opcode + + — Documentation by YARD 0.9.37 + + + + + + + + + + + + + + + + + + + + + + + +
                  + + +
                  +

                  The new bytecode

                  + +

                  We will reimplement the VM to use 8bit instruction code. By bytecode, we mean real byte code. The whole purpose is reducing the memory consumption of mruby VM.

                  + +

                  Instructions

                  + +

                  Instructions are bytes. There can be 256 instructions. Currently, we have 106 instructions. Instructions can take 0 to 3 operands.

                  + +

                  operands

                  + +

                  The size of operands can be either 8bits, 16bits or 24bits. In the table.1 below, the third field describes the size of operands.

                  +
                  • +

                    B: 8bit

                    +
                  • +

                    S: 16bit

                    +
                  • +

                    W: 24bit

                    +
                  + +

                  If the first and second operands are of type B (8bits), they may be extended to 16bits by the operand extension instruction immediately preceding them. See also OP_EXT1, OP_EXT2 and OP_EXT3.

                  + +

                  table.1 Instruction Table

                  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                  No.Instruction NameOperand typeSemantics
                  0‘OP_NOP`‘-`‘no operation`
                  1‘OP_MOVE`‘BB`‘R(a) = R(b)`
                  2‘OP_LOADL`‘BB`‘R(a) = Pool(b)`
                  3‘OP_LOADI8`‘BB`‘R(a) = mrb_int(b)`
                  4‘OP_LOADINEG`‘BB`‘R(a) = mrb_int(-b)`
                  5‘OP_LOADI__1`‘B`‘R(a) = mrb_int(-1)`
                  6‘OP_LOADI_0`‘B`‘R(a) = mrb_int(0)`
                  7‘OP_LOADI_1`‘B`‘R(a) = mrb_int(1)`
                  8‘OP_LOADI_2`‘B`‘R(a) = mrb_int(2)`
                  9‘OP_LOADI_3`‘B`‘R(a) = mrb_int(3)`
                  10‘OP_LOADI_4`‘B`‘R(a) = mrb_int(4)`
                  11‘OP_LOADI_5`‘B`‘R(a) = mrb_int(5)`
                  12‘OP_LOADI_6`‘B`‘R(a) = mrb_int(6)`
                  13‘OP_LOADI_7`‘B`‘R(a) = mrb_int(7)`
                  14‘OP_LOADI16`‘BS`‘R(a) = mrb_int(b)`
                  15‘OP_LOADI32`‘BSS`‘R(a) = mrb_int((b<<16)+c)`
                  16‘OP_LOADSYM`‘BB`‘R(a) = Syms(b)`
                  17‘OP_LOADNIL`‘B`‘R(a) = nil`
                  18‘OP_LOADSELF`‘B`‘R(a) = self`
                  19‘OP_LOADT`‘B`‘R(a) = true`
                  20‘OP_LOADF`‘B`‘R(a) = false`
                  21‘OP_GETGV`‘BB`‘R(a) = getglobal(Syms(b))`
                  22‘OP_SETGV`‘BB`‘setglobal(Syms(b), R(a))`
                  23‘OP_GETSV`‘BB`‘R(a) = Special`
                  24‘OP_SETSV`‘BB`Special = R(a)`
                  25‘OP_GETIV`‘BB`‘R(a) = ivget(Syms(b))`
                  26‘OP_SETIV`‘BB`‘ivset(Syms(b),R(a))`
                  27‘OP_GETCV`‘BB`‘R(a) = cvget(Syms(b))`
                  28‘OP_SETCV`‘BB`‘cvset(Syms(b),R(a))`
                  29‘OP_GETCONST`‘BB`‘R(a) = constget(Syms(b))`
                  30‘OP_SETCONST`‘BB`‘constset(Syms(b),R(a))`
                  31‘OP_GETMCNST`‘BB`‘R(a) = R(a)::Syms(b)`
                  32‘OP_SETMCNST`‘BB`‘R(a+1)::Syms(b) = R(a)`
                  33‘OP_GETUPVAR`‘BBB`‘R(a) = uvget(b,c)`
                  34‘OP_SETUPVAR`‘BBB`‘uvset(b,c,R(a))`
                  35‘OP_GETIDX`‘B`‘R(a) = R(a)`
                  36‘OP_SETIDX`‘B`R(a) = R(a+2)`
                  37‘OP_JMP`‘S`‘pc+=a`
                  38‘OP_JMPIF`‘BS`‘if R(a) pc+=b`
                  39‘OP_JMPNOT`‘BS`‘if !R(a) pc+=b`
                  40‘OP_JMPNIL`‘BS`‘if R(a)==nil pc+=b`
                  41‘OP_JMPUW`‘S`‘unwind_and_jump_to(a)`
                  42‘OP_EXCEPT`‘B`‘R(a) = exc`
                  43‘OP_RESCUE`‘BB`‘R(b) = R(a).isa?(R(b))`
                  44‘OP_RAISEIF`‘B`‘raise(R(a)) if R(a)`
                  45‘OP_SSEND`‘BBB`‘R(a) = self.send(Syms(b),R(a+1)..,R(a+n+1):R(a+n+2)..) (c=n|k<<4)`
                  46‘OP_SSENDB`‘BBB`‘R(a) = self.send(Syms(b),R(a+1)..,R(a+n+1):R(a+n+2)..,&R(a+n+2k+1))`
                  47‘OP_SEND`‘BBB`‘R(a) = R(a).send(Syms(b),R(a+1)..,R(a+n+1):R(a+n+2)..) (c=n|k<<4)`
                  48‘OP_SENDB`‘BBB`‘R(a) = R(a).send(Syms(b),R(a+1)..,R(a+n+1):R(a+n+2)..,&R(a+n+2k+1))`
                  49‘OP_CALL`‘-`‘self.call(*, **, &) (But overlay the current call frame; tailcall)`
                  50‘OP_SUPER`‘BB`‘R(a) = super(R(a+1),… ,R(a+b+1))`
                  51‘OP_ARGARY`‘BS`‘R(a) = argument array (16=m5:r1:m5:d1:lv4)`
                  52‘OP_ENTER`‘W`‘arg setup according to flags (23=m5:o5:r1:m5:k5:d1:b1)`
                  53‘OP_KEY_P`‘BB`‘R(a) = kdict.key?(Syms(b))`
                  54‘OP_KEYEND`‘-`‘raise unless kdict.empty?`
                  55‘OP_KARG`‘BB`‘R(a) = kdict; kdict.delete(Syms(b))`
                  56‘OP_RETURN`‘B`‘return R(a) (normal)`
                  57‘OP_RETURN_BLK`‘B`‘return R(a) (in-block return)`
                  58‘OP_BREAK`‘B`‘break R(a)`
                  59‘OP_BLKPUSH`‘BS`‘R(a) = block (16=m5:r1:m5:d1:lv4)`
                  60‘OP_ADD`‘B`‘R(a) = R(a)+R(a+1)`
                  61‘OP_ADDI`‘BB`‘R(a) = R(a)+mrb_int(b)`
                  62‘OP_SUB`‘B`‘R(a) = R(a)-R(a+1)`
                  63‘OP_SUBI`‘BB`‘R(a) = R(a)-mrb_int(b)`
                  64‘OP_MUL`‘B`‘R(a) = R(a)*R(a+1)`
                  65‘OP_DIV`‘B`‘R(a) = R(a)/R(a+1)`
                  66‘OP_EQ`‘B`‘R(a) = R(a)==R(a+1)`
                  67‘OP_LT`‘B`‘R(a) = R(a)<R(a+1)`
                  68‘OP_LE`‘B`‘R(a) = R(a)<=R(a+1)`
                  69‘OP_GT`‘B`‘R(a) = R(a)>R(a+1)`
                  70‘OP_GE`‘B`‘R(a) = R(a)>=R(a+1)`
                  71‘OP_ARRAY`‘BB`‘R(a) = ary_new(R(a),R(a+1)..R(a+b))`
                  72‘OP_ARRAY2`‘BBB`‘R(a) = ary_new(R(b),R(b+1)..R(b+c))`
                  73‘OP_ARYCAT`‘B`‘ary_cat(R(a),R(a+1))`
                  74‘OP_ARYPUSH`‘BB`‘ary_push(R(a),R(a+1)..R(a+b))`
                  75‘OP_ARYSPLAT`‘B`‘R(a) = ary_splat(R(a))`
                  76‘OP_AREF`‘BBB`‘R(a) = R(b)`
                  77‘OP_ASET`‘BBB`R(b) = R(a)`
                  78‘OP_APOST`‘BBB`‘*R(a),R(a+1)..R(a+c) = R(a)`
                  79‘OP_INTERN`‘B`‘R(a) = intern(R(a))`
                  80‘OP_SYMBOL`‘BB`‘R(a) = intern(Pool(b))`
                  81‘OP_STRING`‘BB`‘R(a) = str_dup(Pool(b))`
                  82‘OP_STRCAT`‘B`‘str_cat(R(a),R(a+1))`
                  83‘OP_HASH`‘BB`‘R(a) = hash_new(R(a),R(a+1)..R(a+b*2-1))`
                  84‘OP_HASHADD`‘BB`‘hash_push(R(a),R(a+1)..R(a+b*2))`
                  85‘OP_HASHCAT`‘B`‘R(a) = hash_cat(R(a),R(a+1))`
                  86‘OP_LAMBDA`‘BB`‘R(a) = lambda(Irep(b),OP_L_LAMBDA)`
                  87‘OP_BLOCK`‘BB`‘R(a) = lambda(Irep(b),OP_L_BLOCK)`
                  88‘OP_METHOD`‘BB`‘R(a) = lambda(Irep(b),OP_L_METHOD)`
                  89‘OP_RANGE_INC`‘B`‘R(a) = range_new(R(a),R(a+1),FALSE)`
                  90‘OP_RANGE_EXC`‘B`‘R(a) = range_new(R(a),R(a+1),TRUE)`
                  91‘OP_OCLASS`‘B`‘R(a) = ::Object`
                  92‘OP_CLASS`‘BB`‘R(a) = newclass(R(a),Syms(b),R(a+1))`
                  93‘OP_MODULE`‘BB`‘R(a) = newmodule(R(a),Syms(b))`
                  94‘OP_EXEC`‘BB`‘R(a) = blockexec(R(a),Irep(b))`
                  95‘OP_DEF`‘BB`‘R(a).newmethod(Syms(b),R(a+1)); R(a) = Syms(b)`
                  96‘OP_ALIAS`‘BB`‘alias_method(target_class,Syms(a),Syms(b))`
                  97‘OP_UNDEF`‘B`‘undef_method(target_class,Syms(a))`
                  98‘OP_SCLASS`‘B`‘R(a) = R(a).singleton_class`
                  99‘OP_TCLASS`‘B`‘R(a) = target_class`
                  100‘OP_DEBUG`‘BBB`‘print a,b,c`
                  101‘OP_ERR`‘B`‘raise(LocalJumpError, Pool(a))`
                  102‘OP_EXT1`‘-`‘make 1st operand (a) 16bit`
                  103‘OP_EXT2`‘-`‘make 2nd operand (b) 16bit`
                  104‘OP_EXT3`‘-`‘make 1st and 2nd operands 16bit`
                  105‘OP_STOP`‘-`‘stop VM`
                  +
                  + + + +
                  + + \ No newline at end of file diff --git a/docs/api/file.symbol.html b/docs/api/file.symbol.html new file mode 100644 index 0000000..b0d7ddf --- /dev/null +++ b/docs/api/file.symbol.html @@ -0,0 +1,149 @@ + + + + + + + File: symbol + + — Documentation by YARD 0.9.37 + + + + + + + + + + + + + + + + + + + + + + + +
                  + + +
                  +

                  Symbols

                  + +

                  Symbols in mruby C source code is represented by mrb_sym which is alias of uint32_t. Lower 30 bits are used for symbols so that higher 2 bits can be used as flags, e.g. struct mt_elem in class.c.

                  + +
                  struct mt_elem {
                  +  union mt_ptr ptr;
                  +  size_t func_p:1;
                  +  size_t noarg_p:1;
                  +  mrb_sym key:sizeof(mrb_sym)*8-2;
                  +};
                  +
                  + +

                  C API

                  + +

                  We provide following C API for symbols.

                  + +

                  Generate Symbols

                  + +

                  mrb_sym mrb_intern(mrb_state*,const char*,size_t)

                  + +

                  Get a symbol from a string.

                  + +

                  mrb_sym mrb_intern_check_cstr(mrb_state*,const char*)

                  + +

                  Get a symbol from a NULL terminated © string.

                  + +

                  mrb_sym mrb_intern_str(mrb_state*,mrb_value)

                  + +

                  Get a symbol from a Ruby string object.

                  + +

                  mrb_intern_lit(mrb_state*,const char*)

                  + +

                  Get a symbol from a C string literal. The second argument should be a C string literal, otherwise you will get a compilation error. It does not copy C string given the fact it’s a literal.

                  + +

                  mrb_sym mrb_intern_check(mrb_state*,const char*,size_t)

                  + +

                  Get a symbol from a string if the string has been already registered as a symbol, otherwise return 0. We also provide variants mrb_intern_check_str() (from Ruby string) and mrb_intern_check_cstr() (from C string).

                  + +

                  const char *mrb_sym_name(mrb_state*,mrb_sym)

                  + +

                  Get a string representation of a symbol as a C string.

                  + +

                  const char *mrb_sym_name_len(mrb_state*,mrb_sym,mrb_int*)

                  + +

                  Get a string representation of a symbol, and its length.

                  + +

                  Preallocate Symbols

                  + +

                  To save RAM, mruby can use compile-time allocation of some symbols. You can use following macros to get preallocated symbols by including mruby/presym.h header.

                  +
                  • +

                    MRB_SYM(xor) //=> xor (Word characters)

                    +
                  • +

                    MRB_SYM_B(xor) //=> xor! (Method with Bang)

                    +
                  • +

                    MRB_SYM_Q(xor) //=> xor? (Method with Question mark)

                    +
                  • +

                    MRB_SYM_E(xor) //=> xor= (Method with Equal)

                    +
                  • +

                    MRB_GVSYM(xor) //=> $xor (Global Variable)

                    +
                  • +

                    MRB_CVSYM(xor) //=> @@xor (Class Variable)

                    +
                  • +

                    MRB_IVSYM(xor) //=> @xor (Instance Variable)

                    +
                  • +

                    MRB_OPSYM(xor) //=> ^ (Operator)

                    +
                  + +

                  For MRB_OPSYM(), specify the names corresponding to operators (see MRuby::Presym::OPERATORS in lib/mruby/presym.rb for the names that can be specified for it). Other than that, describe only word characters excluding leading and ending punctuations.

                  + +

                  These macros are converted to static symbol IDs at compile time, unless preallocate symbols are disabled by conf.disable_presym. In that case, these macros are expanded to mrb_intern_lit calls, therefore the mruby state variable is required. The above macros assume the variable name is mrb. If its name is not mrb, you need to use macros with _2 suffix, such as MRB_SYM_2 to specify mrb_state* variable.

                  + +

                  Disabling Preallocated Symbols

                  + +

                  You can disable preallocated symbols by specifying conf.disable_presym in the configuration file.

                  +
                  + + + +
                  + + \ No newline at end of file diff --git a/docs/api/file_list.html b/docs/api/file_list.html index 41dc94a..0076fe0 100644 --- a/docs/api/file_list.html +++ b/docs/api/file_list.html @@ -1,12 +1,12 @@ - + - + - + @@ -46,7 +46,10 @@

                  File List

                  - + diff --git a/docs/api/frames.html b/docs/api/frames.html index 60223fe..6586005 100644 --- a/docs/api/frames.html +++ b/docs/api/frames.html @@ -2,13 +2,18 @@ - Documentation by YARD 0.9.20 + Documentation by YARD 0.9.37 -
                  ","
                  "],tr:[2,"","
                  "],td:[3,"","
                  "],col:[2,"","
                  "],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
                  ","
                  "]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function() -{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
                  ").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); \ No newline at end of file diff --git a/docs/api/js/mruby.js b/docs/api/js/mruby.js deleted file mode 100644 index e69de29..0000000 diff --git a/docs/api/method_list.html b/docs/api/method_list.html deleted file mode 100644 index 30ebacf..0000000 --- a/docs/api/method_list.html +++ /dev/null @@ -1,3974 +0,0 @@ - - - - - - - - - - - - - - - - - - Method List - - - -
                  -
                  -

                  Method List

                  - - - -
                  - - -
                  - - diff --git a/docs/api/top-level-namespace.html b/docs/api/top-level-namespace.html deleted file mode 100644 index 83e551b..0000000 --- a/docs/api/top-level-namespace.html +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - Top Level Namespace - - — Documentation by YARD 0.9.37 - - - - - - - - - - - - - - - - - - - - - - - -
                  - - -

                  Top Level Namespace - - - -

                  -
                  - - - - - - - - - - - -
                  - -

                  Defined Under Namespace

                  -

                  - - - Modules: CMath, Comparable, Enumerable, Errno, Kernel, Math, ObjectSpace - - - - Classes: Addrinfo, ArgumentError, Array, BasicObject, BasicSocket, Complex, Dir, EOFError, Enumerator, Exception, File, Float, FloatDomainError, FrozenError, Hash, IO, IOError, IPSocket, IndexError, Integer, KeyError, LocalJumpError, Method, Module, NameError, NoMethodError, NotImplementedError, Numeric, Proc, Range, RangeError, Rational, RegexpError, Set, Socket, SocketError, StopIteration, String, Struct, Symbol, TCPServer, TCPSocket, TypeError, UDPSocket, UNIXServer, UNIXSocket, UncaughtThrowError, ZeroDivisionError - - -

                  - - -

                  - Constant Summary - collapse -

                  - -
                  - -
                  STDIN = - -
                  -
                  IO.open(0, "r")
                  - -
                  STDOUT = - -
                  -
                  IO.open(1, "w")
                  - -
                  STDERR = - -
                  -
                  IO.open(2, "w")
                  - -
                  - - - - - - - - - - -
                  - - - -
                  - - \ No newline at end of file From ada908e1c109a4a50d2bc78a2eb2c5a6326cf3d9 Mon Sep 17 00:00:00 2001 From: Piotr Usewicz Date: Thu, 5 Mar 2026 19:40:56 +0100 Subject: [PATCH 53/72] Create deploy.yml --- .github/workflows/deploy.yml | 56 ++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..85863ab --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,56 @@ +name: Deploy + +on: + push: + branches: [master] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: .ruby-version + bundler-cache: false + + - name: Install dependencies + run: bundle install --with scripts + + - name: Configure GitHub Pages + uses: actions/configure-pages@v5 + + - name: Generate and build + run: bundle exec rake build + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + JEKYLL_ENV: production + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: _site/ + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 From d5ba06af1b18f850d67f503005c8fabe218ed772 Mon Sep 17 00:00:00 2001 From: Piotr Usewicz Date: Thu, 5 Mar 2026 21:45:11 +0100 Subject: [PATCH 54/72] Rename and tweak --- .github/workflows/{deploy.yml => pages.yml} | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) rename .github/workflows/{deploy.yml => pages.yml} (85%) diff --git a/.github/workflows/deploy.yml b/.github/workflows/pages.yml similarity index 85% rename from .github/workflows/deploy.yml rename to .github/workflows/pages.yml index 85863ab..d15ac9a 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/pages.yml @@ -1,4 +1,4 @@ -name: Deploy +name: Pages on: push: @@ -25,10 +25,7 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: .ruby-version - bundler-cache: false - - - name: Install dependencies - run: bundle install --with scripts + bundler-cache: true - name: Configure GitHub Pages uses: actions/configure-pages@v5 @@ -41,8 +38,6 @@ jobs: - name: Upload artifact uses: actions/upload-pages-artifact@v3 - with: - path: _site/ deploy: environment: From 804fee188216d44dec7792d812046db5e7f4cec0 Mon Sep 17 00:00:00 2001 From: Piotr Usewicz Date: Thu, 5 Mar 2026 21:45:18 +0100 Subject: [PATCH 55/72] Remove groups --- Gemfile | 20 ++++---------------- Gemfile.lock | 15 --------------- 2 files changed, 4 insertions(+), 31 deletions(-) diff --git a/Gemfile b/Gemfile index e346ee9..e48e20e 100644 --- a/Gemfile +++ b/Gemfile @@ -1,19 +1,7 @@ source 'https://rubygems.org' gem 'rake' -gem 'github-pages', group: :jekyll_plugins - -group :jekyll_plugins do - gem 'jekyll-avatar', '~> 0.8.0' - gem 'jekyll-feed' - gem 'jekyll-sitemap' -end - -group :scripts do - gem 'mgem' - gem 'git' - - # API Docs - gem 'yard-mruby' - gem 'yard-coderay' -end +gem 'github-pages' +gem 'jekyll-avatar', '~> 0.8.0' +gem 'jekyll-feed' +gem 'jekyll-sitemap' diff --git a/Gemfile.lock b/Gemfile.lock index e9ea7a4..aad9bbd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -232,7 +232,6 @@ GEM rb-inotify (~> 0.9, >= 0.9.10) logger (1.7.0) mercenary (0.3.6) - mgem (0.3.0) mini_portile2 (2.8.9) minima (2.5.1) jekyll (>= 3.5, < 5.0) @@ -254,15 +253,12 @@ GEM pathutil (0.16.2) forwardable-extended (~> 2.6) prism (1.9.0) - process_executer (4.0.2) - track_open_instances (~> 0.1) public_suffix (5.1.1) racc (1.8.1) rake (13.3.1) rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) - rchardet (1.10.0) rexml (3.4.2) rouge (3.30.0) rubyzip (2.3.2) @@ -279,7 +275,6 @@ GEM simpleidn (0.2.3) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) - track_open_instances (0.1.15) typhoeus (1.4.1) ethon (>= 0.9.0) tzinfo (2.0.6) @@ -287,27 +282,17 @@ GEM unicode-display_width (1.8.0) uri (1.1.1) webrick (1.8.2) - yard (0.9.36) - yard-coderay (0.1.0) - coderay - yard - yard-mruby (0.3.0) - yard (~> 0.9.0) PLATFORMS ruby x86_64-darwin-19 DEPENDENCIES - git github-pages jekyll-avatar (~> 0.8.0) jekyll-feed jekyll-sitemap - mgem rake - yard-coderay - yard-mruby BUNDLED WITH 2.4.1 From fe2f19a56fc319cc7560422ecc5c3c2aee2db7be Mon Sep 17 00:00:00 2001 From: Piotr Usewicz Date: Thu, 5 Mar 2026 21:54:13 +0100 Subject: [PATCH 56/72] Bump Ruby and gems --- .ruby-version | 1 + Gemfile | 4 +- Gemfile.lock | 222 +-------------------------------------- assets/css/redesign.scss | 28 ++--- 4 files changed, 19 insertions(+), 236 deletions(-) create mode 100644 .ruby-version diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..1454f6e --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +4.0.1 diff --git a/Gemfile b/Gemfile index e48e20e..e7005a7 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' gem 'rake' -gem 'github-pages' -gem 'jekyll-avatar', '~> 0.8.0' +gem 'jekyll' +gem 'jekyll-avatar' gem 'jekyll-feed' gem 'jekyll-sitemap' diff --git a/Gemfile.lock b/Gemfile.lock index aad9bbd..88a3c85 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,113 +1,18 @@ GEM remote: https://rubygems.org/ specs: - activesupport (8.1.3) - base64 - bigdecimal - concurrent-ruby (~> 1.0, >= 1.3.1) - connection_pool (>= 2.2.5) - drb - i18n (>= 1.6, < 2) - json - logger (>= 1.4.2) - minitest (>= 5.1) - securerandom (>= 0.3) - tzinfo (~> 2.0, >= 2.0.5) - uri (>= 0.13.1) addressable (2.9.0) public_suffix (>= 2.0.2, < 8.0) - base64 (0.3.0) - bigdecimal (4.1.0) - coderay (1.1.3) - coffee-script (2.4.1) - coffee-script-source - execjs - coffee-script-source (1.12.2) colorator (1.1.0) - commonmarker (0.23.10) concurrent-ruby (1.3.6) - connection_pool (3.0.2) csv (3.3.0) - dnsruby (1.72.2) - simpleidn (~> 0.2.1) - drb (2.2.3) em-websocket (0.5.3) eventmachine (>= 0.12.9) http_parser.rb (~> 0) - ethon (0.16.0) - ffi (>= 1.15.0) eventmachine (1.2.7) - execjs (2.9.1) - faraday (2.14.1) - faraday-net_http (>= 2.0, < 3.5) - json - logger - faraday-net_http (3.4.2) - net-http (~> 0.5) ffi (1.17.0) ffi (1.17.0-x86_64-darwin) forwardable-extended (2.6.0) - gemoji (4.1.0) - git (4.3.2) - activesupport (>= 5.0) - addressable (~> 2.8) - process_executer (~> 4.0) - rchardet (~> 1.9) - github-pages (232) - github-pages-health-check (= 1.18.2) - jekyll (= 3.10.0) - jekyll-avatar (= 0.8.0) - jekyll-coffeescript (= 1.2.2) - jekyll-commonmark-ghpages (= 0.5.1) - jekyll-default-layout (= 0.1.5) - jekyll-feed (= 0.17.0) - jekyll-gist (= 1.5.0) - jekyll-github-metadata (= 2.16.1) - jekyll-include-cache (= 0.2.1) - jekyll-mentions (= 1.6.0) - jekyll-optional-front-matter (= 0.3.2) - jekyll-paginate (= 1.1.0) - jekyll-readme-index (= 0.3.0) - jekyll-redirect-from (= 0.16.0) - jekyll-relative-links (= 0.6.1) - jekyll-remote-theme (= 0.4.3) - jekyll-sass-converter (= 1.5.2) - jekyll-seo-tag (= 2.8.0) - jekyll-sitemap (= 1.4.0) - jekyll-swiss (= 1.0.0) - jekyll-theme-architect (= 0.2.0) - jekyll-theme-cayman (= 0.2.0) - jekyll-theme-dinky (= 0.2.0) - jekyll-theme-hacker (= 0.2.0) - jekyll-theme-leap-day (= 0.2.0) - jekyll-theme-merlot (= 0.2.0) - jekyll-theme-midnight (= 0.2.0) - jekyll-theme-minimal (= 0.2.0) - jekyll-theme-modernist (= 0.2.0) - jekyll-theme-primer (= 0.6.0) - jekyll-theme-slate (= 0.2.0) - jekyll-theme-tactile (= 0.2.0) - jekyll-theme-time-machine (= 0.2.0) - jekyll-titles-from-headings (= 0.5.3) - jemoji (= 0.13.0) - kramdown (= 2.4.0) - kramdown-parser-gfm (= 1.1.0) - liquid (= 4.0.4) - mercenary (~> 0.3) - minima (= 2.5.1) - nokogiri (>= 1.16.2, < 2.0) - rouge (= 3.30.0) - terminal-table (~> 1.4) - webrick (~> 1.8) - github-pages-health-check (1.18.2) - addressable (~> 2.3) - dnsruby (~> 1.60) - octokit (>= 4, < 8) - public_suffix (>= 3.0, < 6.0) - typhoeus (~> 1.3) - html-pipeline (2.14.3) - activesupport (>= 2) - nokogiri (>= 1.4) http_parser.rb (0.8.0) i18n (1.14.8) concurrent-ruby (~> 1.0) @@ -128,159 +33,36 @@ GEM webrick (>= 1.0) jekyll-avatar (0.8.0) jekyll (>= 3.0, < 5.0) - jekyll-coffeescript (1.2.2) - coffee-script (~> 2.2) - coffee-script-source (~> 1.12) - jekyll-commonmark (1.4.0) - commonmarker (~> 0.22) - jekyll-commonmark-ghpages (0.5.1) - commonmarker (>= 0.23.7, < 1.1.0) - jekyll (>= 3.9, < 4.0) - jekyll-commonmark (~> 1.4.0) - rouge (>= 2.0, < 5.0) - jekyll-default-layout (0.1.5) - jekyll (>= 3.0, < 5.0) jekyll-feed (0.17.0) jekyll (>= 3.7, < 5.0) - jekyll-gist (1.5.0) - octokit (~> 4.2) - jekyll-github-metadata (2.16.1) - jekyll (>= 3.4, < 5.0) - octokit (>= 4, < 7, != 4.4.0) - jekyll-include-cache (0.2.1) - jekyll (>= 3.7, < 5.0) - jekyll-mentions (1.6.0) - html-pipeline (~> 2.3) - jekyll (>= 3.7, < 5.0) - jekyll-optional-front-matter (0.3.2) - jekyll (>= 3.0, < 5.0) - jekyll-paginate (1.1.0) - jekyll-readme-index (0.3.0) - jekyll (>= 3.0, < 5.0) - jekyll-redirect-from (0.16.0) - jekyll (>= 3.3, < 5.0) - jekyll-relative-links (0.6.1) - jekyll (>= 3.3, < 5.0) - jekyll-remote-theme (0.4.3) - addressable (~> 2.0) - jekyll (>= 3.5, < 5.0) - jekyll-sass-converter (>= 1.0, <= 3.0.0, != 2.0.0) - rubyzip (>= 1.3.0, < 3.0) jekyll-sass-converter (1.5.2) sass (~> 3.4) - jekyll-seo-tag (2.8.0) - jekyll (>= 3.8, < 5.0) jekyll-sitemap (1.4.0) jekyll (>= 3.7, < 5.0) - jekyll-swiss (1.0.0) - jekyll-theme-architect (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-cayman (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-dinky (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-hacker (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-leap-day (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-merlot (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-midnight (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-minimal (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-modernist (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-primer (0.6.0) - jekyll (> 3.5, < 5.0) - jekyll-github-metadata (~> 2.9) - jekyll-seo-tag (~> 2.0) - jekyll-theme-slate (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-tactile (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-time-machine (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-titles-from-headings (0.5.3) - jekyll (>= 3.3, < 5.0) jekyll-watch (2.2.1) listen (~> 3.0) - jemoji (0.13.0) - gemoji (>= 3, < 5) - html-pipeline (~> 2.2) - jekyll (>= 3.0, < 5.0) - json (2.19.3) kramdown (2.4.0) rexml - kramdown-parser-gfm (1.1.0) - kramdown (~> 2.0) liquid (4.0.4) listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - logger (1.7.0) mercenary (0.3.6) - mini_portile2 (2.8.9) - minima (2.5.1) - jekyll (>= 3.5, < 5.0) - jekyll-feed (~> 0.9) - jekyll-seo-tag (~> 2.1) - minitest (6.0.2) - drb (~> 2.0) - prism (~> 1.5) - net-http (0.9.1) - uri (>= 0.11.1) - nokogiri (1.19.1) - mini_portile2 (~> 2.8.2) - racc (~> 1.4) - nokogiri (1.19.1-x86_64-darwin) - racc (~> 1.4) - octokit (4.25.1) - faraday (>= 1, < 3) - sawyer (~> 0.9) pathutil (0.16.2) forwardable-extended (~> 2.6) - prism (1.9.0) public_suffix (5.1.1) - racc (1.8.1) rake (13.3.1) rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) rexml (3.4.2) rouge (3.30.0) - rubyzip (2.3.2) safe_yaml (1.0.5) sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - sawyer (0.9.2) - addressable (>= 2.3.5) - faraday (>= 0.17.3, < 3) - securerandom (0.4.1) - simpleidn (0.2.3) - terminal-table (1.8.0) - unicode-display_width (~> 1.1, >= 1.1.1) - typhoeus (1.4.1) - ethon (>= 0.9.0) - tzinfo (2.0.6) - concurrent-ruby (~> 1.0) - unicode-display_width (1.8.0) - uri (1.1.1) webrick (1.8.2) PLATFORMS @@ -288,8 +70,8 @@ PLATFORMS x86_64-darwin-19 DEPENDENCIES - github-pages - jekyll-avatar (~> 0.8.0) + jekyll + jekyll-avatar jekyll-feed jekyll-sitemap rake diff --git a/assets/css/redesign.scss b/assets/css/redesign.scss index 2c1ea0c..756023a 100644 --- a/assets/css/redesign.scss +++ b/assets/css/redesign.scss @@ -1,17 +1,17 @@ --- --- -@import "variables"; -@import "reset"; -@import "page-header"; -@import "navigation"; -@import "buttons"; -@import "latest-news"; -@import "footer"; -@import "downloads"; -@import "documentation"; -@import "inline-code"; -@import "about"; -@import "libraries"; -@import "team"; -@import "article"; +@use "variables"; +@use "reset"; +@use "page-header"; +@use "navigation"; +@use "buttons"; +@use "latest-news"; +@use "footer"; +@use "downloads"; +@use "documentation"; +@use "inline-code"; +@use "about"; +@use "libraries"; +@use "team"; +@use "article"; From 2aca136bd13e1c15f0344c0463c6f63a88f0146d Mon Sep 17 00:00:00 2001 From: Piotr Usewicz Date: Thu, 5 Mar 2026 22:00:14 +0100 Subject: [PATCH 57/72] Add missing gems --- Gemfile | 6 ++- Gemfile.lock | 107 ++++++++++++++++++++++++++++++++++++++------------- 2 files changed, 86 insertions(+), 27 deletions(-) diff --git a/Gemfile b/Gemfile index e7005a7..15bd8f2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,11 @@ source 'https://rubygems.org' -gem 'rake' gem 'jekyll' gem 'jekyll-avatar' gem 'jekyll-feed' gem 'jekyll-sitemap' +gem 'mgem' +gem 'rake' +gem 'yard-coderay' +gem 'yard-mruby' +gem 'irb' diff --git a/Gemfile.lock b/Gemfile.lock index 88a3c85..cffaa25 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,78 +3,133 @@ GEM specs: addressable (2.9.0) public_suffix (>= 2.0.2, < 8.0) + base64 (0.3.0) + bigdecimal (4.1.1) + coderay (1.1.3) colorator (1.1.0) concurrent-ruby (1.3.6) - csv (3.3.0) + csv (3.3.5) + date (3.5.1) em-websocket (0.5.3) eventmachine (>= 0.12.9) http_parser.rb (~> 0) + erb (6.0.2) eventmachine (1.2.7) - ffi (1.17.0) - ffi (1.17.0-x86_64-darwin) + ffi (1.17.4) + ffi (1.17.4-x86_64-darwin) forwardable-extended (2.6.0) - http_parser.rb (0.8.0) + google-protobuf (4.34.1) + bigdecimal + rake (~> 13.3) + google-protobuf (4.34.1-x86_64-darwin) + bigdecimal + rake (~> 13.3) + http_parser.rb (0.8.1) i18n (1.14.8) concurrent-ruby (~> 1.0) - jekyll (3.10.0) + io-console (0.8.2) + irb (1.17.0) + pp (>= 0.6.0) + prism (>= 1.3.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + jekyll (4.4.1) addressable (~> 2.4) + base64 (~> 0.2) colorator (~> 1.0) csv (~> 3.0) em-websocket (~> 0.5) - i18n (>= 0.7, < 2) - jekyll-sass-converter (~> 1.0) + i18n (~> 1.0) + jekyll-sass-converter (>= 2.0, < 4.0) jekyll-watch (~> 2.0) - kramdown (>= 1.17, < 3) + json (~> 2.6) + kramdown (~> 2.3, >= 2.3.1) + kramdown-parser-gfm (~> 1.0) liquid (~> 4.0) - mercenary (~> 0.3.3) + mercenary (~> 0.3, >= 0.3.6) pathutil (~> 0.9) - rouge (>= 1.7, < 4) + rouge (>= 3.0, < 5.0) safe_yaml (~> 1.0) - webrick (>= 1.0) + terminal-table (>= 1.8, < 4.0) + webrick (~> 1.7) jekyll-avatar (0.8.0) jekyll (>= 3.0, < 5.0) jekyll-feed (0.17.0) jekyll (>= 3.7, < 5.0) - jekyll-sass-converter (1.5.2) - sass (~> 3.4) + jekyll-sass-converter (3.1.0) + sass-embedded (~> 1.75) jekyll-sitemap (1.4.0) jekyll (>= 3.7, < 5.0) jekyll-watch (2.2.1) listen (~> 3.0) - kramdown (2.4.0) - rexml + json (2.19.3) + kramdown (2.5.2) + rexml (>= 3.4.4) + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) liquid (4.0.4) - listen (3.9.0) + listen (3.10.0) + logger rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - mercenary (0.3.6) + logger (1.7.0) + mercenary (0.4.0) + mgem (0.3.0) pathutil (0.16.2) forwardable-extended (~> 2.6) - public_suffix (5.1.1) + pp (0.6.3) + prettyprint + prettyprint (0.2.0) + prism (1.9.0) + psych (5.3.1) + date + stringio + public_suffix (7.0.5) rake (13.3.1) rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) - rexml (3.4.2) - rouge (3.30.0) + rdoc (7.2.0) + erb + psych (>= 4.0.0) + tsort + reline (0.6.3) + io-console (~> 0.5) + rexml (3.4.4) + rouge (4.7.0) safe_yaml (1.0.5) - sass (3.7.4) - sass-listen (~> 4.0.0) - sass-listen (4.0.0) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - webrick (1.8.2) + sass-embedded (1.99.0) + google-protobuf (~> 4.31) + rake (>= 13) + sass-embedded (1.99.0-x86_64-darwin) + google-protobuf (~> 4.31) + stringio (3.2.0) + terminal-table (3.0.2) + unicode-display_width (>= 1.1.1, < 3) + tsort (0.2.0) + unicode-display_width (2.6.0) + webrick (1.9.2) + yard (0.9.40) + yard-coderay (0.1.0) + coderay + yard + yard-mruby (0.3.0) + yard (~> 0.9.0) PLATFORMS ruby x86_64-darwin-19 DEPENDENCIES + irb jekyll jekyll-avatar jekyll-feed jekyll-sitemap + mgem rake + yard-coderay + yard-mruby BUNDLED WITH 2.4.1 From 352d0e077dc7b91a3f5f37ceb2c70bbc629a1609 Mon Sep 17 00:00:00 2001 From: Piotr Usewicz Date: Thu, 5 Mar 2026 22:00:53 +0100 Subject: [PATCH 58/72] Rename redesign to default --- _includes/_latest_news.html | 19 --- _includes/footer.html | 26 ++-- _includes/{redesign_head.html => head.html} | 2 +- _includes/header.html | 18 --- _includes/{redesign_nav.html => nav.html} | 0 _includes/navigation.html | 32 ----- _includes/redesign_footer.html | 13 -- _layouts/default.html | 33 ++--- _layouts/post.html | 6 +- _layouts/redesign.html | 25 ---- about/index.html | 2 +- assets/css/main.css | 134 -------------------- assets/css/{redesign.scss => main.scss} | 0 docs/index.html | 2 +- downloads/index.html | 2 +- index.html | 2 +- libraries/index.html | 2 +- team/index.html | 2 +- 18 files changed, 40 insertions(+), 280 deletions(-) delete mode 100644 _includes/_latest_news.html rename _includes/{redesign_head.html => head.html} (94%) delete mode 100644 _includes/header.html rename _includes/{redesign_nav.html => nav.html} (100%) delete mode 100644 _includes/navigation.html delete mode 100644 _includes/redesign_footer.html delete mode 100644 _layouts/redesign.html delete mode 100644 assets/css/main.css rename assets/css/{redesign.scss => main.scss} (100%) diff --git a/_includes/_latest_news.html b/_includes/_latest_news.html deleted file mode 100644 index 0890037..0000000 --- a/_includes/_latest_news.html +++ /dev/null @@ -1,19 +0,0 @@ -
                  -
                  -

                  Latest News

                  -
                  -
                  -
                  -
                  -
                    - {% for post in site.posts %} -
                  • -

                    - {{ post.date | date_to_string }}: - {{ post.title }} -

                    -
                  • - {% endfor %} -
                  -
                  -
                  diff --git a/_includes/footer.html b/_includes/footer.html index 040ba8a..819d51c 100644 --- a/_includes/footer.html +++ b/_includes/footer.html @@ -1,13 +1,13 @@ - + diff --git a/_includes/redesign_head.html b/_includes/head.html similarity index 94% rename from _includes/redesign_head.html rename to _includes/head.html index 1260641..b69d576 100644 --- a/_includes/redesign_head.html +++ b/_includes/head.html @@ -11,7 +11,7 @@ - + diff --git a/_includes/header.html b/_includes/header.html deleted file mode 100644 index a3ab86b..0000000 --- a/_includes/header.html +++ /dev/null @@ -1,18 +0,0 @@ - - - {{ page.title }} - - {% include icons.html %} - - - - - - - - - - - - - diff --git a/_includes/redesign_nav.html b/_includes/nav.html similarity index 100% rename from _includes/redesign_nav.html rename to _includes/nav.html diff --git a/_includes/navigation.html b/_includes/navigation.html deleted file mode 100644 index 6b67e0f..0000000 --- a/_includes/navigation.html +++ /dev/null @@ -1,32 +0,0 @@ - diff --git a/_includes/redesign_footer.html b/_includes/redesign_footer.html deleted file mode 100644 index 819d51c..0000000 --- a/_includes/redesign_footer.html +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/_layouts/default.html b/_layouts/default.html index a9b06f6..2879af4 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -1,24 +1,25 @@ - {% include header.html %} + {% include head.html %} - - {% include navigation.html %} - -
                  - -
                  -
                  - - {{ content }} - -
                  -
                  + {% include nav.html %} +
                  + {{ content }}
                  - {% include footer.html %} - + - \ No newline at end of file + diff --git a/_layouts/post.html b/_layouts/post.html index 0bcffc1..c12e786 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -1,10 +1,10 @@ - {% include redesign_head.html %} + {% include head.html %} - {% include redesign_nav.html %} + {% include nav.html %}
                  @@ -37,7 +37,7 @@

                  {{ page.title }}

                  - {% include redesign_footer.html %} + {% include footer.html %} - - diff --git a/about/index.html b/about/index.html index cc4138c..708f8d6 100644 --- a/about/index.html +++ b/about/index.html @@ -1,5 +1,5 @@ --- -layout: redesign +layout: default title: mruby — About --- diff --git a/assets/css/main.css b/assets/css/main.css deleted file mode 100644 index 339fd9c..0000000 --- a/assets/css/main.css +++ /dev/null @@ -1,134 +0,0 @@ -a { - color: #ce2812; -} - -.container { - padding-top: 120px; -} - -.navbar-header img { - margin-left: 160px; - top:0; - position: absolute; -} - -.footer { - padding-top: 20px; - margin-top: 20px; - text-align: center; -} - -.navbar-mruby { - background-color: transparent; - background-image: url('/assets/images/navigation_bg.png'); - border: 0px; - position: fixed; - top: 0px; - right: 0px; - left: 0px; - z-index: 100; - height: unset; -} - -.navbar-mruby .navbar-brand { - color: #ce2812; -} -.navbar-mruby .navbar-brand:hover, .navbar-mruby .navbar-brand:focus { - color: #f00; -} -.navbar-mruby .navbar-text { - color: #ce2812; -} - -.navbar-mruby .navbar-nav { - float: right; - padding-right: 120px; -} - -.navbar-nav > li { - float: left; -} - -.navbar-mruby .navbar-nav > li > a { - padding: 15px 22px!important; - color: #ce2812; -} -.navbar-mruby .navbar-nav > li > a:hover, .navbar-mruby .navbar-nav > li > a:focus { - color: #fff; - background-color: #ce2812; -} -.navbar-mruby .navbar-nav > .active > a, .navbar-mruby .navbar-nav > .active > a:hover, .navbar-mruby .navbar-nav > .active > a:focus { - color: #f00; - background-color: #eee; -} -.navbar-mruby .navbar-nav > .open > a, .navbar-mruby .navbar-nav > .open > a:hover, .navbar-mruby .navbar-nav > .open > a:focus { - color: #f00; - background-color: #eee; -} -.navbar-mruby .navbar-toggle { - border-color: #eee; -} -.navbar-mruby .navbar-toggle:hover, .navbar-mruby .navbar-toggle:focus { - background-color: #eee; -} -.navbar-mruby .navbar-toggle .icon-bar { - background-color: #ce2812; -} -.navbar-mruby .navbar-collapse, -.navbar-mruby .navbar-form { - border-color: #ce2812; -} -.navbar-mruby .navbar-link { - color: #ce2812; -} -.navbar-mruby .navbar-link:hover { - color: #f00; - background-color: #000; -} - -@media (max-width: 950px) { - .navbar-header img { - margin-left: 0px; - margin-right: 20px; - } -} - -@media (max-width: 767px) { - .navbar-mruby .navbar-nav .open .dropdown-menu > li > a { - color: #ce2812; - } - .navbar-mruby .navbar-nav .open .dropdown-menu > li > a:hover, .navbar-mruby .navbar-nav .open .dropdown-menu > li > a:focus { - color: #f00; - } - .navbar-mruby .navbar-nav .open .dropdown-menu > .active > a, .navbar-mruby .navbar-nav .open .dropdown-menu > .active > a:hover, .navbar-mruby .navbar-nav .open .dropdown-menu > .active > a:focus { - color: #f00; - background-color: #eee; - } -} - -.mruby-is { - padding: 5px 20px 20px 20px; - border-bottom: 1px solid #e5e5e5; -} - -.mruby-is p { - font-size: 150%; - padding-top: 15px; -} - -.mruby-is-get { - text-align: center; - padding-top: 5px; -} - -.mruby-is img { - width: auto; - height: 90px; - float: left; - padding-right: 20px; -} - -table td,th { - border:2px solid #eee; - padding:4px; -} diff --git a/assets/css/redesign.scss b/assets/css/main.scss similarity index 100% rename from assets/css/redesign.scss rename to assets/css/main.scss diff --git a/docs/index.html b/docs/index.html index 364c197..30a1b0b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,5 +1,5 @@ --- -layout: redesign +layout: default title: mruby - Documentation --- diff --git a/downloads/index.html b/downloads/index.html index b87ced4..f359407 100644 --- a/downloads/index.html +++ b/downloads/index.html @@ -1,5 +1,5 @@ --- -layout: redesign +layout: default title: mruby - Downloads --- diff --git a/index.html b/index.html index bb5be2c..9cb2ce4 100644 --- a/index.html +++ b/index.html @@ -1,5 +1,5 @@ --- -layout: redesign +layout: default title: mruby - Lightweight Ruby --- diff --git a/libraries/index.html b/libraries/index.html index 649af8f..21dbd25 100644 --- a/libraries/index.html +++ b/libraries/index.html @@ -1,5 +1,5 @@ --- -layout: redesign +layout: default title: mruby - Libraries --- diff --git a/team/index.html b/team/index.html index 4313fbc..19ef01c 100644 --- a/team/index.html +++ b/team/index.html @@ -1,5 +1,5 @@ --- -layout: redesign +layout: default title: mruby — Team --- From 4aa289312011fac9f8c4553adba4af123a43f63e Mon Sep 17 00:00:00 2001 From: Piotr Usewicz Date: Thu, 5 Mar 2026 22:01:24 +0100 Subject: [PATCH 59/72] Test on redesign branch --- .github/workflows/pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index d15ac9a..989cfd9 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -2,7 +2,7 @@ name: Pages on: push: - branches: [master] + branches: [master, redesign] workflow_dispatch: permissions: From cdfb7d2c36fc95600b6bab330c2bcc4892001686 Mon Sep 17 00:00:00 2001 From: Piotr Usewicz Date: Thu, 5 Mar 2026 22:08:43 +0100 Subject: [PATCH 60/72] Sort --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 15bd8f2..a4686f6 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,6 @@ source 'https://rubygems.org' +gem 'irb' gem 'jekyll' gem 'jekyll-avatar' gem 'jekyll-feed' @@ -8,4 +9,3 @@ gem 'mgem' gem 'rake' gem 'yard-coderay' gem 'yard-mruby' -gem 'irb' From 42bacc34f9963d382d1f48d7a8d018062520ba96 Mon Sep 17 00:00:00 2001 From: Piotr Usewicz Date: Thu, 5 Mar 2026 22:08:49 +0100 Subject: [PATCH 61/72] Bump bundler --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index cffaa25..902a72d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -132,4 +132,4 @@ DEPENDENCIES yard-mruby BUNDLED WITH - 2.4.1 + 4.0.7 From 859c446b3281defb57792b5a211989a9fa82f03f Mon Sep 17 00:00:00 2001 From: Piotr Usewicz Date: Thu, 5 Mar 2026 22:09:14 +0100 Subject: [PATCH 62/72] Remove unused scripts --- gen_mgemdata.rb | 26 ------------------ gen_mrbdoc.rb | 32 ---------------------- gen_releasedata.rb | 68 ---------------------------------------------- 3 files changed, 126 deletions(-) delete mode 100644 gen_mgemdata.rb delete mode 100644 gen_mrbdoc.rb delete mode 100644 gen_releasedata.rb diff --git a/gen_mgemdata.rb b/gen_mgemdata.rb deleted file mode 100644 index bd4d9bf..0000000 --- a/gen_mgemdata.rb +++ /dev/null @@ -1,26 +0,0 @@ -require 'mgem' -require 'yaml' - -include Mrbgem -mgems = load_gems - -mgems.update! - -mgem_info = [] -mgems.each do |mgem| - mgem_info << { - 'name' => mgem.name, - 'description' => mgem.description, - 'author' => mgem.author, - 'website' => mgem.website, - 'protocol' => mgem.protocol, - 'repository' => mgem.repository, - 'repooptions' => mgem.repooptions - } -end - -mgem_info.sort! { |a,b| a['name'].downcase <=> b['name'].downcase } - -File.open('_data/mgems.yml', 'w') do |f| - f.write(mgem_info.to_yaml) -end diff --git a/gen_mrbdoc.rb b/gen_mrbdoc.rb deleted file mode 100644 index a4d068f..0000000 --- a/gen_mrbdoc.rb +++ /dev/null @@ -1,32 +0,0 @@ -require 'git' - -Dir.mktmpdir do |tmp_mruby_src| - - Git.clone('https://github.com/mruby/mruby.git', 'mruby', :path => tmp_mruby_src) - - $: << "#{tmp_mruby_src}/mruby/doc/language/mrbdoc/lib" - - require 'mrbdoc_analyze' - require 'mrbdoc_docu' - - mrbdoc = MRBDoc.new - - mrbdoc.analyze_code "#{tmp_mruby_src}/mruby/" do |progress| - puts progress - end - - cfg = {:print_line_no => false} - mrbdoc.write_documentation 'docs/', cfg do |progress| - puts progress - end - - Dir.glob('docs/*.md') do |md_filename| - title = File.basename(md_filename, '.md') - File.open("#{md_filename}.tmp", 'w') do |md_file| - md_file << "---\nlayout: default\ntitle: #{title}\n---\n\n" - md_file << File.read(md_filename) - end - File.rename("#{md_filename}.tmp", md_filename) - end - -end diff --git a/gen_releasedata.rb b/gen_releasedata.rb deleted file mode 100644 index 0fa50f3..0000000 --- a/gen_releasedata.rb +++ /dev/null @@ -1,68 +0,0 @@ -# Regenerate _data/releases.yml from GitHub API. -# -# All pages derive the current stable release from the first non-prerelease -# entry in this file. Run this script after each new release or RC tag. -# -# Stable release dates are sourced from blog post filenames where available, -# falling back to the GitHub commit date for releases without a post. -# -# Usage: -# bundle exec ruby gen_releasedata.rb -# -# Requires a GitHub token via GH_TOKEN env var or `gh auth token`. - -require 'net/http' -require 'json' -require 'yaml' - -REPO = 'mruby/mruby' -DATA_FILE = File.join(__dir__, '_data', 'releases.yml') - -def gh_get(path) - uri = URI("https://api.github.com#{path}") - token = ENV['GH_TOKEN'] || `gh auth token 2>/dev/null`.strip - headers = { - 'Accept' => 'application/vnd.github.v3+json', - 'User-Agent' => 'mruby-site', - 'Authorization' => "Bearer #{token}" - } - Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http| - JSON.parse(http.get(uri.request_uri, headers).body) - end -end - -# Derive release dates from blog post filenames (format: YYYY-MM-DD-mruby-X.Y.Z-released.*) -post_dates = {} -Dir.glob(File.join(__dir__, '_posts', '*.{markdown,md}')).each do |f| - if (m = File.basename(f).match(/^(\d{4}-\d{2}-\d{2})-mruby-([\d.]+)-released/)) - post_dates[m[2]] = m[1] - end -end - -# Fetch all tags (paginated) -tags = [] -page = 1 -loop do - batch = gh_get("/repos/#{REPO}/tags?per_page=100&page=#{page}") - break if batch.empty? - tags.concat(batch) - break if batch.size < 100 - page += 1 -end - -# Keep all version-like tags (stable + rc/preview) -versioned = tags.select { |t| t['name'].match?(/^\d/) } - -releases = versioned.map do |tag| - version = tag['name'] - prerelease = !version.match?(/^\d+\.\d+\.\d+$/) - date = post_dates[version] || begin - commit = gh_get("/repos/#{REPO}/commits/#{tag['commit']['sha']}") - commit.dig('commit', 'committer', 'date')&.slice(0, 10) - end - $stdout.puts " #{version}: #{date}#{' (prerelease)' if prerelease}" - { 'version' => version, 'date' => date, 'prerelease' => prerelease } -end - -File.write(DATA_FILE, releases.to_yaml) -$stdout.puts "\nWritten #{releases.size} releases to #{DATA_FILE}" From 98d4b80543db794841efeb711b7232b78f7e2a95 Mon Sep 17 00:00:00 2001 From: Piotr Usewicz Date: Thu, 5 Mar 2026 22:19:26 +0100 Subject: [PATCH 63/72] Cleanup --- Rakefile | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/Rakefile b/Rakefile index 99e5806..baf6db8 100644 --- a/Rakefile +++ b/Rakefile @@ -4,6 +4,7 @@ namespace :gen do require 'mgem' require 'yaml' + # mgem still uses old exists? method class File class << self alias_method :exists?, :exist? unless method_defined?(:exists?) @@ -28,45 +29,52 @@ namespace :gen do mgem_info.sort_by! { |g| g['name'].downcase } - File.open('_data/mgems.yml', 'w') { |f| f.write(mgem_info.to_yaml) } - puts 'Written _data/mgems.yml' + dest = File.join(__dir__, '_data', 'mgems.yml') + + File.write(dest, mgem_info.to_yaml) + puts "Written #{dest}" end desc 'Regenerate API documentation from mruby source (clones latest release into mruby/)' task :mrbdoc do require 'json' + require 'shellwords' # Resolve latest stable release tag via gh CLI (mruby uses tags, not GitHub Releases) - tags = JSON.parse(`gh api 'repos/mruby/mruby/tags?per_page=100'`) - tag = tags.map { |t| t['name'] }.find { |n| n.match?(/^\d+\.\d+\.\d+$/) } + tags = [] + page = 1 + loop do + batch = JSON.parse(`gh api "repos/mruby/mruby/tags?per_page=100&page=#{page}"`) + break if batch.empty? + tags.concat(batch) + break if batch.size < 100 + page += 1 + end + tag = tags.map { |t| t['name'] }.find { |n| n.match?(/^\d+\.\d+\.\d+$/) } raise "Could not determine latest stable mruby release tag" unless tag puts "Latest mruby release: #{tag}" # Clone mruby at the release tag (or skip if already at the right version) mruby_dir = File.join(__dir__, 'mruby') - if Dir.exist?(mruby_dir) - current_tag = `git -C #{mruby_dir} describe --exact-match HEAD 2>/dev/null`.strip - if current_tag == tag - puts "mruby #{tag} already cloned, skipping clone" - else - puts "mruby dir exists at #{current_tag.empty? ? 'unknown version' : current_tag}, re-cloning at #{tag}" - FileUtils.rm_rf(mruby_dir) - sh "git clone --depth 1 --branch #{tag} https://github.com/mruby/mruby.git #{mruby_dir}" - end + current_tag = Dir.exist?(mruby_dir) ? `git -C #{Shellwords.escape(mruby_dir)} describe --exact-match HEAD 2>/dev/null`.strip : nil + if current_tag == tag + puts "mruby #{tag} already cloned, skipping clone" else - sh "git clone --depth 1 --branch #{tag} https://github.com/mruby/mruby.git #{mruby_dir}" + puts current_tag ? "mruby dir exists at #{current_tag}, re-cloning at #{tag}" : "Cloning mruby #{tag}" + FileUtils.rm_rf(mruby_dir) + sh "git clone --depth 1 --branch #{Shellwords.escape(tag)} https://github.com/mruby/mruby.git #{Shellwords.escape(mruby_dir)}" end # Run mrbdoc (from yard-mruby) in the mruby directory — equivalent to doc:api Dir.chdir(mruby_dir) do - sh "BUNDLE_GEMFILE=#{__dir__}/Gemfile bundle exec mrbdoc" + sh "env BUNDLE_GEMFILE=#{Shellwords.escape(File.join(__dir__, 'Gemfile'))} bundle exec mrbdoc" end # Copy generated docs into our docs/api/ directory dest = File.join(__dir__, 'docs', 'api') FileUtils.mkdir_p(dest) FileUtils.cp_r(Dir.glob("#{mruby_dir}/doc/api/*"), dest) - puts "Copied mruby API docs to docs/api/" + puts "Copied mruby API docs to #{dest}" end desc 'Regenerate release data from GitHub API (_data/releases.yml)' From c035057ecdc8212f91bbf16e75554d6fe1d3c39f Mon Sep 17 00:00:00 2001 From: Piotr Usewicz Date: Thu, 5 Mar 2026 22:23:14 +0100 Subject: [PATCH 64/72] Don't deploy on redesign --- .github/workflows/pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 989cfd9..d15ac9a 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -2,7 +2,7 @@ name: Pages on: push: - branches: [master, redesign] + branches: [master] workflow_dispatch: permissions: From 77f74aeeec49aa50a228418172eb0f21af2f826e Mon Sep 17 00:00:00 2001 From: Piotr Usewicz Date: Thu, 5 Mar 2026 22:42:11 +0100 Subject: [PATCH 65/72] Only build on official repo --- .github/workflows/pages.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index d15ac9a..8785c73 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -16,6 +16,7 @@ concurrency: jobs: build: + if: github.repository == 'mruby/mruby.github.io' runs-on: ubuntu-latest steps: - name: Checkout @@ -40,6 +41,7 @@ jobs: uses: actions/upload-pages-artifact@v3 deploy: + if: github.repository == 'mruby/mruby.github.io' environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} From 032947c0d7378082d7131426d9350a754450e1ee Mon Sep 17 00:00:00 2001 From: Piotr Usewicz Date: Thu, 5 Mar 2026 22:42:41 +0100 Subject: [PATCH 66/72] Generate contributors.yml --- Rakefile | 26 ++++- _data/contributors.yml | 217 +++++++++++++++++++++++++++++++++++++++++ team/index.html | 82 +--------------- 3 files changed, 246 insertions(+), 79 deletions(-) create mode 100644 _data/contributors.yml diff --git a/Rakefile b/Rakefile index baf6db8..44d36e3 100644 --- a/Rakefile +++ b/Rakefile @@ -77,6 +77,30 @@ namespace :gen do puts "Copied mruby API docs to #{dest}" end + desc 'Regenerate contributor list from mruby AUTHORS file (_data/contributors.yml)' + task :contributors do + require 'yaml' + + mruby_dir = File.join(__dir__, 'mruby') + raise "mruby/ not found — run gen:mrbdoc first" unless Dir.exist?(mruby_dir) + + threshold = (ENV['CONTRIBUTOR_THRESHOLD'] || '10').to_i + + # AUTHORS format: " COUNT Name (@login)[*+]" + contributors = File.readlines(File.join(mruby_dir, 'AUTHORS'), chomp: true) + .filter_map do |line| + m = line.match(/^\s*(\d+)\s+(.+?)\s+\(@([\w-]+)\)[*+]?\s*$/) + next unless m + count = m[1].to_i + next if count < threshold + { 'name' => m[2], 'login' => m[3], 'count' => count } + end + + dest = File.join(__dir__, '_data', 'contributors.yml') + File.write(dest, contributors.to_yaml) + puts "Written #{contributors.size} contributors (threshold: #{threshold} commits) to #{dest}" + end + desc 'Regenerate release data from GitHub API (_data/releases.yml)' task :releasedata do require 'json' @@ -124,7 +148,7 @@ namespace :gen do end desc 'Build the Jekyll site' -task build: %w[gen:mgemdata gen:mrbdoc gen:releasedata] do +task build: %w[gen:mgemdata gen:mrbdoc gen:contributors gen:releasedata] do sh 'bundle exec jekyll build' end diff --git a/_data/contributors.yml b/_data/contributors.yml new file mode 100644 index 0000000..f7d5c49 --- /dev/null +++ b/_data/contributors.yml @@ -0,0 +1,217 @@ +--- +- name: Yukihiro "Matz" Matsumoto + login: matz + count: 6083 +- name: dearblue + login: dearblue + count: 673 +- name: KOBAYASHI Shuji + login: shuujii + count: 587 +- name: Daniel Bovensiepen + login: bovi + count: 353 +- name: Takeshi Watanabe + login: take-cheeze + count: 345 +- name: Masaki Muranaka + login: monaka + count: 333 +- name: Jun Hiroe + login: suzukaze + count: 234 +- name: Tomoyuki Sahara + login: tsahara + count: 228 +- name: Cremno + login: cremno + count: 220 +- name: John Bampton + login: jbampton + count: 219 +- name: Yuki Kurihara + login: ksss + count: 209 +- name: Yasuhiro Matsumoto + login: mattn + count: 144 +- name: Carson McDonald + login: carsonmcdonald + count: 113 +- name: Tomasz Pędraszewski + login: dabroz + count: 104 +- name: Akira Yumiyama + login: akiray03 + count: 83 +- name: skandhas + login: skandhas + count: 83 +- name: Masamitsu MURASE + login: masamitsu-murase + count: 80 +- name: Tatsuhiko Kubo + login: cubicdaiya + count: 71 +- name: Yuichiro MASUI + login: masuidrive + count: 71 +- name: Hiroshi Mimaki + login: mimaki + count: 69 +- name: Yuichiro Kaneko + login: yui-knk + count: 62 +- name: Kurebayashi, Takahiro + login: crimsonwoods + count: 59 +- name: h2so5 + login: h2so5 + count: 56 +- name: Ralph Desir + login: Mav7 + count: 52 +- name: Paolo Bosetti + login: pbosetti + count: 48 +- name: Rory O'Connell + login: RoryO + count: 45 +- name: fleuria + login: flaneur2020 + count: 42 +- name: Christopher Aue + login: christopheraue + count: 40 +- name: Seba Gamboa + login: sagmor + count: 40 +- name: Kouhei Sutou + login: kou + count: 39 +- name: Masayoshi Takahashi + login: takahashim + count: 32 +- name: MATSUMOTO Ryosuke + login: matsumotory + count: 31 +- name: Nobuyoshi Nakada + login: nobu + count: 30 +- name: Hoshiumi Arata + login: hoshiumiarata + count: 26 +- name: Julian Aron Prenner + login: furunkel + count: 25 +- name: Clayton Smith + login: clayton-shopify + count: 22 +- name: Uchio Kondo + login: udzura + count: 22 +- name: Zachary Scott + login: zzak + count: 22 +- name: Ryan Lopopolo + login: lopopolo + count: 21 +- name: Ryan Scott + login: ryan-scott-dev + count: 20 +- name: Bouke van der Bijl + login: bouk + count: 19 +- name: Jared Breeden + login: jbreeden + count: 19 +- name: go kikuta + login: gkta + count: 19 +- name: Corey Powell + login: IceDragon200 + count: 18 +- name: Hidetaka Takano + login: TJ-Hidetaka-Takano + count: 18 +- name: Jon Maken + login: jonforums + count: 18 +- name: mirichi + login: mirichi + count: 18 +- name: Mitchell Blank Jr + login: mitchblank + count: 17 +- name: bggd + login: bggd + count: 16 +- name: kano4 + login: kano4 + count: 16 +- name: Felix Jones + login: felixjones + count: 15 +- name: Blaž Hrastnik + login: archseer + count: 14 +- name: Kazuki Tsujimoto + login: k-tsj + count: 14 +- name: Tadashi FUKUZAWA + login: FUKUZAWA-Tadashi + count: 14 +- name: fn ⌃ ⌥ + login: FnControlOption + count: 14 +- name: leviongit + login: leviongit + count: 14 +- name: Jose Narvaez + login: goyox86 + count: 13 +- name: Patrick Hogan + login: pbhogan + count: 13 +- name: Akira Kuroda + login: akuroda + count: 12 +- name: NAKAMURA Usaku + login: unak + count: 12 +- name: Ray Chason + login: chasonr + count: 12 +- name: Takashi Sawanaka + login: sdottaka + count: 12 +- name: Ukrainskiy Sergey + login: ukrainskiysergey + count: 12 +- name: Xuejie "Rafael" Xiao + login: xxuejie + count: 12 +- name: Julien Ammous + login: schmurfy + count: 11 +- name: Kazuho Oku + login: kazuho + count: 11 +- name: RIZAL Reckordp + login: Reckordp + count: 11 +- name: Seeker + login: SeekingMeaning + count: 11 +- name: takkaw + login: takkaw + count: 11 +- name: Miura Hideki + login: miura1729 + count: 10 +- name: Narihiro Nakamura + login: authorNari + count: 10 +- name: Yuichi Nishiwaki + login: nyuichi + count: 10 diff --git a/team/index.html b/team/index.html index 19ef01c..ea4c7b9 100644 --- a/team/index.html +++ b/team/index.html @@ -50,85 +50,11 @@

                  mruby Developers

                  — from the AUTHORS file
                  - Yukihiro Matsumoto + {%- for contributor in site.data.contributors -%} + {{ contributor.name }} · - FUKUOKA CSK CORPORATION - · - Kyushu Institute of Technology - · - Network Applied Communication Laboratory, Inc. - · - Daniel Bovensiepen - · - Jon Maken - · - Bjorn De Meyer - · - Yuichiro MASUI - · - Masamitsu MURASE - · - Masaki Muranaka - · - Internet Initiative Japan Inc. - · - Tadashi FUKUZAWA - · - MATSUMOTO Ryosuke - · - Koji Yoshioka - · - Jun Hiroe - · - Narihiro Nakamura - · - Yuichi Nishiwaki - · - Tatsuhiko Kubo - · - Takeshi Watanabe - · - specified non-profit corporation mruby Forum - · - Kazuaki Tanaka - · - Hiromasa Ishii - · - Hiroshi Mimaki - · - Satoshi Odawara - · - Mitsubishi Electric Micro-Computer Application Software Co.,Ltd. - · - Ralph Desir - · - Hiroyuki Matsuzaki - · - Yuhei Okazaki - · - Manycolors, Inc. - · - Shota Nakano - · - Yuichi Osawa - · - Terence Lee - · - Zachary Scott - · - Tomasz Dąbrowski - · - Christopher Aue - · - Masahiro Wakame - · - YAMAMOTO Masaya - · - KOBAYASHI Shuji - · - John Bampton - · - + 100 more on GitHub → + {%- endfor -%} + 300+ contributors on GitHub →
                  From a36e9c8db1e8d03e6aec7217aa9f910fe7d6b05d Mon Sep 17 00:00:00 2001 From: Piotr Usewicz Date: Thu, 5 Mar 2026 22:53:37 +0100 Subject: [PATCH 67/72] Update README.md --- README.md | 72 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 58 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 8e57c7f..f5c9fa9 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,79 @@ mruby.org ========= -This is the [Jekyll](https://jekyllrb.com/) source of -the [mruby.org](https://mruby.org/) website. +This is the [Jekyll](https://jekyllrb.com/) source of the [mruby.org](https://mruby.org/) website. -## Preview +## Prerequisites -The following will give you a preview of the site. +- **Ruby** — version is specified in `.ruby-version` +- **Bundler** — `gem install bundler` +- **`gh` CLI** — required by `gen:mrbdoc` and `gen:releasedata` to query the GitHub API -Install bundler: +## Local development ```shell -gem install bundler +git clone https://github.com/mruby/mruby.github.io +cd mruby.github.io +bundle install ``` -Clone the repository: +Serve the site locally with live reload: ```shell -git clone https://github.com/mruby/mruby.github.io +bundle exec rake serve +# or use the convenience script: +./server ``` -Install Jekyll and its dependencies: +## Build + +Runs all data generation tasks then builds the Jekyll site: ```shell -cd mruby.github.io -bundle install +bundle exec rake build ``` -Preview the site: +## Data generation tasks + +Each task can also be run individually: + +### `rake gen:mgemdata` + +Regenerates `_data/mgems.yml` from the mrbgems registry. Do not edit this file manually. + +```shell +bundle exec rake gen:mgemdata +``` + +### `rake gen:mrbdoc` + +Clones the latest stable mruby release into `mruby/`, generates YARD API documentation, and copies it to `docs/api/`. Requires the `gh` CLI. ```shell -bundle exec jekyll serve -open "http://localhost:4000" +bundle exec rake gen:mrbdoc ``` + +### `rake gen:contributors` + +Generates `_data/contributors.yml` from the mruby `AUTHORS` file. Requires `mruby/` to exist (run `gen:mrbdoc` first). The `CONTRIBUTOR_THRESHOLD` environment variable sets the minimum commit count (default: 10). + +```shell +bundle exec rake gen:contributors +CONTRIBUTOR_THRESHOLD=20 bundle exec rake gen:contributors +``` + +### `rake gen:releasedata` + +Generates `_data/releases.yml` from the GitHub API. Requires the `gh` CLI. + +```shell +bundle exec rake gen:releasedata +``` + +## Deployment + +GitHub Actions (`.github/workflows/pages.yml`) triggers on push to `master`. It runs `bundle exec rake build` (with `GH_TOKEN` set for the `gh` CLI calls) and deploys the result to GitHub Pages via `actions/deploy-pages`. + +## CI + +The lint workflow (`.github/workflows/lint.yml`) runs on all pull requests and checks for spelling errors (`misspell`) and merge conflict markers. From b28e57ef2f29cd5e532ded690f0cfa6b20e515da Mon Sep 17 00:00:00 2001 From: Piotr Usewicz Date: Thu, 5 Mar 2026 22:58:10 +0100 Subject: [PATCH 68/72] Add logo in the background --- _sass/_page-header.scss | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/_sass/_page-header.scss b/_sass/_page-header.scss index cebbe03..2fac2b5 100644 --- a/_sass/_page-header.scss +++ b/_sass/_page-header.scss @@ -10,6 +10,7 @@ background: var(--color-bg-warm); border-bottom: 1px solid var(--color-border); padding: 80px var(--container-padding) 56px; + overflow: hidden; /* --plain: no background, no border (downloads) */ &--plain { @@ -17,6 +18,12 @@ border-bottom: none; } + &--plain &__inner::after, + &--article &__inner::after, + &--split &__inner::after { + display: none; + } + /* --article: tighter top padding, used in post layout */ &--article { padding-top: 64px; @@ -38,6 +45,20 @@ .page-header__inner { max-width: var(--container-max-width); margin: 0 auto; + position: relative; + + &::after { + content: ''; + position: absolute; + right: 0; + top: 50%; + transform: translateY(-50%); + width: 340px; + height: 340px; + background: url('/assets/images/mruby_logo_red_icon.png') no-repeat center / contain; + opacity: 0.07; + pointer-events: none; + } } /* Left column in split layouts (implicit — no special style needed) */ @@ -177,6 +198,10 @@ .page-header__aside { padding-bottom: 0; } + + .page-header__inner::after { + display: none; + } } /* ------------------------------------------------------------ From 6f7a93f349c4899ff43ace6266e6ae807ff8703c Mon Sep 17 00:00:00 2001 From: Piotr Usewicz Date: Mon, 13 Apr 2026 12:31:05 +0200 Subject: [PATCH 69/72] Add new releases --- _data/releases.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/_data/releases.yml b/_data/releases.yml index 8bd0132..07bafbc 100644 --- a/_data/releases.yml +++ b/_data/releases.yml @@ -1,4 +1,13 @@ --- +- version: 4.0.0-rc4 + date: '2026-04-13' + prerelease: true +- version: 4.0.0-rc3 + date: '2026-04-02' + prerelease: true +- version: 4.0.0-rc2 + date: '2026-03-12' + prerelease: true - version: 4.0.0-rc date: '2026-03-05' prerelease: true From 73a752445c88fd00102604618b63fd21e20de330 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Apr 2026 18:42:24 +0000 Subject: [PATCH 70/72] Bump rake from 13.3.1 to 13.4.1 Bumps [rake](https://github.com/ruby/rake) from 13.3.1 to 13.4.1. - [Release notes](https://github.com/ruby/rake/releases) - [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc) - [Commits](https://github.com/ruby/rake/compare/v13.3.1...v13.4.1) --- updated-dependencies: - dependency-name: rake dependency-version: 13.4.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 902a72d..3cda785 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -85,7 +85,7 @@ GEM date stringio public_suffix (7.0.5) - rake (13.3.1) + rake (13.4.1) rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) From 3beffb714762bd0244427f569c0c00d794eea27d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 Apr 2026 18:42:21 +0000 Subject: [PATCH 71/72] Bump rake from 13.4.1 to 13.4.2 Bumps [rake](https://github.com/ruby/rake) from 13.4.1 to 13.4.2. - [Release notes](https://github.com/ruby/rake/releases) - [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc) - [Commits](https://github.com/ruby/rake/compare/v13.4.1...v13.4.2) --- updated-dependencies: - dependency-name: rake dependency-version: 13.4.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3cda785..74083cc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -85,7 +85,7 @@ GEM date stringio public_suffix (7.0.5) - rake (13.4.1) + rake (13.4.2) rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) From b418e0704d275fde8f0770e1c4fe65fc5bef0e0a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 17 Apr 2026 22:33:32 +0000 Subject: [PATCH 72/72] Bump yard from 0.9.40 to 0.9.42 Bumps [yard](https://yardoc.org) from 0.9.40 to 0.9.42. --- updated-dependencies: - dependency-name: yard dependency-version: 0.9.42 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 74083cc..9980d85 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -109,7 +109,7 @@ GEM tsort (0.2.0) unicode-display_width (2.6.0) webrick (1.9.2) - yard (0.9.40) + yard (0.9.42) yard-coderay (0.1.0) coderay yard