Class: FitCommit::Validators::Base
- Inherits:
-
Object
- Object
- FitCommit::Validators::Base
- Includes:
- HasErrors
- Defined in:
- lib/fit-commit/validators/base.rb
Direct Known Subclasses
Class Attribute Summary collapse
-
.all ⇒ Object
Returns the value of attribute all.
Instance Attribute Summary collapse
-
#branch_name ⇒ Object
Returns the value of attribute branch_name.
-
#lines ⇒ Object
Returns the value of attribute lines.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(lines, branch_name) ⇒ Base
constructor
A new instance of Base.
- #validate ⇒ Object
- #validate_line ⇒ Object
Methods included from HasErrors
#add_error, #add_warning, #errors, #merge_errors, #merge_warnings, #warnings
Constructor Details
#initialize(lines, branch_name) ⇒ Base
Returns a new instance of Base.
9 10 11 12 |
# File 'lib/fit-commit/validators/base.rb', line 9 def initialize(lines, branch_name) self.lines = lines self.branch_name = branch_name end |
Class Attribute Details
.all ⇒ Object
Returns the value of attribute all.
16 17 18 |
# File 'lib/fit-commit/validators/base.rb', line 16 def all @all end |
Instance Attribute Details
#branch_name ⇒ Object
Returns the value of attribute branch_name.
8 9 10 |
# File 'lib/fit-commit/validators/base.rb', line 8 def branch_name @branch_name end |
#lines ⇒ Object
Returns the value of attribute lines.
8 9 10 |
# File 'lib/fit-commit/validators/base.rb', line 8 def lines @lines end |
Class Method Details
.inherited(subclass) ⇒ Object
17 18 19 |
# File 'lib/fit-commit/validators/base.rb', line 17 def inherited(subclass) all << subclass end |
Instance Method Details
#validate ⇒ Object
22 23 24 25 26 |
# File 'lib/fit-commit/validators/base.rb', line 22 def validate lines.each do |line| validate_line(line.lineno, line.text, branch_name) end end |
#validate_line ⇒ Object
28 29 30 |
# File 'lib/fit-commit/validators/base.rb', line 28 def validate_line(*) fail NotImplementedError, "Implement in subclass" end |