Class: Pact::Generators::RandomBooleanGenerator
- Inherits:
-
Object
- Object
- Pact::Generators::RandomBooleanGenerator
- Includes:
- Base
- Defined in:
- lib/pact/generators/base.rb
Instance Method Summary collapse
- #as_basic ⇒ Object
-
#initialize(example: nil) ⇒ RandomBooleanGenerator
constructor
A new instance of RandomBooleanGenerator.
Constructor Details
#initialize(example: nil) ⇒ RandomBooleanGenerator
Returns a new instance of RandomBooleanGenerator.
235 236 237 |
# File 'lib/pact/generators/base.rb', line 235 def initialize(example: nil) @example = example end |
Instance Method Details
#as_basic ⇒ Object
239 240 241 242 243 244 245 |
# File 'lib/pact/generators/base.rb', line 239 def as_basic { "pact:matcher:type" => "boolean", "pact:generator:type" => "RandomBoolean", "value" => @example.nil? ? [true, false].sample : @example } end |