Class: Ibex::Configuration::Recording
- Inherits:
-
Object
- Object
- Ibex::Configuration::Recording
- Defined in:
- lib/ibex/configuration/explanation.rb
Overview
Whether an input can prove the historical source of a selected setting.
Constant Summary collapse
- STATES =
: Array
%i[source recorded unspecified unavailable not_applicable].freeze
Instance Attribute Summary collapse
-
#reason ⇒ Object
readonly
: String.
-
#state ⇒ Object
readonly
: Symbol.
Instance Method Summary collapse
-
#initialize(state, reason) ⇒ Recording
constructor
A new instance of Recording.
- #to_h ⇒ Object
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 ⇒ Object (readonly)
: String
64 65 66 |
# File 'lib/ibex/configuration/explanation.rb', line 64 def reason @reason end |
#state ⇒ Object (readonly)
: Symbol
63 64 65 |
# File 'lib/ibex/configuration/explanation.rb', line 63 def state @state end |
Instance Method Details
#to_h ⇒ Object
77 78 79 |
# File 'lib/ibex/configuration/explanation.rb', line 77 def to_h { "state" => @state.to_s.tr("_", "-"), "reason" => @reason } end |