diff options
author | Victor Shepelev <[email protected]> | 2021-12-19 18:09:52 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2021-12-20 01:09:52 +0900 |
commit | a0f10a973fb94a0ee73da7cab792128cdf601783 (patch) | |
tree | e025219312d597d04d0670951c13a867f2f98721 /hash.c | |
parent | 1dd10e189274546689c0b59f6a76849b2808f255 (diff) |
[DOC] Add documentation for hash value omission syntax
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5244
Merged-By: nobu <[email protected]>
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -6701,6 +6701,14 @@ static const rb_data_type_t env_data_type = { * # Raises SyntaxError (syntax error, unexpected ':', expecting =>): * h = {0: 'zero'} * + * Hash value can be omitted, meaning that value will be fetched from the context + * by the name of the key: + * + * x = 0 + * y = 100 + * h = {x:, y:} + * h # => {:x=>0, :y=>100} + * * === Common Uses * * You can use a \Hash to give names to objects: |