Class: Ingestor::Parser::Json

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/ingestor/parser/json.rb

Instance Method Summary collapse

Methods included from Base

included, #initialize

Instance Method Details

#options(opts = {}) ⇒ Object



7
8
9
10
11
# File 'lib/ingestor/parser/json.rb', line 7

def options(opts={})
  @options = {
    :collection => nil
  }.merge(opts)
end

#process!Object



18
19
20
21
22
# File 'lib/ingestor/parser/json.rb', line 18

def process!
  @options[:collection].call(document).each do |attrs|
    @proxy.process_entry @proxy.options[:map_attributes].call( attrs )
  end
end

#sample!Object



13
14
15
16
# File 'lib/ingestor/parser/json.rb', line 13

def sample!
  puts @options[:collection].call(document).first
  #puts @options[:collection] ? @options[:collection].call(document).first : document.first
end