Class: JsonTestData::String

Inherits:
Object
  • Object
show all
Defined in:
lib/json_test_data/data_structures/string.rb

Class Method Summary collapse

Class Method Details

.create(schema) ⇒ Object



4
5
6
7
8
9
# File 'lib/json_test_data/data_structures/string.rb', line 4

def create(schema)
  return schema.fetch(:enum).sample if schema.fetch(:enum, nil)
  return generate_date if schema.fetch(:format, nil) == "date-time"

  pattern(schema).random_example
end