Method: Mushy::SimplePythonProgram#process

Defined in:
lib/mushy/fluxs/simple_python_program.rb

#process(event, config) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/mushy/fluxs/simple_python_program.rb', line 17

def process event, config

  lines = python_program(event, config)
            .split('\n')
            .map { |x| x.rstrip }
            .select { |x| x && x != '' }
            .map { |x| x.gsub('"', '\"') }

  config[:command] = "python -c \"#{lines.join(';')}\""

  result = super event, config

  return nil unless result[:success]

  adjust SymbolizedHash.new(JSON.parse(result[:text])), event, config

end