Class: NVD::JSONFeeds::Schema::Configurations
- Inherits:
-
Object
- Object
- NVD::JSONFeeds::Schema::Configurations
- Includes:
- HasDataVersion
- Defined in:
- lib/nvd/json_feeds/schema/configurations.rb,
lib/nvd/json_feeds/schema/configurations/node.rb
Overview
Represents the "configurations"
value.
Defined Under Namespace
Classes: Node
Constant Summary
Constants included from HasDataVersion
Instance Attribute Summary collapse
-
#nodes ⇒ Array<Node>
readonly
The nodes of the configuration.
Attributes included from HasDataVersion
Class Method Summary collapse
-
.from_json(json) ⇒ Hash{Symbol => Object}
Maps the parsed JSON to a Symbol Hash for #initialize.
-
.load(json) ⇒ Cojnfiguration
Loads the configuration from the parsed JSON.
Instance Method Summary collapse
-
#initialize(nodes: [], **kwargs) ⇒ Configurations
constructor
Initializes the configuration.
Methods included from HasDataVersion
Constructor Details
#initialize(nodes: [], **kwargs) ⇒ Configurations
Initializes the configuration.
24 25 26 27 28 |
# File 'lib/nvd/json_feeds/schema/configurations.rb', line 24 def initialize(nodes: [], **kwargs) super(**kwargs) @nodes = nodes end |
Instance Attribute Details
#nodes ⇒ Array<Node> (readonly)
The nodes of the configuration.
17 18 19 |
# File 'lib/nvd/json_feeds/schema/configurations.rb', line 17 def nodes @nodes end |
Class Method Details
.from_json(json) ⇒ Hash{Symbol => Object}
Maps the parsed JSON to a Symbol Hash for #initialize.
37 38 39 40 41 42 43 |
# File 'lib/nvd/json_feeds/schema/configurations.rb', line 37 def self.from_json(json) { **super(json), nodes: Array(json['nodes']).map(&Node.method(:load)) } end |
.load(json) ⇒ Cojnfiguration
Loads the configuration from the parsed JSON.
54 55 56 |
# File 'lib/nvd/json_feeds/schema/configurations.rb', line 54 def self.load(json) new(**from_json(json)) end |