Class: CommandRun

Inherits:
ApplicationRecord
  • Object
show all
Defined in:
lib/generators/ruby_cms/templates/models/command_run.rb

Constant Summary collapse

STATUSES =
%w[ok failed].freeze

Instance Method Summary collapse

Instance Method Details

#by_labelObject



24
25
26
27
28
# File 'lib/generators/ruby_cms/templates/models/command_run.rb', line 24

def by_label
  return ran_by.email_address if ran_by&.respond_to?(:email_address) && ran_by.email_address.present?
  return ran_by.email if ran_by&.respond_to?(:email) && ran_by.email.present?
  ran_by_label.presence || "system"
end

#ok?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/generators/ruby_cms/templates/models/command_run.rb', line 20

def ok?
  status == "ok"
end