Commit graph

968 commits

Author SHA1 Message Date
Cristian Greco
ce3c9a3437 Fix USE_TRANSIENT_HEAP macro usage in hash.c
Additionally fix some typos in transient heap.
2020-11-19 07:11:36 +09:00
Jeremy Evans
c0aeb98aa9 Make ENV.replace handle multiple environ entries with the same key
While it is expected that all environment keys are unique, that is
not enforced. It is possible by manipulating environ directly you
can call a process with an environment with duplicate keys.  If
ENV.replace was passed a hash with a key where environ had a
duplicate for that key, ENV.replace would end up deleting the key
from environ.

The fix in this case is to not assume that the environment key
list has unique keys, and continue processing the entire key
list in keylist_delete.

Fixes [Bug #17254]
2020-10-29 08:08:42 -07:00
Stefan Stüben
8c2e5bbf58 Don't redefine #rb_intern over and over again 2020-10-21 12:45:18 +09:00
Cristian Greco
6527411f05 [ci skip] Minor documentation fix.
Add missing period.
2020-10-12 15:16:24 +09:00
Kazuhiro NISHIYAMA
cece71b467
Add call-seq of [Feature #16274] 2020-09-29 22:49:44 +09:00
bogdanvlviv
cdb5258bec Fix ENV.except's docs 2020-09-26 12:02:00 -04:00
Jeremy Evans
df14c758fc Make hash returned by Hash#transform_values not have a default
This sets an explicit default of nil.  There is probably a better
approach of removing the default.

Fixes [Bug #17181]
2020-09-21 19:35:08 -07:00
Burdette Lamar
8095114f17
Comply with guide for method doc: hash.c (#3466)
Instance methods considered (most unchanged):
- any
- dig
- \<=
- \<
- \>=
- \>
- to_proc
2020-08-27 14:54:36 -05:00
Burdette Lamar
029c7e6045
Comply with guide for method doc: hash.c (#3465)
Instance methods considered (maybe not all changed):

    invert
    merge!
    merge
    assoc
    rassoc
    flatten
    compact
    compact!
    compare_by_identity
    compare_by_identity?
2020-08-27 13:28:34 -05:00
Burdette Lamar
f332fe236c
Comply with guide for method doc: hash.c (#3464)
Instance methods considered (maybe not all changed):

    to_a
    inspect
    to_hash
    to_h
    keys
    values
    include?
    has_value?
    ==
    eql?
    hash
2020-08-27 11:52:29 -05:00
Burdette Lamar
b8bfb1d5f5
Comply with guide for method doc: hash.c (#3459)
Instance methods considered (some maybe not changed):

    clear
    []=
    replace
    length
    empty?
    each_value
    each_key
    each_pair
    transform_keys
    transform_keys!
    transform_values
    transform_values!
2020-08-27 08:31:32 -05:00
Burdette Lamar
a84a2e872f
Comply with guide for method doc: hash.c (#3454)
Methods reviewed (a few not modified):

    key
    delete
    shift
    delete_if
    reject!
    reject
    slice
    except
    values_at
    fetch_values
    select
    select!
    keep_if
2020-08-25 16:09:31 -05:00
Burdette Lamar
36cc53daae
Comply with guide for method doc: hash.c (#3451)
Methods:

    ::new
    ::[]
    ::try_convert
    #rehash
    #[]
    #fetch
    #default
    #default=
    #default_proc
    #default_proc=
2020-08-25 10:47:23 -05:00
Burdette Lamar
1d3e87a28c
Remove checks for self returned in array.c and hash.c examples (#3446)
Further compliance with https://github.com/ruby/ruby/blob/master/doc/method_documentation.rdoc#details-and-examples-
2020-08-23 12:10:01 -05:00
Burdette Lamar
0fea0427ae
Remove nil-return examples from hash.c (#3438)
* Remove nil-return examples from hash.c
2020-08-21 11:42:02 -05:00
Burdette Lamar
1d1e36fab6
Partial compliance with doc/method_documentation.rdoc in hash.c (#3432)
Removes references to *-convertible thingies.
2020-08-20 07:34:24 -05:00
Marc-Andre Lafortune
eae7aef020 [DOC] Improve Hash's doc for missing keys 2020-08-19 19:32:15 -04:00
Marc-Andre Lafortune
a586ccf21f [DOC] Improve and simplify key egality documentation for Hash 2020-08-19 19:32:15 -04:00
卜部昌平
99093e1600 RHASH_TBL: is now ext-only
It seems almost no internal codes use RHASH_TBL any longer.  Why not
just eliminate it entirely, so that the macro can be purely ext-only.
2020-08-19 15:10:53 +09:00
Burdette Lamar
c84ccf1a07
Fix links to Dig Methods document (#3421)
* Fix links to Dig Methods document

* Fix links to Dig Methods document
2020-08-14 18:55:04 -05:00
Burdette Lamar
22fd617aa5
Adding doc/dig_methods.rdoc and links to it (#3416)
Adds a full discussion of #dig, along with links from Array, Hash, Struct, and OpenStruct.

CSV::Table and CSV::Row are over in ruby/csv. I'll get to them soon.

The art to the thing is to figure out how much (or how little) to say at each #dig.
2020-08-13 13:16:27 -05:00
Benoit Daloze
241244739f Fix arity of Hash#to_proc [Bug #12671] 2020-07-29 18:09:53 +02:00
卜部昌平
1e8461424c rb_hash_transient_heap_evacuate: do not goto into a branch
I'm not necessarily against every goto in general, but jumping into a
branch is definitely a bad idea.  Better refactor.
2020-06-29 11:05:41 +09:00
卜部昌平
5f60538245 any_hash: do not goto into a branch
I'm not necessarily against every goto in general, but jumping into a
branch is definitely a bad idea.  Better refactor.
2020-06-29 11:05:41 +09:00
Timo Schilling
82ca8c7303
Add Hash#except ENV#except [Feature #15822] 2020-06-18 22:47:32 +09:00
Nobuyoshi Nakada
04fddf3573 ENV.delete should return the result of block on non-existing key
Fixes [Bug #16173]

Co-Authored-By: Burdette Lamar <burdettelamar@yahoo.com>
Co-Authored-By: Jeremy Evans <code@jeremyevans.net>
2020-06-10 12:49:27 -07:00
Burdette Lamar
8d4b259408
Enhanced Rdoc for Array#fetch and Array#index (#3202)
* Enhanced Rdoc for Array#fetch and Array#index
* Couple of tweaks (per review) in Rdoc for Hash
2020-06-10 06:45:29 -05:00
Burdette Lamar
7c2f742c40
Enhanced Rdoc for Hash (#3187)
Methods:

    #<=
    #<
    #>=
    #>
    #to_proc

Also, a small amount of housekeeping: Adding backslash to some class name to prevent linking.
2020-06-07 13:46:43 -05:00
Burdette Lamar
e2d76478db
Enhanced Rdoc for Hash (#3178)
* Enhanced Rdoc for Hash

* Fix typo in Hash Rdoc

* Enhanced Rdoc for Hash
2020-06-03 18:53:56 -05:00
Burdette Lamar
afefcade98
[ci skip] Enhanced Rdoc for Hash (#3162)
* Enhanced Rdoc for Hash

* Enhanced Rdoc for Hash
2020-06-02 10:53:25 -05:00
S-H-GAMELINKS
6a0405def2 fix typo in Hash#delete docs 2020-06-01 08:11:05 +09:00
Burdette Lamar
c1f6552b58
[ci skip] Enhanced Rdoc for Hash (#3155)
* Enhanced Rdoc for Hash

* Respond to review
2020-05-29 13:53:11 -05:00
Burdette Lamar
28ce75821d
Enhanced Rdoc for Hash (#3151) 2020-05-28 06:21:48 -05:00
Burdette Lamar
139839b805
[ci skip] Enhanced Rdoc for Hash (#3143)
* Enhanced Rdoc for Hash

* Respond to review

* Nudge CI testing.
Respond to review
2020-05-27 09:31:22 -05:00
Burdette Lamar
8b8b7c7876
Enhanced Rdoc for Hash (#3139) 2020-05-23 20:35:05 -05:00
BurdetteLamar
da484c3187 Enhanced Rdoc for Hash 2020-05-23 12:36:42 +12:00
Burdette Lamar
ac395754c7
Enhanced rdoc for Hash (#3129) 2020-05-22 15:05:19 +12:00
S-H-GAMELINKS
d707c92a35 add static modifier for rb_hash_keep_if func 2020-05-22 11:51:32 +09:00
S-H-GAMELINKS
e5354de9f4 add static modifier for rb_hash_select_bang func 2020-05-22 11:51:32 +09:00
S-H-GAMELINKS
7c4e085938 add static modifier for rb_hash_select func 2020-05-22 11:51:32 +09:00
Burdette Lamar
140d4e4a5f
[ci skip] Enhanced rdoc for Hash (#3121) 2020-05-21 10:57:38 +12:00
S-H-GAMELINKS
ff58cbce94 add static modifer for rb_hash_fetch_values func 2020-05-20 23:22:46 +09:00
Burdette Lamar
d469807980
[CI skip] Enhance rdoc intro for Hash (#3056)
* Per @nobu review

* [CI skip] Enhance rdoc intro for Hash

* Tweak call-seq for Hash.new

* Tweak call-seq for Hash.new

* Minor corrections

* Respond to review

* Respond to review

* Respond to review

* Respond to review

* Fix chain exampmle

* Response to review
2020-05-15 14:11:42 -07:00
Jeremy Evans
de29a022ac Document that #hash is not called for certain core classes [ci skip]
Fixes [Bug #16850]
2020-05-12 18:01:16 -07:00
卜部昌平
9e41a75255 sed -i 's|ruby/impl|ruby/internal|'
To fix build failures.
2020-05-11 09:24:08 +09:00
卜部昌平
d7f4d732c1 sed -i s|ruby/3|ruby/impl|g
This shall fix compile errors.
2020-05-11 09:24:08 +09:00
Nobuyoshi Nakada
5d430c1b34
Added more NORETURN declarations 2020-05-11 00:40:14 +09:00
Burdette Lamar
f563f3c5ef
RDoc enhancements for Hash[]. 2020-04-23 20:46:20 +12:00
Nobuyoshi Nakada
0a986b81e1
Env values removed by ENV.clear are not used 2020-04-18 23:19:58 +09:00
Nobuyoshi Nakada
97e8c72e56
Bypass env key encoding conversion if unnecessary 2020-04-18 23:19:58 +09:00