Class: GovukSchemas::RandomItemGenerator
- Inherits:
-
Object
- Object
- GovukSchemas::RandomItemGenerator
- Defined in:
- lib/govuk_schemas/random_item_generator.rb
Overview
The RandomItemGenerator takes a JSON schema and outputs a random hash that is valid against said schema.
The “randomness” here is quote relative, it’s particularly tailored to the GOV.UK content schemas. For example, strings are limited to a couple of hundred characters to keep the resulting items small.
Instance Method Summary collapse
-
#initialize(schema:) ⇒ RandomItemGenerator
constructor
A new instance of RandomItemGenerator.
- #payload ⇒ Object
Constructor Details
#initialize(schema:) ⇒ RandomItemGenerator
Returns a new instance of RandomItemGenerator.
13 14 15 |
# File 'lib/govuk_schemas/random_item_generator.rb', line 13 def initialize(schema:) @schema = schema end |
Instance Method Details
#payload ⇒ Object
17 18 19 |
# File 'lib/govuk_schemas/random_item_generator.rb', line 17 def payload generate_value(@schema) end |