Class: WayOfWorking::Audit::Github::Rules::Base
- Inherits:
-
Object
- Object
- WayOfWorking::Audit::Github::Rules::Base
- Defined in:
- lib/way_of_working/audit/github/rules/base.rb
Overview
This is the base class for GitHub audit rules
Direct Known Subclasses
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#name ⇒ Object
Returns the value of attribute name.
-
#rulesets ⇒ Object
Returns the value of attribute rulesets.
-
#warnings ⇒ Object
Returns the value of attribute warnings.
Class Method Summary collapse
-
.source_root(path = nil) ⇒ Object
Stores and return the source root for this class.
- .tags ⇒ Object
Instance Method Summary collapse
-
#initialize(client, name, repo, rulesets) ⇒ Base
constructor
A new instance of Base.
- #status ⇒ Object
- #tags ⇒ Object
- #validate ⇒ Object
Constructor Details
#initialize(client, name, repo, rulesets) ⇒ Base
25 26 27 28 29 30 31 32 33 |
# File 'lib/way_of_working/audit/github/rules/base.rb', line 25 def initialize(client, name, repo, rulesets) @client = client @name = name @repo = repo @repo_name = repo.full_name @rulesets = rulesets @errors = [] @warnings = [] end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
15 16 17 |
# File 'lib/way_of_working/audit/github/rules/base.rb', line 15 def errors @errors end |
#name ⇒ Object
Returns the value of attribute name.
15 16 17 |
# File 'lib/way_of_working/audit/github/rules/base.rb', line 15 def name @name end |
#rulesets ⇒ Object
Returns the value of attribute rulesets.
15 16 17 |
# File 'lib/way_of_working/audit/github/rules/base.rb', line 15 def rulesets @rulesets end |
#warnings ⇒ Object
Returns the value of attribute warnings.
15 16 17 |
# File 'lib/way_of_working/audit/github/rules/base.rb', line 15 def warnings @warnings end |
Class Method Details
.source_root(path = nil) ⇒ Object
Stores and return the source root for this class
19 20 21 22 |
# File 'lib/way_of_working/audit/github/rules/base.rb', line 19 def source_root(path = nil) @source_root = path if path @source_root ||= nil end |
.tags ⇒ Object
52 53 54 |
# File 'lib/way_of_working/audit/github/rules/base.rb', line 52 def self. [:way_of_working] end |
Instance Method Details
#status ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/way_of_working/audit/github/rules/base.rb', line 35 def status @status ||= begin result = validate if result == :not_applicable result else @errors.empty? ? :passed : :failed end end end |
#tags ⇒ Object
56 57 58 |
# File 'lib/way_of_working/audit/github/rules/base.rb', line 56 def self.class. end |
#validate ⇒ Object
47 48 49 50 |
# File 'lib/way_of_working/audit/github/rules/base.rb', line 47 def validate $stdout.puts 'Rule#valid? has been deprecated, use "validate"' valid? end |