Граф коммитов

825 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada 2eea9156eb
Adjusted indents [ci skip] 2020-12-28 19:43:55 +09:00
Marc-André Lafortune db2ebbd71b
Optimize calls to `Kernel#hash` (#3987)
This avoids recursive checks when the `hash` method of an object
isn't specialized.
2020-12-25 02:08:12 +09:00
Marc-Andre Lafortune 0d3dc2ec80 Make `Hash#except` always return a Hash
[Feature #15822]
2020-12-19 03:59:51 -05:00
Marc-Andre Lafortune 8558d5e480 Document Hash#transform_keys with hash. Amend NEWS [DOC] [ci skip] 2020-12-15 17:09:01 -05:00
Lars Kanis ca76337a00
Windows: Read ENV names and values as UTF-8 encoded Strings (#3818)
* Windows: Read ENV names and values as UTF-8 encoded Strings

Implements issue #12650: fix https://bugs.ruby-lang.org/issues/12650

This also removes the special encoding for ENV['PATH'] and some
complexity in the code that is unnecessary now.

* Windows: Improve readablity of getenv() encoding

getenv() did use the expected codepage as an implicit parameter of the macro.
This is mis-leading since include/ruby/win32.h has a different definition.
Using the "cp" variable explicit (like the other function calls) makes it
more readable and consistent.

* Windows: Change external C-API macros getenv() and execv() to use UTF-8

They used to process and return strings with locale encoding,
but since all ruby-internal spawn and environment functions use UTF-8,
it makes sense to change the C-API equally.
2020-12-08 02:00:39 +09:00
卜部昌平 547c71dec4
Hash#index: delete
Has been deprecated since 0c97c8e335.
2020-12-07 18:35:58 +09:00
卜部昌平 12a121cc0f
ENV.index: delete
Has been deprecated since 373282f665.
2020-12-02 20:17:11 +09:00
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