Class: Ibex::Configuration::Input
- Inherits:
-
Object
- Object
- Ibex::Configuration::Input
- Defined in:
- lib/ibex/configuration/explanation.rb
Overview
Canonical, static input facts used to build a configuration report.
Constant Summary collapse
- KINDS =
: Array
%i[grammar_source grammar_ir].freeze
Instance Attribute Summary collapse
-
#evidence ⇒ Object
readonly
: Hash[String, Array[Evidence]].
-
#files ⇒ Object
readonly
: Array.
-
#grammar_locations ⇒ Object
readonly
: Hash[String, Location].
-
#grammar_values ⇒ Object
readonly
: Hash[String, config_value].
-
#kind ⇒ Object
readonly
: Symbol.
-
#path ⇒ Object
readonly
: String.
-
#recordings ⇒ Object
readonly
: Hash[String, Recording].
-
#schema_version ⇒ Object
readonly
: Integer?.
Instance Method Summary collapse
-
#initialize(kind:, path:, files: [path], schema_version: nil, grammar_values: {}, grammar_locations: {}, evidence: {}, recordings: {}) ⇒ Input
constructor
A new instance of Input.
- #to_h ⇒ Object
Constructor Details
#initialize(kind:, path:, files: [path], schema_version: nil, grammar_values: {}, grammar_locations: {}, evidence: {}, recordings: {}) ⇒ Input
Returns a new instance of Input.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/ibex/configuration/explanation.rb', line 98 def initialize(kind:, path:, files: [path], schema_version: nil, grammar_values: {}, grammar_locations: {}, evidence: {}, recordings: {}) raise ArgumentError, "unknown configuration input kind: #{kind.inspect}" unless KINDS.include?(kind) unless path.is_a?(String) && !path.empty? raise ArgumentError, "configuration input path must be a non-empty String" end validate_files!(files, path) validate_schema_version!(kind, schema_version) validate_entries!(grammar_values, grammar_locations, evidence, recordings) assign_input( kind, path, files, schema_version, grammar_values, grammar_locations, evidence, recordings ) freeze end |
Instance Attribute Details
#evidence ⇒ Object (readonly)
: Hash[String, Array[Evidence]]
92 93 94 |
# File 'lib/ibex/configuration/explanation.rb', line 92 def evidence @evidence end |
#files ⇒ Object (readonly)
: Array
88 89 90 |
# File 'lib/ibex/configuration/explanation.rb', line 88 def files @files end |
#grammar_locations ⇒ Object (readonly)
: Hash[String, Location]
91 92 93 |
# File 'lib/ibex/configuration/explanation.rb', line 91 def grammar_locations @grammar_locations end |
#grammar_values ⇒ Object (readonly)
: Hash[String, config_value]
90 91 92 |
# File 'lib/ibex/configuration/explanation.rb', line 90 def grammar_values @grammar_values end |
#kind ⇒ Object (readonly)
: Symbol
86 87 88 |
# File 'lib/ibex/configuration/explanation.rb', line 86 def kind @kind end |
#path ⇒ Object (readonly)
: String
87 88 89 |
# File 'lib/ibex/configuration/explanation.rb', line 87 def path @path end |
#recordings ⇒ Object (readonly)
: Hash[String, Recording]
93 94 95 |
# File 'lib/ibex/configuration/explanation.rb', line 93 def recordings @recordings end |
#schema_version ⇒ Object (readonly)
: Integer?
89 90 91 |
# File 'lib/ibex/configuration/explanation.rb', line 89 def schema_version @schema_version end |
Instance Method Details
#to_h ⇒ Object
115 116 117 118 119 120 121 122 123 |
# File 'lib/ibex/configuration/explanation.rb', line 115 def to_h result = { "kind" => @kind.to_s.tr("_", "-"), "path" => @path, "files" => @files } #: Hash[String, json_value] result["schema_version"] = @schema_version if @schema_version result end |