Sha256: 1ed644b2ed29ae65b53a5320e998c81162610bf445c646fb8932c6986837530e
Contents?: true
Size: 823 Bytes
Versions: 36
Compression:
Stored size: 823 Bytes
Contents
module PowerStencil module Utils module SecureRequire def securely_require(ruby_source_file, fail_on_error: false) PowerStencil.logger.debug "Securely requiring Ruby source file '#{ruby_source_file}'..." require ruby_source_file yield if block_given? rescue StandardError, SyntaxError => e PowerStencil.logger.debug PowerStencil::Error.report_error(e) msg = "Could not require Ruby source file '#{ruby_source_file}' !" if fail_on_error msg << ' Aborting !' PowerStencil.logger.error msg raise PowerStencil::Error, "Invalid Ruby source file: '#{ruby_source_file}' !" else msg << " (#{e.message})" msg << ' Ignoring...' PowerStencil.logger.warn msg end end end end end
Version data entries
36 entries across 36 versions & 1 rubygems