Class: AtCoderFriends::Problem

Inherits:
Object
  • Object
show all
Defined in:
lib/at_coder_friends/problem.rb

Overview

holds problem information

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(q) {|_self| ... } ⇒ Problem

Returns a new instance of Problem.

Yields:

  • (_self)

Yield Parameters:



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/at_coder_friends/problem.rb', line 25

def initialize(q)
  @q = q
  @page = nil
  @desc = ''
  @fmt = ''
  @smps = []
  @defs = []
  @constraints = []
  @srcs = []
  yield self if block_given?
end

Instance Attribute Details

#constraintsObject

Returns the value of attribute constraints.



23
24
25
# File 'lib/at_coder_friends/problem.rb', line 23

def constraints
  @constraints
end

#defsObject

Returns the value of attribute defs.



23
24
25
# File 'lib/at_coder_friends/problem.rb', line 23

def defs
  @defs
end

#descObject

Returns the value of attribute desc.



23
24
25
# File 'lib/at_coder_friends/problem.rb', line 23

def desc
  @desc
end

#fmtObject

Returns the value of attribute fmt.



23
24
25
# File 'lib/at_coder_friends/problem.rb', line 23

def fmt
  @fmt
end

#pageObject

Returns the value of attribute page.



23
24
25
# File 'lib/at_coder_friends/problem.rb', line 23

def page
  @page
end

#qObject (readonly)

Returns the value of attribute q.



22
23
24
# File 'lib/at_coder_friends/problem.rb', line 22

def q
  @q
end

#smpsObject (readonly)

Returns the value of attribute smps.



22
23
24
# File 'lib/at_coder_friends/problem.rb', line 22

def smps
  @smps
end

#srcsObject (readonly)

Returns the value of attribute srcs.



22
23
24
# File 'lib/at_coder_friends/problem.rb', line 22

def srcs
  @srcs
end

Instance Method Details

#add_smp(no, ext, txt) ⇒ Object



37
38
39
# File 'lib/at_coder_friends/problem.rb', line 37

def add_smp(no, ext, txt)
  @smps << SampleData.new(no, ext, txt)
end

#add_src(ext, txt) ⇒ Object



41
42
43
# File 'lib/at_coder_friends/problem.rb', line 41

def add_src(ext, txt)
  @srcs << SourceCode.new(ext, txt)
end