Module: JsonDataExtractor

Defined in:
lib/json_data_extractor.rb,
lib/json_data_extractor/version.rb,
lib/json_data_extractor/extractor.rb,
lib/json_data_extractor/schema_cache.rb,
lib/json_data_extractor/configuration.rb,
lib/json_data_extractor/path_compiler.rb,
lib/json_data_extractor/schema_element.rb,
lib/json_data_extractor/schema_analyzer.rb,
lib/json_data_extractor/direct_navigator.rb,
lib/json_data_extractor/optimized_extractor.rb,
lib/json_data_extractor/extraction_instruction.rb

Overview

Transform JSON data structures with the help of a simple schema and JsonPath expressions. Use the JsonDataExtractor gem to extract and modify data from complex JSON structures using a straightforward syntax and a range of built-in or custom modifiers.

Defined Under Namespace

Classes: Configuration, DirectNavigator, ExtractionInstruction, Extractor, OptimizedExtractor, PathCompiler, SchemaAnalyzer, SchemaCache, SchemaElement

Constant Summary collapse

VERSION =
'0.2.1'

Class Method Summary collapse

Class Method Details

.configurationObject



40
41
42
# File 'lib/json_data_extractor.rb', line 40

def configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



44
45
46
# File 'lib/json_data_extractor.rb', line 44

def configure
  yield(configuration)
end

.new(*args) ⇒ Object

Backward compatibility



28
29
30
# File 'lib/json_data_extractor.rb', line 28

def new(*args)
  Extractor.new(*args)
end

.with_schema(schema, modifiers = {}) ⇒ Extractor

Creates a new extractor with a pre-processed schema

Parameters:

  • schema (Hash)

    schema of the expected data mapping

  • modifiers (Hash) (defaults to: {})

    modifiers to apply to the extracted data

Returns:

  • (Extractor)

    an extractor initialized with the schema



36
37
38
# File 'lib/json_data_extractor.rb', line 36

def with_schema(schema, modifiers = {})
  Extractor.with_schema(schema, modifiers)
end