Sha256: 8ff8d11bea65d86c39b7ebf3a109dd4dcf28abda58be88ec2efd3a07dd46963b

Contents?: true

Size: 985 Bytes

Versions: 34

Compression:

Stored size: 985 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
        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

34 entries across 34 versions & 1 rubygems

Version Path
cryptum-0.0.431 lib/cryptum/event/order_book.rb
cryptum-0.0.430 lib/cryptum/event/order_book.rb
cryptum-0.0.429 lib/cryptum/event/order_book.rb
cryptum-0.0.428 lib/cryptum/event/order_book.rb
cryptum-0.0.427 lib/cryptum/event/order_book.rb
cryptum-0.0.426 lib/cryptum/event/order_book.rb
cryptum-0.0.425 lib/cryptum/event/order_book.rb
cryptum-0.0.424 lib/cryptum/event/order_book.rb
cryptum-0.0.423 lib/cryptum/event/order_book.rb
cryptum-0.0.422 lib/cryptum/event/order_book.rb
cryptum-0.0.421 lib/cryptum/event/order_book.rb
cryptum-0.0.420 lib/cryptum/event/order_book.rb
cryptum-0.0.419 lib/cryptum/event/order_book.rb
cryptum-0.0.418 lib/cryptum/event/order_book.rb
cryptum-0.0.417 lib/cryptum/event/order_book.rb
cryptum-0.0.416 lib/cryptum/event/order_book.rb
cryptum-0.0.415 lib/cryptum/event/order_book.rb
cryptum-0.0.414 lib/cryptum/event/order_book.rb
cryptum-0.0.413 lib/cryptum/event/order_book.rb
cryptum-0.0.412 lib/cryptum/event/order_book.rb