class Object

Public Instance Methods

handle_file(params) click to toggle source
# File lib/havox/app/helpers/methods.rb, line 2
def handle_file(params)
  filepath = "./#{params[:filename]}"
  File.open(filepath, 'w') { |f| f.write(params[:tempfile].read) }
  filepath
end
print_blocks(merlin_blocks, opts) click to toggle source
print_opts(opts) click to toggle source
print_policy(policy, opts) click to toggle source
run_network(dot_filepath, hvx_filepath, opts = {}) click to toggle source
# File lib/havox/app/helpers/methods.rb, line 8
def run_network(dot_filepath, hvx_filepath, opts = {})
  mln_filename = "./#{File.basename(hvx_filepath, '.hvx')}.mln"
  eval File.read(hvx_filepath)
  mln_blocks = Havox::Network.transcompile(opts)
  print_blocks(mln_blocks, opts)
  return nil if mln_blocks.empty?
  File.open(mln_filename, 'w') { |f| f.write(mln_blocks.join("\n")) }
  mln_filename
end