Class: Agent::Lock::Manager::Result

Inherits:
Data
  • Object
show all
Defined in:
lib/agent/lock/manager.rb

Overview

What every Manager verb returns.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#message ⇒ String? (readonly)

Returns a warning worth printing, such as a partial freeze.

Returns:

  • (String, nil) —

    a warning worth printing, such as a partial freeze



30
31
32
33
34
35
36
# File 'lib/agent/lock/manager.rb', line 30

Result = Data.define(:status, :records, :message) do
  # @return [Integer] what the process should exit with
  def code = %i[held refused not_found interrupted parent_scope occupied].include?(status) ? 1 : 0

  # @return [Record, nil] the one record most results are about
  def record = records.first
end

#records ⇒ Array<Record> (readonly)

Returns the records involved, the subject first.

Returns:

  • (Array<Record>) —

    the records involved, the subject first



30
31
32
33
34
35
36
# File 'lib/agent/lock/manager.rb', line 30

Result = Data.define(:status, :records, :message) do
  # @return [Integer] what the process should exit with
  def code = %i[held refused not_found interrupted parent_scope occupied].include?(status) ? 1 : 0

  # @return [Record, nil] the one record most results are about
  def record = records.first
end

#status ⇒ Symbol (readonly)

Returns what happened, such as :acquired, :held or :not_found.

Returns:

  • (Symbol) —

    what happened, such as :acquired, :held or :not_found



30
31
32
33
34
35
36
# File 'lib/agent/lock/manager.rb', line 30

Result = Data.define(:status, :records, :message) do
  # @return [Integer] what the process should exit with
  def code = %i[held refused not_found interrupted parent_scope occupied].include?(status) ? 1 : 0

  # @return [Record, nil] the one record most results are about
  def record = records.first
end

Instance Method Details

#code ⇒ Integer

Returns what the process should exit with.

Returns:

  • (Integer) —

    what the process should exit with



32
# File 'lib/agent/lock/manager.rb', line 32

def code = %i[held refused not_found interrupted parent_scope occupied].include?(status) ? 1 : 0

#record ⇒ Record?

Returns the one record most results are about.

Returns:

  • (Record, nil) —

    the one record most results are about



35
# File 'lib/agent/lock/manager.rb', line 35

def record = records.first