Module: JSON22d

Extended by:
JSON22d
Included in:
JSON22d
Defined in:
lib/json22d.rb

Constant Summary collapse

VERSION =
"0.6"

Instance Method Summary collapse

Instance Method Details

#run(arr, config) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/json22d.rb', line 10

def run(arr, config)
  arr = arr.to_json unless arr.is_a?(String)
  arr = JSON.parse(arr)
  fill_blanks(arr, config, &(block_given? ? Proc.new : nil))
  return Enumerator.new do |y|
    y << header(config)
    arr.each do |h|
      row(block_given? ? yield(h) : h, config).each { |r| y << r }
    end
  end
end