module Avram::Callbacks

Direct including types

Defined in:

avram/callbacks/callbacks.cr

Macro Summary

Macro Detail

macro after_run(method_name) #

Run the given method after run is called on an Operation. The return value of the run method is passed to method_name.

after_run :log_entry

private def log_entry(value)
  log_stuff(value)
end

[View source]
macro after_run(&block) #

Run the given block after the operation runs

The return value from run will be passed to this block.

class GenerateReport < Avram::Operation
  after_run do |value|
    value == "some report"
  end

  def run
    "some report"
  end
end

[View source]
macro before_run(method_name) #

Run the given method before run is called on an Operation.

before_run :validate_inputs

private def validate_inputs
  validate_required data
end

[View source]
macro before_run #

Run the given block before run is called on an Operation.

before_run do
  validate_required data
end

[View source]