Module: Hexx::Services::ExecutionDSL

Includes:
Informator
Included in:
Base
Defined in:
lib/hexx-services/execution_dsl.rb

Overview

Module ExecutionDSL includes Informator and provides [#execute] and [#call] methods on top of it.

Examples:

class MyService
  include ExecutionDSL

  def execute
    publish! :something
  end
end

Instance Method Summary collapse

Instance Method Details

#call<type>

The method executes the service object catches ‘:published` and returns its results. When nothing was published it publishes `:success` event by itself.

Returns:

  • (<type>)

    <description>



26
27
28
29
30
# File 'lib/hexx-services/execution_dsl.rb', line 26

def call
  events = Array(catch(:published) { execute })
  return events if events.first.instance_of? Event
  publish :success
end

#executeundefined

This method is abstract.

Defines the sequence of commands provided by the service object

Returns:

  • (undefined)


38
39
# File 'lib/hexx-services/execution_dsl.rb', line 38

def execute
end