summaryrefslogtreecommitdiff
path: root/UPGRADING.md
diff options
context:
space:
mode:
Diffstat (limited to 'UPGRADING.md')
-rw-r--r--UPGRADING.md38
1 files changed, 38 insertions, 0 deletions
diff --git a/UPGRADING.md b/UPGRADING.md
index d516c97..b044cf1 100644
--- a/UPGRADING.md
+++ b/UPGRADING.md
@@ -1,6 +1,44 @@
Upgrading Hashie
================
+### Upgrading to 5.0.0
+
+#### Mash initialization key conversion
+
+Mash initialization now only converts to string keys which can be represented as symbols.
+
+```ruby
+Hashie::Mash.new(
+ {foo: "bar"} => "baz",
+ "1" => "one string",
+ :"1" => "one sym",
+ 1 => "one num"
+)
+
+# Before
+{"{:foo=>\"bar\"}"=>"baz", "1"=>"one num"}
+
+# After
+{{:foo=>"bar"}=>"baz", "1"=>"one sym", 1=>"one num"}
+```
+
+#### Mash#dig with numeric keys
+
+`Hashie::Mash#dig` no longer considers numeric keys for indifferent access.
+
+```ruby
+my_mash = Hashie::Mash.new("1" => "a") # => {"1"=>"a"}
+
+my_mash.dig("1") # => "a"
+my_mash.dig(:"1") # => "a"
+
+# Before
+my_mash.dig(1) # => "a"
+
+# After
+my_mash.dig(1) # => nil
+```
+
### Upgrading to 4.0.0
#### Non-destructive Hash methods called on Mash