module Nexpose::Attributes

Functions for handling attributes as understood by the API. In particular, the API expects a JSON object with the hash defined as:

{ "key": "key-string",
  "value": "value-string" }

Public Instance Methods

to_hash(arr) click to toggle source

Convert an array of attributes into a hash consumable by the API.

@param [Array] arr Array of attributes to convert. @return [Array] Array formatted as expected by the API.

# File lib/nexpose/util.rb, line 123
def to_hash(arr)
  arr.map(&:flatten).map { |p| { 'key' => p.first.to_s, 'value' => p.last.to_s } }
end