Class: CodeforcesAPI::Object::Hack

Inherits:
Object
  • Object
show all
Defined in:
lib/codeforces_api/object/hack.rb

Constant Summary collapse

ATTRS =
[
  :id,
  :creationTimeSeconds,
  :hacker,
  :defender,
  :verdict,
  :problem,
  :test,
  :judgeProtocol,
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(hack) ⇒ Hack

Returns a new instance of Hack.



17
18
19
20
21
22
# File 'lib/codeforces_api/object/hack.rb', line 17

def initialize hack
  ATTRS.each { |attr| instance_variable_set("@#{attr}", hack[attr.to_s]) }
  @hacker   = Party.new(@hacker) if @hacker
  @defender = Party.new(@defender) if @defender
  @problem  = Problem.new(@problem) if @problem
end