Class: Udb::PartialConfig
- Inherits:
-
AbstractConfig
- Object
- AbstractConfig
- Udb::PartialConfig
- Defined in:
- lib/udb/config.rb
Overview
This class represents a configuration that is “partially-configured” (e.g., portfolio or configurable IP). # It only lists mandatory & prohibited extensions and fully-constrained parameters (single value).
Instance Method Summary collapse
-
#additional_extensions_allowed? ⇒ Boolean
Whether or not a compliant instance of this partial config can have more extensions than those listed in mandatory_extensions/non_mandatory_extensions.
- #fully_configured? ⇒ Boolean
-
#initialize(data, info)
constructor
NON-ABSTRACT METHODS #.
- #mandatory_extensions ⇒ Array<Hash{String => String, Array<String>}>
- #mxlen ⇒ Integer
-
#param_values ⇒ Hash{String => ParamValueType}
ABSTRACT METHODS OVERRIDDEN #.
- #partially_configured? ⇒ Boolean
- #prohibited_extensions ⇒ Array<Hash{String => String, Array<String>}>
- #unconfigured? ⇒ Boolean
Constructor Details
#initialize(data, info)
NON-ABSTRACT METHODS #
211 212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/udb/config.rb', line 211 def initialize(data, info) super(data, info) @param_values = @data.key?("params") ? @data["params"] : [].freeze @mxlen = @data.dig("params", "MXLEN") if @mxlen.nil? raise "Must set MXLEN for a configured config" end @mxlen.freeze end |
Instance Method Details
#additional_extensions_allowed? ⇒ Boolean
Whether or not a compliant instance of this partial config can have more extensions than those listed in mandatory_extensions/non_mandatory_extensions.
272 |
# File 'lib/udb/config.rb', line 272 def additional_extensions_allowed? = @data.key?("additional_extensions") ? @data["additional_extensions"] : true |
#fully_configured? ⇒ Boolean
235 |
# File 'lib/udb/config.rb', line 235 def fully_configured? = false |
#mandatory_extensions ⇒ Array<Hash{String => String, Array<String>}>
244 245 246 247 248 249 250 251 252 253 254 |
# File 'lib/udb/config.rb', line 244 def mandatory_extensions @mandatory_extensions ||= if @data["mandatory_extensions"].nil? [] else @data["mandatory_extensions"].map do |e| # convert the requirement to always be an array { "name" => e["name"], "version" => e["version"].is_a?(String) ? [e["version"]] : e["version"]} end end end |
#mxlen ⇒ Integer
232 |
# File 'lib/udb/config.rb', line 232 def mxlen = @mxlen |
#param_values ⇒ Hash{String => ParamValueType}
ABSTRACT METHODS OVERRIDDEN #
229 |
# File 'lib/udb/config.rb', line 229 def param_values = @param_values |
#partially_configured? ⇒ Boolean
238 |
# File 'lib/udb/config.rb', line 238 def partially_configured? = true |
#prohibited_extensions ⇒ Array<Hash{String => String, Array<String>}>
257 258 259 260 261 262 263 264 265 266 267 |
# File 'lib/udb/config.rb', line 257 def prohibited_extensions @prohibited_extensions ||= if @data["prohibited_extensions"].nil? [] else @data["prohibited_extensions"].map do |e| # convert the requirement to always be an array { "name" => e["name"], "version" => e["version"].is_a?(String) ? [e["version"]] : e["version"]} end end end |
#unconfigured? ⇒ Boolean
241 |
# File 'lib/udb/config.rb', line 241 def unconfigured? = false |