Class: Lightstreamer::CLI::Main

Inherits:
Thor
  • Object
show all
Defined in:
lib/lightstreamer/cli/main.rb,
lib/lightstreamer/cli/commands/stream_command.rb

Overview

Implements the ‘lightstreamer stream` command.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.bootstrap(argv) ⇒ Object

This is the initial entry point for the execution of the command-line client. It is responsible for the –version/-v options and then invoking the main application.

Parameters:

  • argv (Array<String>)

    The array of command-line arguments.



13
14
15
16
17
18
19
20
# File 'lib/lightstreamer/cli/main.rb', line 13

def bootstrap(argv)
  if argv.index('--version') || argv.index('-v')
    puts VERSION
    exit
  end

  start argv
end

Instance Method Details

#streamObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/lightstreamer/cli/commands/stream_command.rb', line 16

def stream
  session = create_session
  session.connect

  @queue = Queue.new

  session.subscribe create_subscription

  loop do
    puts @queue.pop
  end
end