Class: WaterDrop::Aspects::BaseAspect

Inherits:
Aspector::Base
  • Object
show all
Defined in:
lib/water_drop/aspects/base_aspect.rb

Overview

Base class for all aspects

Direct Known Subclasses

AfterAspect, AroundAspect, BeforeAspect

Instance Method Summary collapse

Instance Method Details

#handle(this, options, args, message, *result) ⇒ Object

Parameters:

  • this

    is an instance on which we execute aspect (original method caller)

  • options (Hash)

    aspect options

  • args (Array)

    original method arguments

  • message (Block)

    block which we evaluate to get a message that we will send

  • result

    original method result



13
14
15
16
17
18
19
20
21
# File 'lib/water_drop/aspects/base_aspect.rb', line 13

def handle(this, options, args, message, *result)
  formatter = Formatter.new(
    options,
    args,
    instance_run(this, result, message)
  )

  Message.new(options[:topic], formatter.message).send!
end