Sha256: 3a521bf03660b106bc5595d8e441e676bd5bc1165e69757eb7c5b7509c4f5302

Contents?: true

Size: 356 Bytes

Versions: 2

Compression:

Stored size: 356 Bytes

Contents

module Pact
  module Generator
    # Boolean provides the boolean generator which will give a true or false value
    class RandomBoolean
      def can_generate?(hash)
        hash.key?('type') && hash['type'] == 'RandomBoolean'
      end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pact-support-1.21.1 lib/pact/generator/random_boolean.rb
pact-support-1.21.0 lib/pact/generator/random_boolean.rb