Module: Excom::Plugins::Status

Defined in:
lib/excom/plugins/status.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.used(service_class, success:, failure:) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/excom/plugins/status.rb', line 6

def self.used(service_class, success:, failure:)
  service_class.add_execution_prop(:status)

  helpers = Module.new do
    success.each do |name|
      define_method(name) do |result = nil|
        success(name) { result }
      end
    end

    failure.each do |name|
      define_method(name) do |result = nil|
        failure(name) { result }
      end
    end
  end

  service_class.const_set('StatusHelpers', helpers)
  service_class.send(:include, helpers)
end

Instance Method Details

#statusObject



27
28
29
# File 'lib/excom/plugins/status.rb', line 27

def status
  state.status
end