summaryrefslogtreecommitdiff
path: root/controllers/instance.rb
diff options
context:
space:
mode:
authoricebaker <icebaker@proton.me>2023-05-13 11:26:58 -0300
committericebaker <icebaker@proton.me>2023-05-13 11:26:58 -0300
commit7da6076e7448bea2776749af5d937fc841b5682d (patch)
tree768bcfe401b659b231e445f252e296e201e2589d /controllers/instance.rb
parent867f7bd1eaf4801cd894d067a39df62ac4249a27 (diff)
debugging
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