Class: Oscal::Profile

Inherits:
Object
  • Object
show all
Includes:
CommonUtils, Serializer
Defined in:
lib/oscal/profile.rb

Constant Summary collapse

KEY =
i(uuid  imports merge modify back_matter)

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CommonUtils

#find_object_by_id, included

Methods included from Serializer

included, #to_h, #to_json, #to_xml, #to_yaml

Constructor Details

#initialize(uuid, metadata, imports, merge, modify, back_matter) ⇒ Profile

Returns a new instance of Profile.



14
15
16
17
18
19
20
21
# File 'lib/oscal/profile.rb', line 14

def initialize(uuid, , imports, merge, modify, back_matter)
  @uuid        = uuid
      = MetadataBlock.new()
  @imports     = ImportObject.wrap(imports) if imports
  @merge       = Merge.wrap(merge) if merge
  @modify      = Modify.wrap(modify) if modify
  @back_matter = BackMatter.wrap(back_matter) if back_matter
end

Class Method Details

.load_from_yaml(path) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/oscal/profile.rb', line 23

def self.load_from_yaml(path)
  yaml_data     = safe_load_yaml(path)
  yaml_profile  = yaml_data["profile"]

  uuid          = yaml_profile["uuid"]
        = yaml_profile["metadata"]
  imports       = yaml_profile["imports"]
  merge         = yaml_profile["merge"]
  modify        = yaml_profile["modify"]
  back_matter   = yaml_profile["back-matter"]

  Profile.new(uuid, , imports, merge, modify, back_matter)
end