Last active
August 29, 2015 14:16
-
-
Save mrzasa/624135e254d4c981f01f to your computer and use it in GitHub Desktop.
Hash default and symbolize
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
h = {} | |
h[:a] | |
h.default = 0 | |
h[:a] += 1 | |
h = Hash.new(0) | |
require 'active_support/core_ext/hash/indifferent_access' | |
h = {"a" => 1, "b" => 2} | |
h.symbolize_keys | |
h.with_indifferent_access[:a] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment