Class: Randrizer::Types::OneOf
- Defined in:
- lib/randrizer/types/one_of.rb
Instance Method Summary collapse
- #eval ⇒ Object
-
#initialize(list_def) ⇒ OneOf
constructor
A new instance of OneOf.
- #length ⇒ Object (also: #count)
- #validate! ⇒ Object
Constructor Details
#initialize(list_def) ⇒ OneOf
Returns a new instance of OneOf.
8 9 10 |
# File 'lib/randrizer/types/one_of.rb', line 8 def initialize(list_def) @list_def = list_def end |
Instance Method Details
#eval ⇒ Object
16 17 18 |
# File 'lib/randrizer/types/one_of.rb', line 16 def eval @list_def.sample.eval end |
#length ⇒ Object Also known as: count
20 21 22 |
# File 'lib/randrizer/types/one_of.rb', line 20 def length @list_def.length end |
#validate! ⇒ Object
12 13 14 |
# File 'lib/randrizer/types/one_of.rb', line 12 def validate! !@list_def.nil? end |