Class: Ruspea::Code
- Inherits:
-
Object
- Object
- Ruspea::Code
- Defined in:
- lib/ruspea/code.rb
Instance Method Summary collapse
-
#initialize ⇒ Code
constructor
A new instance of Code.
- #load(file_path) ⇒ Object
- #run(code, env: Ruspea::Language::Core.new) ⇒ Object
Constructor Details
#initialize ⇒ Code
Returns a new instance of Code.
3 4 5 6 7 |
# File 'lib/ruspea/code.rb', line 3 def initialize @reader = Ruspea::Interpreter::Reader.new @evaler = Ruspea::Interpreter::Evaler.new @printer = Ruspea::Printer.new end |
Instance Method Details
#load(file_path) ⇒ Object
9 10 11 12 |
# File 'lib/ruspea/code.rb', line 9 def load(file_path) raise "#{file_path} is not a file" if !File.exists?(file_path) exec(File.read(file_path)) end |