Class: Rooibos::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/rooibos/configuration.rb

Overview

Configuration represents the Mealy machine (state, input) pair. Immutable value object; use with_model to derive new configurations.

Instance Method Summary collapse

Instance Method Details

#to_aObject Also known as: to_ary, deconstruct

Destructures into [message, model] array.



23
24
25
# File 'lib/rooibos/configuration.rb', line 23

def to_a
  [message, model]
end

#with_model(new_model) ⇒ Object

Derives a new Configuration with an updated model. Returns self if new_model is nil.



15
16
17
18
19
# File 'lib/rooibos/configuration.rb', line 15

def with_model(new_model)
  return self unless new_model

  Configuration.new(message:, model: new_model)
end