Class: Litter::Parsing::Transform

Inherits:
Object
  • Object
show all
Defined in:
lib/litter/parsing/transform.rb

Instance Method Summary collapse

Instance Method Details

#apply(parsed) ⇒ Hash

Transforms output from Parser (an array of entry hashes) into a hash of arrays containing item finds.

Parameters:

  • parsed (Array<Hash>)

    output from Parser.

Returns:

  • (Hash)

    a hash of items and their finds; see parse_test.rb for an example.



8
9
10
11
12
13
14
15
16
# File 'lib/litter/parsing/transform.rb', line 8

def apply(parsed)
  all_items = {}

  parsed.each do |entry|
    extract_entry_into_all_items(entry, all_items)
  end

  all_items
end