Class: Campa::Core::Load
- Inherits:
-
Object
- Object
- Campa::Core::Load
- Defined in:
- lib/campa/core/load.rb
Overview
Implements a Campa function that reads (Reader) and evaluates (Evaler) files with valid Campa code in the given Campa::Context.
Instance Method Summary collapse
-
#call(*paths, env:) ⇒ Object
Value of the last form evaled from the last file given by paths.
-
#initialize ⇒ Load
constructor
A new instance of Load.
Constructor Details
Instance Method Details
#call(*paths, env:) ⇒ Object
Returns value of the last form evaled from the last file given by paths.
17 18 19 20 21 22 23 |
# File 'lib/campa/core/load.rb', line 17 def call(*paths, env:) verify_presence(paths) paths.reduce(nil) do |_, file| reader = Reader.new(File.(file)) evaler.eval(reader, env) end end |