Class: Wheneverd::DSL::Loader
- Inherits:
-
Object
- Object
- Wheneverd::DSL::Loader
- Defined in:
- lib/wheneverd/dsl/loader.rb
Overview
Loads a schedule file into a Schedule.
This evaluates the file as Ruby in an isolated DSL context, and wraps errors with the schedule path for clearer CLI output.
Note that schedules are arbitrary Ruby code. Do not load untrusted schedule files.
Class Method Summary collapse
-
.load_file(path) ⇒ Wheneverd::Schedule
Load and evaluate a schedule file.
Class Method Details
.load_file(path) ⇒ Wheneverd::Schedule
Load and evaluate a schedule file.
16 17 18 19 20 21 22 23 |
# File 'lib/wheneverd/dsl/loader.rb', line 16 def self.load_file(path) absolute_path = File.(path.to_s) evaluate_file(absolute_path) rescue Wheneverd::DSL::Error => e raise_with_path(e, absolute_path) rescue Wheneverd::Error, StandardError => e raise_load_error(e, absolute_path) end |