Class: Ibex::Configuration::Recording

Inherits:
Object
  • Object
show all
Defined in:
lib/ibex/configuration/explanation.rb,
sig/ibex/configuration/explanation.rbs

Overview

Whether an input can prove the historical source of a selected setting.

Constant Summary collapse

STATES =

Signature:

  • Array[Symbol]

Returns:

  • (Array[Symbol])
%i[source recorded unspecified unavailable not_applicable].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(state, reason) ⇒ Recording

Returns a new instance of Recording.

RBS:

  • (Symbol state, String reason) -> void

Parameters:

  • state (Symbol)
  • reason (String)


67
68
69
70
71
72
73
74
# File 'lib/ibex/configuration/explanation.rb', line 67

def initialize(state, reason)
  raise ArgumentError, "unknown configuration recording state: #{state.inspect}" unless STATES.include?(state)
  raise ArgumentError, "configuration recording reason must not be empty" if reason.empty?

  @state = state
  @reason = reason.dup.freeze
  freeze
end

Instance Attribute Details

#reasonString (readonly)

Signature:

  • String

Returns:

  • (String)


64
65
66
# File 'lib/ibex/configuration/explanation.rb', line 64

def reason
  @reason
end

#stateSymbol (readonly)

Signature:

  • Symbol

Returns:

  • (Symbol)


63
64
65
# File 'lib/ibex/configuration/explanation.rb', line 63

def state
  @state
end

Instance Method Details

#to_hHash[String, String]

RBS:

  • () -> Hash[String, String]

Returns:

  • (Hash[String, String])


77
78
79
# File 'lib/ibex/configuration/explanation.rb', line 77

def to_h
  { "state" => @state.to_s.tr("_", "-"), "reason" => @reason }
end