summaryrefslogtreecommitdiff
path: root/logic/cartridge
diff options
context:
space:
mode:
Diffstat (limited to 'logic/cartridge')
-rw-r--r--logic/cartridge/safety.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/logic/cartridge/safety.rb b/logic/cartridge/safety.rb
index 84b39d7..6414e51 100644
--- a/logic/cartridge/safety.rb
+++ b/logic/cartridge/safety.rb
@@ -6,6 +6,27 @@ module NanoBot
module Logic
module Cartridge
module Safety
+ def self.default_answer(cartridge)
+ default = Fetch.cascate(cartridge, [%i[interfaces tools confirm default]])
+ return [] if default.nil?
+
+ default
+ end
+
+ def self.yeses(cartridge)
+ yeses_values = Fetch.cascate(cartridge, [%i[interfaces tools confirm yeses]])
+ return [] if yeses_values.nil?
+
+ yeses_values
+ end
+
+ def self.confirmable?(cartridge)
+ confirmable = Fetch.cascate(cartridge, [%i[safety tools confirmable]])
+ return true if confirmable.nil?
+
+ confirmable
+ end
+
def self.sandboxed?(cartridge)
sandboxed = Fetch.cascate(cartridge, [%i[safety functions sandboxed]])
return true if sandboxed.nil?