Class: Pact::Generator::RandomBoolean

Inherits:
Object
  • Object
show all
Defined in:
lib/pact/generator/random_boolean.rb

Overview

Boolean provides the boolean generator which will give a true or false value

Instance Method Summary collapse

Instance Method Details

#call(_hash, _params = nil, _example_value = nil) ⇒ Object



9
10
11
# File 'lib/pact/generator/random_boolean.rb', line 9

def call(_hash, _params = nil, _example_value = nil)
  [true, false].sample
end

#can_generate?(hash) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/pact/generator/random_boolean.rb', line 5

def can_generate?(hash)
  hash.key?('type') && hash['type'] == 'RandomBoolean'
end