Class: Group

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

Direct Known Subclasses

AutomaticDependencies

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, name = nil, description = nil) ⇒ Group

Returns a new instance of Group.



10
11
12
13
14
15
# File 'lib/audit/lib/benchmark/group.rb', line 10

def initialize(id, name = nil, description = nil)
	@id = id
	@name = name
	@description = description
	@children = []
end

Instance Attribute Details

#childrenObject

Allowed children are Check and Group objects



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

def children
  @children
end

#descriptionObject (readonly)

A descriptive string for this group



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

def description
  @description
end

#idObject (readonly)

The unique ID by which this group is referenced from other elements



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

def id
  @id
end

#nameObject (readonly)

A human-readable name for this group



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

def name
  @name
end

Instance Method Details

#in_report?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/audit/lib/benchmark/group.rb', line 27

def in_report?()
  true
end

#to_hashObject



17
18
19
20
21
22
23
24
25
# File 'lib/audit/lib/benchmark/group.rb', line 17

def to_hash()
  return {
    :type => :GROUP,
    :id => @id,
    :name => @name,
    :description => @description,
    :children => Lazy.new(Lazy.new(@children, :reject) {|x| !x.in_report?}, :map) {|child| Lazy.new(child, :to_hash)}
  }
end