class Mail2cb::EmailBodyCleanser

Public Class Methods

parse(text, type="text/plain") click to toggle source
# File lib/mail2cb/email_body_cleanser.rb, line 5
def self.parse(text, type="text/plain")

  data_hash = {:body => text, :type => type}

  json_hash = data_hash.to_json

  stdin, stdout, stderr, wait_thr = Open3.popen3('python', '/Users/stewartmckee/code/talon/test.py')
  stdin.write(json_hash)
  stdin.close
  result = stdout.read
  stdout.close
  error = stderr.read
  stderr.close
  exit_code = wait_thr.value
  if exit_code == 0
    result
  else
    puts result
    raise error
  end
end