Module: Actions::ObservableAction::ClassMethods

Defined in:
app/lib/actions/observable_action.rb

Instance Method Summary collapse

Instance Method Details

#event_name_baseObject



46
47
48
# File 'app/lib/actions/observable_action.rb', line 46

def event_name_base
  to_s.underscore.tr('/', '.')
end

#event_name_suffix(hook) ⇒ Object



27
28
29
30
31
32
33
34
35
36
# File 'app/lib/actions/observable_action.rb', line 27

def event_name_suffix(hook)
  case hook
  when :success
    'succeeded'
  when :failure
    'failed'
  else
    hook
  end
end

#event_namesObject



38
39
40
# File 'app/lib/actions/observable_action.rb', line 38

def event_names
  [:success, :failure].map { |suffix| event_name_base + '_' + event_name_suffix(suffix) }
end

#namespaced_event_namesObject



42
43
44
# File 'app/lib/actions/observable_action.rb', line 42

def namespaced_event_names
  event_names.map { |e| ::Foreman::Observable.event_name_for(e) }
end