Sha256: 42a4930657c1e9c57c9b801fa609042c6e36d83ce76352d23c3490a7402f80c3

Contents?: true

Size: 580 Bytes

Versions: 2

Compression:

Stored size: 580 Bytes

Contents

require 'securerandom'

module Pact
  module Generator
    # Uuid provides the uuid generator
    class Uuid
      def can_generate?(hash)
        hash.key?('type') && hash['type'] == 'Uuid'
      end

      # If we had the example value, we could determine what type of uuid
      # to send, this is what pact-jvm does
      # See https://github.com/pact-foundation/pact-jvm/blob/master/core/model/src/main/kotlin/au/com/dius/pact/core/model/generators/Generator.kt
      def call(_hash, _params = nil, _example_value = nil)
        SecureRandom.uuid
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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