Class: JsonDataExtractor::SchemaCache

Inherits:
Object
  • Object
show all
Defined in:
lib/json_data_extractor/schema_cache.rb

Overview

Caches schema elements to avoid re-processing the schema for each data extraction

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schema) ⇒ SchemaCache

Returns a new instance of SchemaCache.



8
9
10
11
12
13
14
15
# File 'lib/json_data_extractor/schema_cache.rb', line 8

def initialize(schema)
  @schema = schema
  @schema_elements = {}
  @path_cache = {}
  
  # Pre-process the schema to create SchemaElement objects
  process_schema
end

Instance Attribute Details

#path_cacheObject (readonly)

Returns the value of attribute path_cache.



6
7
8
# File 'lib/json_data_extractor/schema_cache.rb', line 6

def path_cache
  @path_cache
end

#schemaObject (readonly)

Returns the value of attribute schema.



6
7
8
# File 'lib/json_data_extractor/schema_cache.rb', line 6

def schema
  @schema
end

#schema_elementsObject (readonly)

Returns the value of attribute schema_elements.



6
7
8
# File 'lib/json_data_extractor/schema_cache.rb', line 6

def schema_elements
  @schema_elements
end