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/schema_element.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, Extractor, SchemaCache, SchemaElement

Constant Summary collapse

VERSION =
'0.1.05'

Class Method Summary collapse

Class Method Details

.configurationObject



34
35
36
# File 'lib/json_data_extractor.rb', line 34

def configuration
  @configuration ||= Configuration.new
end

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

Yields:



38
39
40
# File 'lib/json_data_extractor.rb', line 38

def configure
  yield(configuration)
end

.new(*args) ⇒ Object

Backward compatibility



22
23
24
# File 'lib/json_data_extractor.rb', line 22

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



30
31
32
# File 'lib/json_data_extractor.rb', line 30

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