Class: Pact::Generator::Uuid

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

Overview

Uuid provides the uuid generator

Instance Method Summary collapse

Instance Method Details

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

If we had the example value, we could determine what type of uuid to send, this is what pact-jvm does See github.com/pact-foundation/pact-jvm/blob/master/core/model/src/main/kotlin/au/com/dius/pact/core/model/generators/Generator.kt



14
15
16
# File 'lib/pact/generator/uuid.rb', line 14

def call(_hash, _params = nil, _example_value = nil)
  SecureRandom.uuid
end

#can_generate?(hash) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/pact/generator/uuid.rb', line 7

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