Class: Uttk::Filters::Buffer
- Inherits:
-
Filter
- Object
- Logger::Backend
- Filter
- Uttk::Filters::Buffer
- Includes:
- Concrete
- Defined in:
- lib/uttk/filters/Buffer.rb
Overview
This basic filter observe a logger and bufferize all received messages, with a tree formatting. The buffer can be flushed when the data are not usefull anymore. That imply that another entity, a kind of controller, should always be connected to this class.
The buffer is simple, all notified datas are directly putted inside, and when a flush is needed (or asked) it erases all datas. So, it is possible to think to a new class, derived from this one, which examin more precisely the notifications, and stock into the buffer just the desired. It could do the same for flush the buffer, just clear some part of the buffer. The tool Rpath could be very usefull to do that.
The messages are putted into the buffer in order to make a tree, only with Hash and OHash objects. So, that tree could be given at any time.
The main utiliy of this class is to provide exactly all the datas that another entity want. Moreover, that ones are given under a tree form, which allow simple navigation inside, especialy with the Rpath tool.
Defined Under Namespace
Modules: Assertions
Instance Attribute Summary collapse
-
#buffer ⇒ Object
readonly
Returns the value of attribute buffer.
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(*a, &b) ⇒ Buffer
constructor
A new instance of Buffer.
- #reset ⇒ Object (also: #clear)
- #update(*a, &b) ⇒ Object
Methods inherited from Filter
Constructor Details
#initialize(*a, &b) ⇒ Buffer
Returns a new instance of Buffer.
39 40 41 42 |
# File 'lib/uttk/filters/Buffer.rb', line 39 def initialize(*a, &b) super reset end |
Instance Attribute Details
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
37 38 39 |
# File 'lib/uttk/filters/Buffer.rb', line 37 def buffer @buffer end |
Instance Method Details
#empty? ⇒ Boolean
97 98 99 |
# File 'lib/uttk/filters/Buffer.rb', line 97 def empty? @buffer.is_a? Hash and @buffer.empty? end |
#reset ⇒ Object Also known as: clear
44 45 46 47 48 49 |
# File 'lib/uttk/filters/Buffer.rb', line 44 def reset @buffer = {} @path = [@buffer] @last_node = nil @reset_planned = false end |
#update(*a, &b) ⇒ Object
92 93 94 95 |
# File 'lib/uttk/filters/Buffer.rb', line 92 def update ( *a, &b ) reset if @reset_planned super end |