Class: BaseFormater
- Inherits:
-
Object
- Object
- BaseFormater
- Defined in:
- lib/saikuro/base_formatter.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
4 5 6 7 8 |
# File 'lib/saikuro/base_formatter.rb', line 4 def initialize(out, filter = nil) @out = out @filter = filter reset_data end |
Instance Attribute Details
#current ⇒ Object
Returns the value of attribute current.
2 3 4 |
# File 'lib/saikuro/base_formatter.rb', line 2 def current @current end |
#errors ⇒ Object
Returns the value of attribute errors.
2 3 4 |
# File 'lib/saikuro/base_formatter.rb', line 2 def errors @errors end |
#warnings ⇒ Object
Returns the value of attribute warnings.
2 3 4 |
# File 'lib/saikuro/base_formatter.rb', line 2 def warnings @warnings end |
Instance Method Details
#reset_data ⇒ Object
24 25 26 27 28 |
# File 'lib/saikuro/base_formatter.rb', line 24 def reset_data @warnings = Array.new @errors = Array.new @current = "" end |
#warn_error?(num, marker) ⇒ Boolean
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/saikuro/base_formatter.rb', line 10 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 |