Module: AtCoderFriends::Parser::Interactive

Defined in:
lib/at_coder_friends/parser/interactive.rb

Overview

detect interactive problem

Constant Summary collapse

INTERACTIVE_PAT =
'(インタラクティブ|interactive|リアクティブ|reactive)'
FLUSH_PAT =
'flush'

Class Method Summary collapse

Class Method Details

.process(pbm) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/at_coder_friends/parser/interactive.rb', line 12

def process(pbm)
  pbm.options.interactive = false

  body = pbm.page_body
  f_int = body =~ /#{INTERACTIVE_PAT}/i
  f_flush = body =~ /#{FLUSH_PAT}/i
  f_io = pbm.sections[Problem::SECTION_IO_FMT]
  f_tbl =
    pbm
    .sections[Problem::SECTION_IO_SMP]
    &.find_element(%w[table])
  return unless [f_int, f_flush, f_io, f_tbl].count(&:itself) > 1

  pbm.options.interactive = true
end