Module: Inspec::HashLikeStruct

Instance Method Summary collapse

Instance Method Details

#key?(item) ⇒ Boolean

Only list non-nil members for backwards compatibility

Returns:

  • (Boolean)


10
11
12
# File 'lib/inspec/run_data.rb', line 10

def key?(item)
  members.include?(item) && non_nil?(item)
end

#keysObject

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

Returns:

  • (Boolean)


15
16
17
# File 'lib/inspec/run_data.rb', line 15

def non_nil?(item)
  !self[item].nil?
end