Module: ServiceActor::Playable::PrependedMethods

Defined in:
lib/service_actor/playable.rb

Instance Method Summary collapse

Instance Method Details

#callObject



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/service_actor/playable.rb', line 56

def call
  default_output = nil

  self.class.play_actors.each do |options|
    next unless callable_actor?(options)

    options[:actors].each do |actor|
      default_output = play_actor(actor)
    end
  end

  default_output
rescue self.class.failure_class
  rollback
  raise
end

#rollbackObject



73
74
75
76
77
78
79
80
81
# File 'lib/service_actor/playable.rb', line 73

def rollback
  return unless defined?(@played_actors)

  @played_actors.each do |actor|
    next unless actor.respond_to?(:rollback)

    actor.rollback
  end
end