Class: Musa::Series::Constructors::QueueSerie
- Inherits:
-
Object
- Object
- Musa::Series::Constructors::QueueSerie
show all
- Defined in:
- lib/musa-dsl/series/queue-serie.rb
Instance Method Summary
collapse
Constructor Details
#initialize(series) ⇒ QueueSerie
Returns a new instance of QueueSerie.
12
13
14
15
|
# File 'lib/musa-dsl/series/queue-serie.rb', line 12
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
71
72
73
74
75
76
77
|
# File 'lib/musa-dsl/series/queue-serie.rb', line 71
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
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/musa-dsl/series/queue-serie.rb', line 17
def <<(serie)
raise ArgumentError, "Only an instance serie can be queued" unless serie.instance?
@sources << serie
@current ||= @sources[@index]
self
end
|
#clear ⇒ Object
29
30
31
32
33
|
# File 'lib/musa-dsl/series/queue-serie.rb', line 29
def clear
@sources.clear
init
self
end
|
#infinite? ⇒ Boolean
61
62
63
|
# File 'lib/musa-dsl/series/queue-serie.rb', line 61
def infinite?
!!@sources.find(&:infinite?)
end
|