-
-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Symbolize and freeze keys when loading from YAML
- Loading branch information
1 parent
8ac1724
commit 0fda789
Showing
2 changed files
with
7 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -240,7 +240,7 @@ def load_rb(filename) | |
def load_yml(filename) | ||
begin | ||
if YAML.respond_to?(:unsafe_load_file) # Psych 4.0 way | ||
[YAML.unsafe_load_file(filename), false] | ||
[YAML.unsafe_load_file(filename, symbolize_names: true, freeze: true), true] | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
radar
Collaborator
|
||
else | ||
[YAML.load_file(filename), false] | ||
end | ||
|
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
This change seems to cause:
, calling this
unsafe_load_file(filename)
:https://github.com/dtao/safe_yaml/blob/0b4736d/lib/safe_yaml.rb#L36-L47