Class: Torkify::Vim::Quickfix::Populator
- Inherits:
-
Object
- Object
- Torkify::Vim::Quickfix::Populator
- Defined in:
- lib/torkify/vim/quickfix.rb
Instance Attribute Summary collapse
-
#errors_populated ⇒ Object
readonly
Returns the value of attribute errors_populated.
Instance Method Summary collapse
- #exclude(file) ⇒ Object
-
#initialize(api) ⇒ Populator
constructor
A new instance of Populator.
- #populate(errors) ⇒ Object
Constructor Details
#initialize(api) ⇒ Populator
Returns a new instance of Populator.
57 58 59 60 61 |
# File 'lib/torkify/vim/quickfix.rb', line 57 def initialize(api) @api = api @excluded_buffers = [] @errors_populated = 0 end |
Instance Attribute Details
#errors_populated ⇒ Object (readonly)
Returns the value of attribute errors_populated.
55 56 57 |
# File 'lib/torkify/vim/quickfix.rb', line 55 def errors_populated @errors_populated end |
Instance Method Details
#exclude(file) ⇒ Object
63 64 65 66 67 68 69 70 71 |
# File 'lib/torkify/vim/quickfix.rb', line 63 def exclude(file) if file && file.length > 0 bufnum = @api.buffer_from_file(file) if bufnum > 0 && !@excluded_buffers.include?(bufnum) @excluded_buffers << bufnum end end self end |
#populate(errors) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/torkify/vim/quickfix.rb', line 73 def populate(errors) determine_excluded_buffers errors existing = api.get kept_errors = exclude_errors existing all_errors = kept_errors + errors @errors_populated = all_errors.length if error_list_changed?(existing, all_errors) api.set kept_errors + errors end self end |