Sha256: 7b21e16319f70956c3461e4876830ebc6317a52564bcdb7ec134a05fcdbf41f4

Contents?: true

Size: 1010 Bytes

Versions: 35

Compression:

Stored size: 1010 Bytes

Contents

# frozen_string_literal: true

module Cryptum
  # Cryptum::Event Namespace
  module Event
    # This Module is used to Write the Order Book from Memory
    # to File When the "w" Key is Pressed
    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 unless terminal_win.nil?
        order_book_file = event_history.order_book[:path]

        File.write(
          order_book_file,
          JSON.pretty_generate(event_history.order_book)
        )
      rescue Interrupt, StandardError => e
        Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
      end

      # Display Usage for this Module
      public_class_method def self.help
        puts "USAGE:
          #{self}.write()
        "
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
cryptum-0.0.466 lib/cryptum/event/order_book.rb
cryptum-0.0.465 lib/cryptum/event/order_book.rb
cryptum-0.0.464 lib/cryptum/event/order_book.rb
cryptum-0.0.463 lib/cryptum/event/order_book.rb
cryptum-0.0.462 lib/cryptum/event/order_book.rb
cryptum-0.0.461 lib/cryptum/event/order_book.rb
cryptum-0.0.460 lib/cryptum/event/order_book.rb
cryptum-0.0.459 lib/cryptum/event/order_book.rb
cryptum-0.0.458 lib/cryptum/event/order_book.rb
cryptum-0.0.457 lib/cryptum/event/order_book.rb
cryptum-0.0.456 lib/cryptum/event/order_book.rb
cryptum-0.0.455 lib/cryptum/event/order_book.rb
cryptum-0.0.454 lib/cryptum/event/order_book.rb
cryptum-0.0.453 lib/cryptum/event/order_book.rb
cryptum-0.0.452 lib/cryptum/event/order_book.rb
cryptum-0.0.451 lib/cryptum/event/order_book.rb
cryptum-0.0.450 lib/cryptum/event/order_book.rb
cryptum-0.0.449 lib/cryptum/event/order_book.rb
cryptum-0.0.448 lib/cryptum/event/order_book.rb
cryptum-0.0.447 lib/cryptum/event/order_book.rb