Class: Nexpose::DiscoveryConnection::Criteria

Inherits:
Criteria
  • Object
show all
Defined in:
lib/nexpose/discovery.rb

Overview

Override of filter criteria to account for different parsing from JSON.

Instance Attribute Summary

Attributes inherited from Criteria

#criteria, #match

Class Method Summary collapse

Methods inherited from Criteria

#<<, #_to_payload, #initialize, parse, #to_h, #to_json

Constructor Details

This class inherits a constructor from Nexpose::Criteria

Class Method Details

.parseHash(hash) ⇒ Criteria

Create a Criteria object from a Hash.

Parameters:

  • Hash (Hash)

    of a Criteria object.

Returns:



284
285
286
287
288
289
290
291
292
# File 'lib/nexpose/discovery.rb', line 284

def self.parseHash(hash)
  # The call returns empty JSON, so default to 'AND' if not present.
  operator = hash[:operator] || 'AND'
  ret = Criteria.new([], operator)
  hash[:criteria].each do |c|
    ret.criteria << Criterion.parseHash(c)
  end
  ret
end