Class: Musa::Series::Constructors::QueueSerie Private
- Defined in:
- lib/musa-dsl/series/queue-serie.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Serie that processes multiple source series in queue/sequence fashion.
Combines multiple series by playing them sequentially - when one
series exhausts, moves to the next. New series can be added dynamically
with << operator.
All queued series must be instances (not prototypes). The queue can
be cleared with clear method.
Instance Method Summary collapse
- #<<(serie) ⇒ Object private
- #clear ⇒ Object private
- #infinite? ⇒ Boolean private
-
#initialize(series) ⇒ QueueSerie
constructor
private
A new instance of QueueSerie.
Constructor Details
#initialize(series) ⇒ QueueSerie
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of QueueSerie.
77 78 79 80 |
# File 'lib/musa-dsl/series/queue-serie.rb', line 77 def initialize(series) self.sources = series init end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, **key_args, &block) ⇒ Object (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
136 137 138 139 140 141 142 |
# File 'lib/musa-dsl/series/queue-serie.rb', line 136 private def method_missing(method_name, *args, **key_args, &block) if @current&.respond_to?(method_name) @current.send method_name, *args, **key_args, &block else super end end |
Instance Method Details
#<<(serie) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/musa-dsl/series/queue-serie.rb', line 82 def <<(serie) # when queue is a prototype it is also frozen so no serie can be added (it would raise an Exception if tried). # when queue is an instance the added serie should also be an instance (raise an Exception otherwise) # raise ArgumentError, "Only an instance serie can be queued" unless serie.instance? @sources << serie @current ||= @sources[@index] self end |
#clear ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
94 95 96 97 98 |
# File 'lib/musa-dsl/series/queue-serie.rb', line 94 def clear @sources.clear init self end |
#infinite? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
126 127 128 |
# File 'lib/musa-dsl/series/queue-serie.rb', line 126 def infinite? !!@sources.find(&:infinite?) end |