Today I learned that as of Ruby 3, we can omit values from hashes if the key name matches the expression:
# In Rubies < v3:
a = "alice"
b = "bob"
h = {a: a, b: b}
# In Rubies >= v3:
a = "alice"
b = "bob"
h = {a:, b:}
Today I learned that as of Ruby 3, we can omit values from hashes if the key name matches the expression:
# In Rubies < v3:
a = "alice"
b = "bob"
h = {a: a, b: b}
# In Rubies >= v3:
a = "alice"
b = "bob"
h = {a:, b:}
For further actions, you may consider blocking this person and/or reporting abuse
Danica Fine -
Grant Riordan -
Marcin Zaremski -
Lucas Cavalcante -
Top comments (0)