summaryrefslogtreecommitdiff
path: root/controllers/instance.rb
diff options
context:
space:
mode:
Diffstat (limited to 'controllers/instance.rb')
-rw-r--r--controllers/instance.rb19
1 files changed, 11 insertions, 8 deletions
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