# frozen_string_literal: true module Cryptum # This plugin is used to Write the Order Book from Memory # to File When the "w" Key is Pressed module Event module OrderBook # Supported Method Parameters:: # Cryptum::Event::BotConf.write( # ) public_class_method def self.write(opts = {}) terminal_win = opts[:terminal_win] event_history = opts[:event_history] terminal_win.key_press_event.key_w = false order_book_file = event_history.order_book[:path] File.open(order_book_file, 'w') do |f| f.puts event_history.order_book.to_json end rescue StandardError => e raise e end # Display Usage for this Module public_class_method def self.help puts "USAGE: #{self}.write() " end end end end