This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# case1 | |
Hash.new.tap do |hash| | |
hash[:key1] = value1 if condition_1 | |
hash[:key2] = value2 if condition_2 | |
end | |
# case2 | |
hash = {} | |
hash[:key1] = value1 | |
hash[:key2] = value2 if condition_2 |
OlderNewer