Sha256: 54840c8e2e055cbee8bdb8d4021c23e0c390def902b0e77faf4e7a9dbc30a667

Contents?: true

Size: 858 Bytes

Versions: 3

Compression:

Stored size: 858 Bytes

Contents

# 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::OrderBook.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.write(
          order_book_file,
          JSON.pretty_generate(event_history.order_book)
        )
      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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cryptum-0.0.386 lib/cryptum/event/order_book.rb
cryptum-0.0.385 lib/cryptum/event/order_book.rb
cryptum-0.0.384 lib/cryptum/event/order_book.rb