Class: Inspec::RunData::Control
- Inherits:
-
Struct
- Object
- Struct
- Inspec::RunData::Control
- Includes:
- HashLikeStruct
- Defined in:
- lib/inspec/run_data/control.rb,
lib/inspec/run_data/control.rb
Defined Under Namespace
Classes: Ref, SourceLocation, WaiverData
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#desc ⇒ Object
Returns the value of attribute desc.
-
#descriptions ⇒ Object
Returns the value of attribute descriptions.
-
#id ⇒ Object
Returns the value of attribute id.
-
#impact ⇒ Object
Returns the value of attribute impact.
-
#refs ⇒ Object
Returns the value of attribute refs.
-
#results ⇒ Object
Returns the value of attribute results.
-
#source_location ⇒ Object
Returns the value of attribute source_location.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#title ⇒ Object
Returns the value of attribute title.
-
#waiver_data ⇒ Object
Returns the value of attribute waiver_data.
Instance Method Summary collapse
-
#initialize(raw_ctl_data) ⇒ Control
constructor
A new instance of Control.
- #status ⇒ Object
Methods included from HashLikeStruct
Constructor Details
#initialize(raw_ctl_data) ⇒ Control
Returns a new instance of Control.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/inspec/run_data/control.rb', line 19 def initialize(raw_ctl_data) self.refs = (raw_ctl_data[:refs] || []).map { |r| Inspec::RunData::Control::Ref.new(r) } self.results = (raw_ctl_data[:results] || []).map { |r| Inspec::RunData::Result.new(r) } self.source_location = Inspec::RunData::Control::SourceLocation.new(raw_ctl_data[:source_location] || {}) self.waiver_data = Inspec::RunData::Control::WaiverData.new(raw_ctl_data[:waiver_data] || {}) [ :code, # String :desc, # String :descriptions, # Hash with custom keys :id, # String :impact, # Float :tags, # Hash with custom keys :title, # String ].each do |field| self[field] = raw_ctl_data[field] end def status Inspec::EnhancedOutcomes.determine_status(results, impact) end end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code
5 6 7 |
# File 'lib/inspec/run_data/control.rb', line 5 def code @code end |
#desc ⇒ Object
Returns the value of attribute desc
5 6 7 |
# File 'lib/inspec/run_data/control.rb', line 5 def desc @desc end |
#descriptions ⇒ Object
Returns the value of attribute descriptions
5 6 7 |
# File 'lib/inspec/run_data/control.rb', line 5 def descriptions @descriptions end |
#id ⇒ Object
Returns the value of attribute id
5 6 7 |
# File 'lib/inspec/run_data/control.rb', line 5 def id @id end |
#impact ⇒ Object
Returns the value of attribute impact
5 6 7 |
# File 'lib/inspec/run_data/control.rb', line 5 def impact @impact end |
#refs ⇒ Object
Returns the value of attribute refs
5 6 7 |
# File 'lib/inspec/run_data/control.rb', line 5 def refs @refs end |
#results ⇒ Object
Returns the value of attribute results
5 6 7 |
# File 'lib/inspec/run_data/control.rb', line 5 def results @results end |
#source_location ⇒ Object
Returns the value of attribute source_location
5 6 7 |
# File 'lib/inspec/run_data/control.rb', line 5 def source_location @source_location end |
#tags ⇒ Object
Returns the value of attribute tags
5 6 7 |
# File 'lib/inspec/run_data/control.rb', line 5 def @tags end |
#title ⇒ Object
Returns the value of attribute title
5 6 7 |
# File 'lib/inspec/run_data/control.rb', line 5 def title @title end |
#waiver_data ⇒ Object
Returns the value of attribute waiver_data
5 6 7 |
# File 'lib/inspec/run_data/control.rb', line 5 def waiver_data @waiver_data end |
Instance Method Details
#status ⇒ Object
37 38 39 |
# File 'lib/inspec/run_data/control.rb', line 37 def status Inspec::EnhancedOutcomes.determine_status(results, impact) end |