Slide 53
Slide 53 text
Fat
1 require "fat"
2
3 hash = {
4 "foo" => {
5 "bar" => {
6 "baz" => "value",
7 },
8 },
9 }
10
11 hash["foo"]["not"]["baz"] # undefined method [] for nil
12
13 Fat.at(hash, "foo", "not", "baz") # Fat::FatError: "foo.not" is nil
14
15 Fat.at(hash, "foo.bar.baz") # When keys are Strings.
16
17 Fat.at(hash, "foo:bar:baz") # When keys are Symbols.
1 require "fat"
2
3 hash = {
4 "foo" => {
5 "bar" => {
6 "baz" => "value",
7 },
8 },
9 }
10
11 hash["foo"]["not"]["baz"] # undefined method [] for nil
12
13 Fat.at(hash, "foo", "not", "baz") # Fat::FatError: "foo.not" is nil
14
15 Fat.at(hash, "foo.bar.baz") # When keys are Strings.
16
17 Fat.at(hash, "foo:bar:baz") # When keys are Symbols.