Class: Musa::Series::Constructors::FromArray Private

Inherits:
Object
  • Object
show all
Defined in:
lib/musa-dsl/series/main-serie-constructors.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 constructor that creates a serie from an array of values.

Iterates through array elements, returning nil when exhausted. Supports optional module extensions for enhanced functionality.

Examples:

Basic array serie

serie = FromArray.new([1, 2, 3, 4, 5])
serie.next_value  # => 1
serie.next_value  # => 2

With extensions

serie = FromArray.new([60, 62, 64], [SomeExtension])

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(values = nil, extends = nil) ⇒ FromArray

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



537
538
539
540
541
542
543
544
545
546
547
# File 'lib/musa-dsl/series/main-serie-constructors.rb', line 537

def initialize(values = nil, extends = nil)
  @values = values
  mark_as_prototype!

  x = self
  extends.arrayfy.each do |e|
    x.extend(e)
  end

  init
end

Instance Attribute Details

#valuesObject

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.



549
550
551
# File 'lib/musa-dsl/series/main-serie-constructors.rb', line 549

def values
  @values
end