Class: Mudguard::Domain::Policies
- Inherits:
-
Object
- Object
- Mudguard::Domain::Policies
- Includes:
- Texts
- Defined in:
- lib/mudguard/domain/policies.rb
Overview
Contains the policies to be enforced
Instance Method Summary collapse
- #check(notification) ⇒ Object
-
#initialize(source_policies: []) ⇒ Policies
constructor
A new instance of Policies.
- #print_allowed_dependencies(notification) ⇒ Object
Methods included from Texts
#dependency_allowed, #dependency_not_allowed, #dependency_summary, #summary
Constructor Details
#initialize(source_policies: []) ⇒ Policies
Returns a new instance of Policies.
13 14 15 |
# File 'lib/mudguard/domain/policies.rb', line 13 def initialize(source_policies: []) @source_policies = source_policies end |
Instance Method Details
#check(notification) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/mudguard/domain/policies.rb', line 17 def check(notification) result = analyse(:check, notification) count = result[:sources_count] violations = result[:analyser_count] notification.add(nil, summary(count, violations)) violations.zero? end |
#print_allowed_dependencies(notification) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/mudguard/domain/policies.rb', line 27 def print_allowed_dependencies(notification) result = analyse(:print_allowed, notification) count = result[:sources_count] violations = result[:analyser_count] notification.add(nil, dependency_summary(count, violations)) end |