Class: Wallace::Koza::TerminalSet

Inherits:
NodeValueSet show all
Defined in:
lib/modules/koza/koza_node_value_set.rb

Overview

Holds the set of terminal values.

Instance Method Summary collapse

Methods inherited from NodeValueSet

#[], #initialize

Constructor Details

This class inherits a constructor from Wallace::Koza::NodeValueSet

Instance Method Details

#sample(opts = {}) ⇒ Object

Samples an option from this set.

Parameters:

  • opt, a hash of keyword options for this method. -> random, the RNG to use to sample an option.



30
31
32
33
34
35
# File 'lib/modules/koza/koza_node_value_set.rb', line 30

def sample(opts = {})
  opts[:random] ||= Random.new
  value = @contents.sample(random: opts[:random])
  value = value.sample(random: opts[:random]) if value.is_a? Wallace::Koza::Ephemeral
  return value
end