Module: FunctionalLightService::Organizer::ClassMethods

Defined in:
lib/functional-light-service/organizer.rb

Overview

In case this module is included

Instance Method Summary collapse

Instance Method Details

#execute(code_block) ⇒ Object



51
52
53
# File 'lib/functional-light-service/organizer.rb', line 51

def execute(code_block)
  Execute.run(code_block)
end

#iterate(collection_key, steps) ⇒ Object



47
48
49
# File 'lib/functional-light-service/organizer.rb', line 47

def iterate(collection_key, steps)
  Iterate.run(self, collection_key, steps)
end

#log_with(logger) ⇒ Object



59
60
61
# File 'lib/functional-light-service/organizer.rb', line 59

def log_with(logger)
  @logger = logger
end

#loggerObject



63
64
65
# File 'lib/functional-light-service/organizer.rb', line 63

def logger
  @logger
end

#reduce(*actions) ⇒ Object



35
36
37
# File 'lib/functional-light-service/organizer.rb', line 35

def reduce(*actions)
  with({}).reduce(actions)
end

#reduce_if(condition_block, steps) ⇒ Object



39
40
41
# File 'lib/functional-light-service/organizer.rb', line 39

def reduce_if(condition_block, steps)
  ReduceIf.run(self, condition_block, steps)
end

#reduce_until(condition_block, steps) ⇒ Object



43
44
45
# File 'lib/functional-light-service/organizer.rb', line 43

def reduce_until(condition_block, steps)
  ReduceUntil.run(self, condition_block, steps)
end

#with(data = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/functional-light-service/organizer.rb', line 18

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) ⇒ Object



55
56
57
# File 'lib/functional-light-service/organizer.rb', line 55

def with_callback(action, steps)
  WithCallback.run(self, action, steps)
end