Module: Buildkite::Builder::Definition::Helper

Included in:
Loaders::Templates, Pipeline
Defined in:
lib/buildkite/builder/definition.rb

Instance Method Summary collapse

Instance Method Details

#load_definition(file, expected) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/buildkite/builder/definition.rb', line 7

def load_definition(file, expected)
  result = eval(file.read, TOPLEVEL_BINDING.dup, file.to_s) # rubocop:disable Security/Eval
  unless result.is_a?(expected)
    raise "#{file} must return a valid definition (#{expected}); got #{result.class}"
  end

  result
end