lib/serially/task.rb
def run!(instance)
      if instance
        if !@run_block && !instance.respond_to?(@name)
          raise Serially::ConfigurationError.new("Serially task #{@name} in class #{@klass} doesn't have an implementation method or a block to run")
        end
        begin
          status, msg, result_obj = @run_block ? @run_block.call(instance) : instance.send(@name)
        rescue StandardError => exc
          return [false, "Serially: task '#{@name}' raised exception: #{exc.message}", exc]
        end
      else
        return [false, "Serially: instance couldn't be created, task '#{@name}'' not started"]
      end
      # returns true (unless status == nil/false/[]), '' (unless msg is a not empty string) and result_obj, which might be nil
      # if task doesn't return it
      [status.present?, msg.to_s, result_obj]
    end
# <i>instance</i> - instance on which the task callback should be run
instance - instance on which the task callback should be run
instance - instance on which the task callback should be run
def run!(instance)
      if instance
        if !@run_block && !instance.respond_to?(@name)
          raise Serially::ConfigurationError.new("Serially task #{@name} in class #{@klass} doesn't have an implementation method or a block to run")
        end
        begin
          status, msg, result_obj = @run_block ? @run_block.call(instance) : instance.send(@name)
        rescue StandardError => exc
          return [false, "Serially: task '#{@name}' raised exception: #{exc.message}", exc]
        end
      else
        return [false, "Serially: instance couldn't be created, task '#{@name}'' not started"]
      end
      [status.present?, msg.to_s, result_obj]
    end
def run! ( instance ) if instance if ! @run_block && ! instance . respond_to? ( @name ) raise Serially :: ConfigurationError . new ( "Serially task #{@name} in class #{@klass} doesn't have an implementation method or a block to run" ) end begin status , msg , result_obj = @run_block ? @run_block . call ( instance ) : instance . send ( @name ) rescue StandardError => exc return [ false , "Serially: task '#{@name}' raised exception: #{exc.message}" , exc ] end else return [ false , "Serially: instance couldn't be created, task '#{@name}'' not started" ] end [ status . present? , msg . to_s , result_obj ] end
<i>instance</i> - instance on which the task callback should be run
<i > instance< / i > - instance on which the task callback should be run
# returns true (unless status == nil/false/[]), '' (unless msg is a not empty string) and result_obj, which might be nil # if task doesn't return it
instance