Class: GSA::ReadableBuckets

Inherits:
ReadableResults show all
Defined in:
lib/gsa/readable_results/readable_buckets.rb

Class Method Summary collapse

Methods inherited from ReadableResults

extract, parse_core

Methods included from Injector

#inject, #inject_a, #inject_s

Class Method Details

.convert(bucket) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/gsa/readable_results/readable_buckets.rb', line 9

def self.convert(bucket)
  bucket = Hash[*bucket] if bucket.is_a? Array
  {
    :bucket_value      => bucket[GSA::BUCKET_VALUE], 
    :bucket_low_range  => bucket[GSA::BUCKET_LOW_RANGE],
    :bucket_high_range => bucket[GSA::BUCKET_HIGH_RANGE],
    :bucket_count      => bucket[GSA::BUCKET_COUNT]
  }
end

.parse(buckets) ⇒ Object



4
5
6
7
# File 'lib/gsa/readable_results/readable_buckets.rb', line 4

def self.parse(buckets)
  buckets = (buckets.select {|key, value| key == GSA::BUCKET})[GSA::BUCKET]
  parse_core(buckets) {|bucket| convert(bucket) }
end