Clean up the end of our custom require.

There are only 2 options. Shortcutting one of them with a `require` just
makes it messy. Use `if`. It's really basic. Basic is good. Maybe we
should try to push towards basic and good. It would be work but make
us happier in the long run.

Signed-off-by: Ryan Davis <zenspider@chef.io>
This commit is contained in:
Ryan Davis 2019-12-28 14:48:32 -08:00
parent 99f86c8a0b
commit fdc281d19c

View file

@ -23,10 +23,12 @@ module Inspec
# context that provides the correct plane to evaluate all required files to.
# It will ensure that embedded calls to `require` still call this
# method and get loaded from their correct paths.
return __inspec_binding.eval(content, path, line) if defined?(__inspec_binding)
if defined?(__inspec_binding)
__inspec_binding.eval(content, path, line)
else
eval(content, TOPLEVEL_BINDING, path, line) # rubocop:disable Security/Eval
end
end
end
end
end