Exception: Musa::Series::Serie::Prototyping::PrototypingError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/musa-dsl/series/base-series.rb

Overview

Error raised when serie is used in wrong state.

Raised when attempting to consume a prototype serie or perform operations on undefined serie.

Common Scenarios

  • Calling next_value on prototype
  • Calling restart on prototype
  • Using undefined serie

Solution

Call .instance (or .i) to create consumable instance:

proto = S(1, 2, 3)
proto.next_value  # => PrototypingError

inst = proto.instance
inst.next_value  # => 1

Instance Method Summary collapse

Constructor Details

#initialize(message = nil) ⇒ PrototypingError

Creates prototyping error with message.

Parameters:

  • message (String, nil) (defaults to: nil)

    custom error message



897
898
899
900
# File 'lib/musa-dsl/series/base-series.rb', line 897

def initialize(message = nil)
  message ||= 'This serie is a prototype serie: cannot be consumed. To consume the serie use an instance serie via .instance method'
  super message
end