Class: Backport::Server::Stdio

Inherits:
Base
  • Object
show all
Includes:
Connectable
Defined in:
lib/backport/server/stdio.rb

Overview

A Backport STDIO server.

Instance Method Summary collapse

Methods included from Connectable

#clients, #starting, #stopping

Methods inherited from Base

#start, #started?, #starting, #stop, #stopped?, #stopping, #tick

Constructor Details

#initialize(input: STDIN, output: STDOUT, adapter: Adapter) ⇒ Stdio

Returns a new instance of Stdio.

Parameters:

  • input (IO) (defaults to: STDIN)
  • output (IO) (defaults to: STDOUT)
  • adapter (Module, Class) (defaults to: Adapter)


11
12
13
14
15
16
17
18
# File 'lib/backport/server/stdio.rb', line 11

def initialize input: STDIN, output: STDOUT, adapter: Adapter
  @in = input
  @out = output
  @out.binmode
  @adapter = adapter
  clients.push Client.new(input, output, adapter)
  clients.last.add_observer self
end

Instance Method Details

#update(client) ⇒ void

This method returns an undefined value.

Parameters:



22
23
24
# File 'lib/backport/server/stdio.rb', line 22

def update client
  client.tick
end