Class: AbideDevUtils::XCCDF::Diff::PropChecker
- Inherits:
-
PropertyExistenceChecker
show all
- Defined in:
- lib/abide_dev_utils/xccdf/diff/benchmark/profile.rb,
lib/abide_dev_utils/xccdf/diff/benchmark/number_title.rb
Overview
Checks properties for existence in both benchmarks.
Instance Attribute Summary collapse
Instance Method Summary
collapse
#added, inverse_existence_state, #removed
Constructor Details
#initialize(number_title_objs, other_number_title_objs) ⇒ PropChecker
Returns a new instance of PropChecker.
42
43
44
45
46
47
48
|
# File 'lib/abide_dev_utils/xccdf/diff/benchmark/profile.rb', line 42
def initialize(profile_rule_objs, other_profile_rule_objs)
super
@profile_rule_objs = profile_rule_objs
@other_profile_rule_objs = other_profile_rule_objs
@profiles = profile_rule_objs.map(&:profile)
@other_profiles = other_profile_rule_objs.map(&:profile)
end
|
Instance Attribute Details
#all_numbers ⇒ Object
Returns the value of attribute all_numbers.
164
165
166
|
# File 'lib/abide_dev_utils/xccdf/diff/benchmark/number_title.rb', line 164
def all_numbers
@all_numbers
end
|
#all_titles ⇒ Object
Returns the value of attribute all_titles.
164
165
166
|
# File 'lib/abide_dev_utils/xccdf/diff/benchmark/number_title.rb', line 164
def all_titles
@all_titles
end
|
#other_all_numbers ⇒ Object
Returns the value of attribute other_all_numbers.
164
165
166
|
# File 'lib/abide_dev_utils/xccdf/diff/benchmark/number_title.rb', line 164
def other_all_numbers
@other_all_numbers
end
|
#other_all_titles ⇒ Object
Returns the value of attribute other_all_titles.
164
165
166
|
# File 'lib/abide_dev_utils/xccdf/diff/benchmark/number_title.rb', line 164
def other_all_titles
@other_all_titles
end
|
Instance Method Details
#added_numbers ⇒ Object
182
183
184
|
# File 'lib/abide_dev_utils/xccdf/diff/benchmark/number_title.rb', line 182
def added_numbers
added(@all_numbers, @other_all_numbers)
end
|
#added_profiles ⇒ Object
62
63
64
|
# File 'lib/abide_dev_utils/xccdf/diff/benchmark/profile.rb', line 62
def added_profiles
added(@other_profiles.map(&:id), @profiles.map(&:id))
end
|
#added_rules_by_profile ⇒ Object
70
71
72
73
74
75
76
|
# File 'lib/abide_dev_utils/xccdf/diff/benchmark/profile.rb', line 70
def added_rules_by_profile
@rules_by_profile.each_with_object({}) do |(profile, rules), hsh|
next unless @other_rules_by_profile.key?(profile)
hsh[profile] = added(rules, @other_rules_by_profile[profile])
end
end
|
#added_titles ⇒ Object
190
191
192
|
# File 'lib/abide_dev_utils/xccdf/diff/benchmark/number_title.rb', line 190
def added_titles
added(@all_titles, @other_all_titles)
end
|
#number(number) ⇒ Object
178
179
180
|
# File 'lib/abide_dev_utils/xccdf/diff/benchmark/number_title.rb', line 178
def number(number)
property_existence(number, @all_numbers, @other_all_numbers)
end
|
#profile(profile) ⇒ Object
50
51
52
53
|
# File 'lib/abide_dev_utils/xccdf/diff/benchmark/profile.rb', line 50
def profile(profile)
profile_key = profile.respond_to?(:id) ? profile.id : profile
property_existence(profile_key, @profiles, @other_profiles)
end
|
#removed_numbers ⇒ Object
186
187
188
|
# File 'lib/abide_dev_utils/xccdf/diff/benchmark/number_title.rb', line 186
def removed_numbers
removed(@all_numbers, @other_all_numbers)
end
|
#removed_profiles ⇒ Object
66
67
68
|
# File 'lib/abide_dev_utils/xccdf/diff/benchmark/profile.rb', line 66
def removed_profiles
removed(@profiles.map(&:id), @other_profiles.map(&:id))
end
|
#removed_rules_by_profile ⇒ Object
78
79
80
81
82
83
84
|
# File 'lib/abide_dev_utils/xccdf/diff/benchmark/profile.rb', line 78
def removed_rules_by_profile
@rules_by_profile.each_with_object({}) do |(profile, rules), hsh|
next unless @other_rules_by_profile.key?(profile)
hsh[profile] = removed(rules, @other_rules_by_profile[profile])
end
end
|
#removed_titles ⇒ Object
194
195
196
|
# File 'lib/abide_dev_utils/xccdf/diff/benchmark/number_title.rb', line 194
def removed_titles
removed(@all_titles, @other_all_titles)
end
|
#rule_in_profile(rule, profile, rule_key: :title) ⇒ Object
55
56
57
58
59
60
|
# File 'lib/abide_dev_utils/xccdf/diff/benchmark/profile.rb', line 55
def rule_in_profile(rule, profile, rule_key: :title)
rk = rule.respond_to?(rule_key) ? rule.send(rule_key) : rule
rules = @profiles.find { |p| p.id == profile }.linked_rule.map(&rk)
other_rules = @other_profiles.find { |p| p.id == profile }.linked_rule.map(&rk)
property_existence(rk, rules, other_rules)
end
|
#title(title) ⇒ Object
174
175
176
|
# File 'lib/abide_dev_utils/xccdf/diff/benchmark/number_title.rb', line 174
def title(title)
property_existence(title, @all_titles, @other_all_titles)
end
|