Class: Repp::Handler::Shell

Inherits:
Object
  • Object
show all
Defined in:
lib/repp/handler/shell.rb

Defined Under Namespace

Modules: KeyboardHandler

Class Method Summary collapse

Class Method Details

.run(app, options = {}) {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/repp/handler/shell.rb', line 19

def self.run(app, options = {})
  yield self if block_given?

  application = app.new
  @ticker = Ticker.task(application) do |res|
    if res.any?
      $stdout.puts res.first
    end
  end

  @ticker.run!
  EM.run { EM.open_keyboard(KeyboardHandler, application) }
end

.stopObject



33
34
35
# File 'lib/repp/handler/shell.rb', line 33

def self.stop
  EM.run { EM.stop }
end