Yukihiro "Matz" Matsumoto
6bc44f8aa8
Remove non-existent ISO section numbers suffixed with "(x)" [ci skip]
...
We don't know how we introduced these section references.
Weak memories.
2023-01-08 22:32:16 +09:00
John Bampton
ea8964ef35
ruby: standardize whitespace
2022-10-31 16:25:56 +10:00
John Bampton
44db4f18d3
Remove # coding: utf-8 from Ruby files
...
The default script encoding is Encoding::UTF-8 after v2.0.
https://ruby-doc.org/core-2.1.2/Encoding.html#class-Encoding-label-Script+encoding
2022-10-27 04:43:13 +10:00
Yukihiro "Matz" Matsumoto
01392e2719
mrblib/array.rb: add call-seq to each method description. [ci skip]
2022-06-22 19:02:54 +09:00
Yukihiro "Matz" Matsumoto
91255c7e9f
mrblib/array.rb: Array#<=> to handle NoMethodError exception.
...
Array element may not respond to `<=>` method.
2022-03-26 22:57:41 +09:00
Yukihiro "Matz" Matsumoto
5c7aa4f299
Simplify module inclusion for Array, Hash and Range.
2021-05-13 16:07:09 +09:00
Yukihiro "Matz" Matsumoto
955c7f703e
array.rb: add Array#entries as an alias to Array#to_a.
...
The performance of `Enumerable#entries` are significantly slower than
`Array#to_a`.
2021-05-12 07:17:49 +09:00
John Bampton
4fa3359d44
refactor: remove trailing whitespace from C, Header, Ruby and YAML files
...
Lint
2020-12-15 19:44:02 +10:00
Yukihiro "Matz" Matsumoto
71f9add1c5
Move inline iseq in array.c to array.rb.
...
There's no efficiency difference since `cdump` is implemented.
2020-11-25 23:14:38 +09:00
Yukihiro "Matz" Matsumoto
afba74ff50
Add Array.new([1,2,3]) initialization.
2020-11-05 14:29:25 +09:00
Yukihiro "Matz" Matsumoto
0bb4d10ca7
Define Array#to_a to avoid unnecessary loops.
2020-07-22 14:56:56 +09:00
Yukihiro "Matz" Matsumoto
914da3d712
Small comment fix in mrblib/array.c.
2020-07-22 14:56:36 +09:00
Yukihiro "Matz" Matsumoto
5b1f25a4e0
Implement Array#each using inline mruby bytecode.
2019-08-17 14:46:32 +09:00
Yukihiro "Matz" Matsumoto
d605b72c1d
Merge branch 'master' into i110/inspect-recursion
2019-07-17 10:35:41 +09:00
Yukihiro "Matz" Matsumoto
af51119d3a
Raise error on failed comparison in sort; ref #4307
2019-03-02 15:46:50 +09:00
Yukihiro "Matz" Matsumoto
afca99a40b
Remove implicit conversion using to_int method.
...
The ISO standard does not include implicit type conversion using
`to_int`. This implicit conversion often causes vulnerability.
There will be no more attacks like #4120 .
In addition, we have added internal convenience method `__to_int` which
does type check and conversion (from floats).
2018-11-19 11:28:51 +09:00
Yukihiro "Matz" Matsumoto
34872e90d4
Re-implement Array#_inspect and Hash#_inspect without blocks.
...
To reduce the env object allocation; ref #4143
2018-10-29 11:55:49 +09:00
Tomoyuki Sahara
91444c4747
replace quicksort with mergesort.
2018-10-18 13:07:47 +09:00
Yukihiro "Matz" Matsumoto
fee9ec61bb
Make Array.new to accept both integers and floats.
...
This time we used `Integral` module which is mruby specific.
2018-08-13 23:15:52 +09:00
Ichito Nagata
2af92d0ebc
Let inspect recursion do the right thing
2018-06-04 11:25:10 +09:00
Tomoyuki Sahara
f0e54df4fe
sort method should not consume system stack.
2018-04-23 12:28:15 +09:00
Yukihiro "Matz" Matsumoto
d88191e7e7
Implement Array#__svalue in C.
2018-04-17 11:32:31 +09:00
Yukihiro "Matz" Matsumoto
1a8483f17e
__sort_sub__ is a method defined in Array; fix #3970
...
Reorganize `__sort_sub__` arguments.
2018-03-16 14:49:51 +09:00
Christopher Aue
c956e17c02
Replaced Array#each with while loop for performance reasons
...
Example benchmark:
$ time build/bench/bin/mruby -e "Array.new(2_000_000){ |i| i }.index{ |i| i == 1_999_999 }"
Before:
real 0m0.934s
user 0m0.922s
sys 0m0.003s
After:
real 0m0.590s
user 0m0.583s
sys 0m0.007s
2017-08-26 15:57:25 +02:00
Christopher Aue
3359b86ec7
Improved speed of enumeration methods
2017-07-30 13:19:31 +02:00
Yukihiro "Matz" Matsumoto
7b8d784040
Reimplement sort method to reduce array copying.
2017-07-25 14:42:38 +09:00
Jun Hiroe
88076901fd
Refactor Array#each
2015-12-26 10:12:01 +09:00
Yusuke Tanaka
d3f59db597
Remove redundant conditions of Array#each in ruby extension
2015-12-15 19:54:29 +09:00
go.kikuta
931a7223e6
array.rb: refactor (use onliner code if possible)
2015-08-21 14:56:49 +09:00
go.kikuta
c326f065e1
array.rb: refactor some code
2015-08-19 16:17:06 +09:00
Franck Verrot
2588507285
Remove unnecessary backticks.
...
Dr Markus Kuhn published in 1999 an article [1] explaining in details
why we shouldn't use the ASCII grave accent (0x60) as a left quotation.
Backticks have been used most notably to produce nice-looking LaTeX
documents but it doesn't seem to be an issue on modern platforms and
for the oldest ones, there are workarounds as mentioned by Dr Kuhn.
[1]: https://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html
2015-06-24 13:07:07 +02:00
Yukihiro "Matz" Matsumoto
b05d736b49
update mrblib/*.rb files to conform (some of) Rubocop checks
2015-05-29 17:01:52 +09:00
Yukihiro "Matz" Matsumoto
79fb18445d
rescue SystemStackError that comes from inspecting self-referencing Hashes and Arrays; fix #2461
2014-07-12 23:22:20 +09:00
mirichi
d2e4937cea
Refactoring Array#__svalue
2014-04-25 21:36:52 +09:00
Yukihiro "Matz" Matsumoto
b4043256d0
implement part of Array#<=> in C
2014-04-02 18:04:09 +09:00
Yukihiro "Matz" Matsumoto
94effc6a37
implement Array comparisons by Ruby
2014-04-02 17:33:25 +09:00
Yukihiro "Matz" Matsumoto
d9feed6703
move Array#inspect implementation to mrblib/array.rb
2014-04-01 14:31:39 +09:00
Yukihiro "Matz" Matsumoto
a85fdbdba4
according to JIS/ISO, Array is not Comparable
2014-03-31 00:50:16 +09:00
Yukihiro "Matz" Matsumoto
027d6407cc
make Enumerable methods to support multiple values; collect, detect, each_with_index, find_all, inject, max, min, partition, reject, sort
2014-03-17 00:53:08 +09:00
Yukihiro "Matz" Matsumoto
ed2fe64076
Enumerable#entries to support multiple values; close #1868
2014-03-17 00:34:47 +09:00
ksss
bc63518fa7
modify core method that return Enumerator object if not block given
2014-03-15 08:15:04 +09:00
Yukihiro "Matz" Matsumoto
113ab60784
mruby-enumerator: move definitions in core_mod.rb to mrblib core
2014-03-14 02:41:22 +09:00
Yukihiro "Matz" Matsumoto
4a2c37df93
made mrb_define_class to return existing class, with heavy refactoring
2014-02-08 13:44:31 +09:00
Masaki Muranaka
6cd7017ec1
Remove trailing whitespaces. This is just a cosmetic change.
2013-03-03 10:54:00 +09:00
Yukihiro Matz Matsumoto
c9c758d6ed
fixed wrong loop termination introduced by 79d38c4
2013-01-18 15:43:35 +09:00
Yukihiro Matz Matsumoto
5166aa726d
check if array expands in each block
2013-01-16 18:35:25 +09:00
Yukihiro Matz Matsumoto
79d38c4962
check if array shrinks in each block
2013-01-16 18:32:04 +09:00
Yukihiro Matz Matsumoto
55870e4b82
small refactoring for Array#each
2012-12-19 20:41:41 +09:00
Ryan Scott Lewis
6a450a6bda
Update Array#each to be slightly faster.
2012-12-19 06:02:15 -05:00
Yoji SHIDARA
aff4865f45
Fix a typo in comment
...
elment ->
element
2012-12-16 11:10:15 +09:00