Module: Inspec::HashLikeStruct
- Included in:
- RunData, RunData::Control, RunData::Control::Ref, RunData::Control::SourceLocation, RunData::Control::WaiverData, RunData::Platform, RunData::Profile, RunData::Profile::Dependency, RunData::Profile::Group, RunData::Profile::Input, RunData::Profile::Input::Options, RunData::Profile::Support, RunData::Result, RunData::Statistics, RunData::Statistics::Controls, RunData::Statistics::Controls::Total
- Defined in:
- lib/inspec/run_data.rb
Instance Method Summary collapse
-
#key?(item) ⇒ Boolean
Only list non-nil members for backwards compatibility.
-
#keys ⇒ Object
Only list keys whose value are non-nil.
-
#non_nil?(item) ⇒ Boolean
This is provided for clarity - many locations make this test.
Instance Method Details
#key?(item) ⇒ Boolean
Only list non-nil members for backwards compatibility
10 11 12 |
# File 'lib/inspec/run_data.rb', line 10 def key?(item) members.include?(item) && non_nil?(item) end |
#keys ⇒ Object
Only list keys whose value are non-nil
5 6 7 |
# File 'lib/inspec/run_data.rb', line 5 def keys members.reject { |k| self[k].nil? } end |
#non_nil?(item) ⇒ Boolean
This is provided for clarity - many locations make this test
15 16 17 |
# File 'lib/inspec/run_data.rb', line 15 def non_nil?(item) !self[item].nil? end |