Module: AtCoderFriends::Parser::SampleData

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

Overview

parses sample data and sets to problem

Class Method Summary collapse

Class Method Details

.process(pbm) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/at_coder_friends/parser/sample_data.rb', line 11

def process(pbm)
  pbm.sections.each do |key, section|
    ext =
      if key =~ Problem::SECTION_IN_SMP_PAT
        :in
      elsif key =~ Problem::SECTION_OUT_SMP_PAT
        :exp
      end
    ext && pbm.add_smp(
      $LAST_MATCH_INFO[:no], ext, section.code_block_content
    )
  end
end