From 7da6076e7448bea2776749af5d937fc841b5682d Mon Sep 17 00:00:00 2001 From: icebaker Date: Sat, 13 May 2023 11:26:58 -0300 Subject: debugging --- controllers/instance.rb | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'controllers/instance.rb') diff --git a/controllers/instance.rb b/controllers/instance.rb index 243e266..b22a785 100644 --- a/controllers/instance.rb +++ b/controllers/instance.rb @@ -22,8 +22,12 @@ module NanoBot @session = Session.new(provider:, cartridge: @cartridge, state:, stream: @stream) end - def debug - @session.debug + def cartridge + puts YAML.dump(@safe_cartridge) + end + + def state + @session.state end def eval(input) @@ -61,12 +65,11 @@ module NanoBot raise StandardError, "Cartridge file not found: \"#{path}\"" end - @cartridge = Logic::Helpers::Hash.symbolize_keys( - YAML.safe_load( - File.read(elected_path), - permitted_classes: [Symbol] - ) - ) + @cartridge = YAML.safe_load(File.read(elected_path), permitted_classes: [Symbol]) + + @safe_cartridge = Marshal.load(Marshal.dump(@cartridge)) + + @cartridge = Logic::Helpers::Hash.symbolize_keys(@cartridge) inject_environment_variables!(@cartridge) end -- cgit v1.2.3