Module: Nexpose::Attributes
- Defined in:
- lib/nexpose/util.rb
Overview
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" }
Class Method Summary collapse
-
.to_hash(arr) ⇒ Array[Hash]
Convert an array of attributes into a hash consumable by the API.
Class Method Details
.to_hash(arr) ⇒ Array[Hash]
Convert an array of attributes into a hash consumable by the API.
122 123 124 |
# File 'lib/nexpose/util.rb', line 122 def to_hash(arr) arr.map(&:flatten).map { |p| { 'key' => p.first.to_s, 'value' => p.last.to_s } } end |