Module: ProconBypassMan::ExternalInput

Defined in:
lib/procon_bypass_man/external_input.rb,
lib/procon_bypass_man/external_input/channels.rb,
lib/procon_bypass_man/external_input/boot_message.rb,
lib/procon_bypass_man/external_input/channels/base.rb,
lib/procon_bypass_man/external_input/external_data.rb,
lib/procon_bypass_man/external_input/channels/tcpip_channel.rb,
lib/procon_bypass_man/external_input/channels/serial_port_channel.rb

Defined Under Namespace

Modules: Channels Classes: BootMessage, ExternalData, ParseError

Class Method Summary collapse

Class Method Details

.channelsArray<ProconBypassMan::ExternalInput::Channels::Base>



8
9
10
# File 'lib/procon_bypass_man/external_input.rb', line 8

def self.channels
  @@channels ||= ProconBypassMan.config.external_input_channels
end

.readNilClass, String

NOTE: 外部入力からのreadがボトルネックになるなら、Concurrent::Futureを使ってプロコンからの読み出しと並列化することを検討する

Returns:

  • (NilClass, String)


18
19
20
21
22
23
24
25
# File 'lib/procon_bypass_man/external_input.rb', line 18

def self.read
  value = nil
  channels.each do |channel|
    value = channel.read
    break if value
  end
  value
end

.shutdownObject



12
13
14
# File 'lib/procon_bypass_man/external_input.rb', line 12

def self.shutdown
  channels.each(&:shutdown)
end