Class: Ibex::Configuration::Recording
- Inherits:
-
Object
- Object
- Ibex::Configuration::Recording
- 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 =
%i[source recorded unspecified unavailable not_applicable].freeze
Instance Attribute Summary collapse
- #reason ⇒ String readonly
- #state ⇒ Symbol readonly
Instance Method Summary collapse
-
#initialize(state, reason) ⇒ Recording
constructor
A new instance of Recording.
- #to_h ⇒ Hash[String, String]
Constructor Details
#initialize(state, reason) ⇒ Recording
Returns a new instance of Recording.
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
#reason ⇒ String (readonly)
64 65 66 |
# File 'lib/ibex/configuration/explanation.rb', line 64 def reason @reason end |
#state ⇒ Symbol (readonly)
63 64 65 |
# File 'lib/ibex/configuration/explanation.rb', line 63 def state @state end |
Instance Method Details
#to_h ⇒ 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 |