Class: FlowEngine::CLI::FlowLoader
- Inherits:
-
Object
- Object
- FlowEngine::CLI::FlowLoader
- Defined in:
- lib/flowengine/cli/flow_loader.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path) ⇒ FlowLoader
constructor
A new instance of FlowLoader.
- #load ⇒ Object
Constructor Details
#initialize(path) ⇒ FlowLoader
Returns a new instance of FlowLoader.
10 11 12 13 |
# File 'lib/flowengine/cli/flow_loader.rb', line 10 def initialize(path) @path = File.(path) validate_path! end |
Class Method Details
.load(path) ⇒ Object
6 7 8 |
# File 'lib/flowengine/cli/flow_loader.rb', line 6 def self.load(path) new(path).load end |
Instance Method Details
#load ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/flowengine/cli/flow_loader.rb', line 15 def load content = File.read(@path) # Evaluate in a clean binding that has FlowEngine available # rubocop:disable Security/Eval eval(content, TOPLEVEL_BINDING.dup, @path, 1) # rubocop:enable Security/Eval rescue SyntaxError => e raise FlowEngine::CLI::Error, "Syntax error in #{@path}: #{e.message}" end |