summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMarcus Stollsteimer <sto.mar@web.de>2017-12-19 23:19:00 +0100
committerMarcus Stollsteimer <sto.mar@web.de>2018-04-24 22:20:13 +0200
commit91731afbd181f78c9aea07bc1b65ff20a20010b9 (patch)
tree7411fe0127ec743ef3f601e7eec2fff2cafee54a /lib
parente003ec86219b4466b05de97b757e0e3cfe303ebe (diff)
downloadpsych-91731afbd181f78c9aea07bc1b65ff20a20010b9.zip
Fix fallback argument for Psych.load
This allows calling Psych.load with a fallback argument, similar to Psych.load_file. Before, for Psych.load this caused a "NoMethodError: undefined method `to_ruby'".
Diffstat (limited to 'lib')
-rw-r--r--lib/psych.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/psych.rb b/lib/psych.rb
index a728dd7..0caaf4c 100644
--- a/lib/psych.rb
+++ b/lib/psych.rb
@@ -260,7 +260,7 @@ module Psych
# Psych.load("---\n foo: bar", symbolize_names: true) # => {:foo=>"bar"}
#
def self.load yaml, filename = nil, fallback: false, symbolize_names: false
- result = parse(yaml, filename, fallback: fallback)
+ result = parse(yaml, filename, fallback: FALLBACK.new(fallback))
result = result.to_ruby if result
symbolize_names!(result) if symbolize_names
result
@@ -513,7 +513,7 @@ module Psych
# the specified +fallback+ return value, which defaults to +false+.
def self.load_file filename, fallback: false
File.open(filename, 'r:bom|utf-8') { |f|
- self.load f, filename, fallback: FALLBACK.new(fallback)
+ self.load f, filename, fallback: fallback
}
end