module LightService::Organizer::ClassMethods

In case this module is included

Public Instance Methods

add_aliases(args) click to toggle source
# File lib/light-service/organizer.rb, line 89
def add_aliases(args)
  execute(->(ctx) { ctx.assign_aliases(ctx.aliases.merge(args)) })
end
add_to_context(args) click to toggle source

Set the value as a key on the context hash and also create convenience accessors for the keys

# File lib/light-service/organizer.rb, line 76
def add_to_context(args)
  Context::ReservedKeysViaOrganizerVerifier.new(args).verify

  Hash(args).map do |key, value|
    context_key = lambda do |ctx|
      ctx[key.to_sym] = value
      ctx.define_accessor_methods_for_keys(key)
    end

    execute(context_key)
  end
end
execute(code_block) click to toggle source
# File lib/light-service/organizer.rb, line 58
def execute(code_block)
  Execute.run(code_block)
end
iterate(collection_key, steps) click to toggle source
# File lib/light-service/organizer.rb, line 54
def iterate(collection_key, steps)
  Iterate.run(self, collection_key, steps)
end
log_with(logger) click to toggle source
# File lib/light-service/organizer.rb, line 66
def log_with(logger)
  @logger = logger
end
logger() click to toggle source
# File lib/light-service/organizer.rb, line 70
def logger
  @logger
end
reduce(*actions) click to toggle source
# File lib/light-service/organizer.rb, line 34
def reduce(*actions)
  with({}).reduce(actions)
end
reduce_case(**args) click to toggle source
# File lib/light-service/organizer.rb, line 50
def reduce_case(**args)
  ReduceCase.run(self, **args)
end
reduce_if(condition_block, steps) click to toggle source
# File lib/light-service/organizer.rb, line 38
def reduce_if(condition_block, steps)
  ReduceIf.run(self, condition_block, steps)
end
reduce_if_else(condition_block, if_steps, else_steps) click to toggle source
# File lib/light-service/organizer.rb, line 42
def reduce_if_else(condition_block, if_steps, else_steps)
  ReduceIfElse.run(self, condition_block, if_steps, else_steps)
end
reduce_until(condition_block, steps) click to toggle source
# File lib/light-service/organizer.rb, line 46
def reduce_until(condition_block, steps)
  ReduceUntil.run(self, condition_block, steps)
end
with(data = {}) click to toggle source
# File lib/light-service/organizer.rb, line 17
def with(data = {})
  VerifyCallMethodExists.run(self, caller(1..1).first)
  data[:_aliases] = @aliases if @aliases

  if @before_actions
    data[:_before_actions] = @before_actions.dup
    @before_actions = nil
  end

  if @after_actions
    data[:_after_actions] = @after_actions.dup
    @after_actions = nil
  end

  WithReducerFactory.make(self).with(data)
end
with_callback(action, steps) click to toggle source
# File lib/light-service/organizer.rb, line 62
def with_callback(action, steps)
  WithCallback.run(self, action, steps)
end