Class: Vedeu::Buffer
- Inherits:
-
Object
- Object
- Vedeu::Buffer
- Defined in:
- lib/vedeu/support/buffer.rb
Instance Attribute Summary collapse
-
#_next ⇒ Object
readonly
Returns the value of attribute _next.
-
#clear ⇒ Object
readonly
Returns the value of attribute clear.
-
#current ⇒ Object
readonly
Returns the value of attribute current.
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #enqueue(sequence) ⇒ Object
-
#initialize(vars) ⇒ Buffer
constructor
A new instance of Buffer.
- #refresh ⇒ Object
Constructor Details
#initialize(vars) ⇒ Buffer
Returns a new instance of Buffer.
5 6 7 8 9 10 11 12 |
# File 'lib/vedeu/support/buffer.rb', line 5 def initialize(vars) @vars = vars @name = vars.fetch(:name) @clear = vars.fetch(:clear) @current = vars.fetch(:current) @group = vars.fetch(:group) @_next = vars.fetch(:next) end |
Instance Attribute Details
#_next ⇒ Object (readonly)
Returns the value of attribute _next.
3 4 5 |
# File 'lib/vedeu/support/buffer.rb', line 3 def _next @_next end |
#clear ⇒ Object (readonly)
Returns the value of attribute clear.
3 4 5 |
# File 'lib/vedeu/support/buffer.rb', line 3 def clear @clear end |
#current ⇒ Object (readonly)
Returns the value of attribute current.
3 4 5 |
# File 'lib/vedeu/support/buffer.rb', line 3 def current @current end |
#group ⇒ Object (readonly)
Returns the value of attribute group.
3 4 5 |
# File 'lib/vedeu/support/buffer.rb', line 3 def group @group end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/vedeu/support/buffer.rb', line 3 def name @name end |
Instance Method Details
#enqueue(sequence) ⇒ Object
14 15 16 |
# File 'lib/vedeu/support/buffer.rb', line 14 def enqueue(sequence) merge({ next: sequence }) end |
#refresh ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/vedeu/support/buffer.rb', line 18 def refresh sequence = if !_next.empty? merge({ current: _next, next: '' }).current elsif current.empty? clear else current end Terminal.output(sequence) self end |