module
Avram::Callbacks
Direct including types
Defined in:
avram/callbacks/callbacks.crMacro Summary
-
after_run(method_name)
Run the given method after
run
is called on anOperation
. -
after_run(&block)
Run the given block after the operation runs
-
before_run(method_name)
Run the given method before
run
is called on anOperation
. -
before_run
Run the given block before
run
is called on anOperation
.
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
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
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