Class: Check

Inherits:
Object
  • Object
show all
Defined in:
lib/audit/lib/benchmark/check.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, script, name = nil, dependencies = [], description = nil, duration = 1) ⇒ Check

Returns a new instance of Check.



12
13
14
15
16
17
18
19
# File 'lib/audit/lib/benchmark/check.rb', line 12

def initialize(id, script, name = nil, dependencies = [], description = nil, duration = 1)
	@id = id
	@name = name
	@dependencies = dependencies || []
	@description = description
	@script = script
	@duration = (duration or 1)
end

Instance Attribute Details

#dependenciesObject (readonly)

An array if ID string, which contain references to required Check (not Group!)



8
9
10
# File 'lib/audit/lib/benchmark/check.rb', line 8

def dependencies
  @dependencies
end

#descriptionObject (readonly)

A short description of the goals of this check



6
7
8
# File 'lib/audit/lib/benchmark/check.rb', line 6

def description
  @description
end

#durationObject (readonly)

objects that must be executed before this check



10
11
12
# File 'lib/audit/lib/benchmark/check.rb', line 10

def duration
  @duration
end

#idObject (readonly)

The ID by which this check is referenced from other elements



4
5
6
# File 'lib/audit/lib/benchmark/check.rb', line 4

def id
  @id
end

#nameObject (readonly)

A human-readable name for this check



5
6
7
# File 'lib/audit/lib/benchmark/check.rb', line 5

def name
  @name
end

#scriptObject (readonly)

The actual sh script that will be executed to gather values



7
8
9
# File 'lib/audit/lib/benchmark/check.rb', line 7

def script
  @script
end

Instance Method Details

#in_report?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/audit/lib/benchmark/check.rb', line 31

def in_report?()
  return true
end

#to_hashObject



21
22
23
24
25
26
27
28
29
# File 'lib/audit/lib/benchmark/check.rb', line 21

def to_hash()
  return {
    :type => :CHECK,
    :id => @id,
    :name => @name,
    :dependencies => Lazy.new(@dependencies, :map) {|check| check.id},
    :description => @description
  }
end