Class: Prescient::DocumentSource::Memory

Inherits:
Base
  • Object
show all
Defined in:
lib/prescient/document_source.rb

Overview

Validate and bound application-provided JSON documents.

Instance Method Summary collapse

Constructor Details

#initialize(documents:, **options) ⇒ Memory

Returns a new instance of Memory.

Parameters:

  • documents (Array<Hash>, Hash)

    Documents to validate



56
57
58
59
# File 'lib/prescient/document_source.rb', line 56

def initialize(documents:, **options)
  super(**options)
  @documents = documents
end

Instance Method Details

#fetchArray<Hash>

Returns Validated documents.

Returns:

  • (Array<Hash>)

    Validated documents



62
63
64
# File 'lib/prescient/document_source.rb', line 62

def fetch
  normalize(@documents)
end