From 89962f27a75183947fc44cd051a1061ce157221d Mon Sep 17 00:00:00 2001 From: icebaker Date: Sat, 18 Nov 2023 20:08:34 -0300 Subject: adding safety sandbox --- logic/cartridge/safety.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 logic/cartridge/safety.rb (limited to 'logic/cartridge') diff --git a/logic/cartridge/safety.rb b/logic/cartridge/safety.rb new file mode 100644 index 0000000..84b39d7 --- /dev/null +++ b/logic/cartridge/safety.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +require_relative 'fetch' + +module NanoBot + module Logic + module Cartridge + module Safety + def self.sandboxed?(cartridge) + sandboxed = Fetch.cascate(cartridge, [%i[safety functions sandboxed]]) + return true if sandboxed.nil? + + sandboxed + end + end + end + end +end -- cgit v1.2.3