class Eco::API::Policies

@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

Attributes

policies[R]

Public Instance Methods

add(policy) click to toggle source
Calls superclass method Eco::API::UseCases#add
# File lib/eco/api/policies.rb, line 17
def add(policy)
  raise "Expected Eco::API::Policies::Policy object. Given: #{policy}" unless policy.is_a?(Eco::API::Policies::Policy)
  super(policy)
end
define(name, type: :transform, &block) click to toggle source
# File lib/eco/api/policies.rb, line 11
def define(name, type: :transform, &block)
  Eco::API::Policies::Policy.new(name, type: type, root: self, &block).tap do |policy|
    add(policy)
  end
end
launch(people:, session:, job:, options: {}) click to toggle source
# File lib/eco/api/policies.rb, line 22
def launch(people:, session:, job:, options: {})
  args = {
    people:  people,
    session: session,
    job:     job,
    options: options
  }

  items.map do |policy|
    policy.launch(**args)
  end
end