summaryrefslogtreecommitdiff
path: root/controllers/instance.rb
diff options
context:
space:
mode:
authoricebaker <icebaker@proton.me>2023-05-27 12:40:53 -0300
committericebaker <icebaker@proton.me>2023-05-27 12:40:53 -0300
commit3723b08d1ff2b87c51e9595398e9c214f498f748 (patch)
tree4e71e396831a64fceb4b90e28fd9fb3a44548abb /controllers/instance.rb
parent084923fe46390b3f38350650574503d71d42cc89 (diff)
improving repl apis
Diffstat (limited to 'controllers/instance.rb')
-rw-r--r--controllers/instance.rb18
1 files changed, 16 insertions, 2 deletions
diff --git a/controllers/instance.rb b/controllers/instance.rb
index fbe2348..a982261 100644
--- a/controllers/instance.rb
+++ b/controllers/instance.rb
@@ -31,10 +31,24 @@ module NanoBot
@session.state
end
- def eval(input, &block)
+ def boot(as: 'eval', &block)
@stream.callback = block if block && @stream.is_a?(Components::Stream)
- Interfaces::Eval.evaluate(input, @cartridge, @session)
+ Interfaces::REPL.boot(@cartridge, @session, as:)
+
+ return unless @stream.is_a?(Components::Stream)
+
+ @stream.finish
+ end
+
+ def prompt
+ Interfaces::REPL.prompt(@cartridge)
+ end
+
+ def eval(input, as: 'eval', &block)
+ @stream.callback = block if block && @stream.is_a?(Components::Stream)
+
+ Interfaces::Eval.evaluate(input, @cartridge, @session, as)
return unless @stream.is_a?(Components::Stream)