Class: Musa::Series::Operations::Processor Private

Inherits:
Object
  • Object
show all
Defined in:
lib/musa-dsl/series/main-serie-operations.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 operation that processes/transforms values using a block.

Applies transformation function to each value from source serie. The block can return single values or arrays (which are flattened into the output stream).

Uses smart block binding for flexible parameter handling.

Examples:

Simple transformation

serie = FromArray.new([1, 2, 3])
processor = Processor.new(serie, {}) { |v| v * 2 }
processor.next_value  # => 2
processor.next_value  # => 4

Transformation with parameters

processor = Processor.new(serie, multiplier: 3) { |v, multiplier:| v * multiplier }

Returning arrays (flattened)

processor = Processor.new(serie, {}) { |v| [v, v + 1] }
processor.next_value  # => 1
processor.next_value  # => 2

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(serie, parameters, &processor) ⇒ Processor

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 Processor.



1163
1164
1165
1166
1167
1168
1169
1170
# File 'lib/musa-dsl/series/main-serie-operations.rb', line 1163

def initialize(serie, parameters, &processor)
  self.source = serie

  self.parameters = parameters
  self.proc = processor if processor

  init
end

Instance Attribute Details

#parametersObject

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.



1172
1173
1174
# File 'lib/musa-dsl/series/main-serie-operations.rb', line 1172

def parameters
  @parameters
end

Instance Method Details

#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.

Returns:

  • (Boolean)


1208
1209
1210
# File 'lib/musa-dsl/series/main-serie-operations.rb', line 1208

def infinite?
  @source.infinite?
end