Class: Cyclomagic::BaseFormater
- Inherits:
-
Object
- Object
- Cyclomagic::BaseFormater
- Defined in:
- lib/cyclomagic.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#current ⇒ Object
Returns the value of attribute current.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#warnings ⇒ Object
Returns the value of attribute warnings.
Instance Method Summary collapse
-
#initialize(out, filter = nil) ⇒ BaseFormater
constructor
A new instance of BaseFormater.
- #reset_data ⇒ Object
- #warn_error?(num, marker) ⇒ Boolean
Constructor Details
#initialize(out, filter = nil) ⇒ BaseFormater
Returns a new instance of BaseFormater.
585 586 587 588 589 |
# File 'lib/cyclomagic.rb', line 585 def initialize(out, filter = nil) @out = out @filter = filter reset_data end |
Instance Attribute Details
#current ⇒ Object
Returns the value of attribute current.
583 584 585 |
# File 'lib/cyclomagic.rb', line 583 def current @current end |
#errors ⇒ Object
Returns the value of attribute errors.
583 584 585 |
# File 'lib/cyclomagic.rb', line 583 def errors @errors end |
#warnings ⇒ Object
Returns the value of attribute warnings.
583 584 585 |
# File 'lib/cyclomagic.rb', line 583 def warnings @warnings end |
Instance Method Details
#reset_data ⇒ Object
605 606 607 608 609 |
# File 'lib/cyclomagic.rb', line 605 def reset_data @warnings = Array.new @errors = Array.new @current = "" end |
#warn_error?(num, marker) ⇒ Boolean
591 592 593 594 595 596 597 598 599 600 601 602 603 |
# File 'lib/cyclomagic.rb', line 591 def warn_error?(num, marker) klass = "" if @filter.error?(num) klass = ' class="error"' @errors<< [@current, marker, num] elsif @filter.warn?(num) klass = ' class="warning"' @warnings<< [@current, marker, num] end klass end |