Sha256: a6a799c8f8dadc7786d8acd604d0c691e3fddbdcbdec1ab453f6c4b7c7730ab0
Contents?: true
Size: 1.15 KB
Versions: 14
Compression:
Stored size: 1.15 KB
Contents
module Eco module API # @todo the autoloading happens on `add`, and there could be multiple pending children to load. # This could translate into the policies not being loaded in order class Policies < Eco::API::UseCases autoloads_children_of "Eco::API::Common::Loaders::Policy" autoload_namespace_ignore "Eco::API" attr_reader :policies def define(name, type: :transform, &block) Eco::API::Policies::Policy.new(name, type: type, root: self, &block).tap do |policy| add(policy) end end def add(policy) msg = "Expected Eco::API::Policies::Policy object. Given: #{policy}" raise ArgumentError, msg unless policy.is_a?(Eco::API::Policies::Policy) super end def launch(people:, session:, job:, options: {}) args = { people: people, session: session, job: job, options: options } items.map do |policy| policy.launch(**args) end end end end end require_relative 'policies/policy' require_relative 'policies/default_policies'
Version data entries
14 entries across 14 versions & 1 rubygems