Skip to content

Commit d43a071

Browse files
committed
(BOLT-1585) Fix bug for Psych support
The intended logic for deterining the correct invocation of the Psych method was flawed such that the "legacy" function invocation was always used. When the new Psych version shipped with ruby 3, the positional parameter is no longer supported. This commit updates the logic to correctly determine if the named argument is available in the Psych class.
1 parent 2b45b47 commit d43a071

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/bolt/pal/yaml_plan/loader.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def deserialize(node)
5050
def self.parse_plan(yaml_string, source_ref)
5151
# This passes the filename as the second arg for compatibility with Psych used with ruby < 2.6
5252
# This can be removed when we remove support for ruby 2.5
53-
parse_tree = if Psych.method(:parse).parameters.include?('legacy_filename')
53+
parse_tree = if Psych.method(:parse).parameters.rassoc(:filename)
5454
Psych.parse(yaml_string, filename: source_ref)
5555
else
5656
Psych.parse(yaml_string, source_ref)

0 commit comments

Comments
 (0)