Method: NexosisApi::SessionContest#initialize
- Defined in:
- lib/nexosis_api/session_contest.rb
#initialize(contest_hash) ⇒ SessionContest
Returns a new instance of SessionContest.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/nexosis_api/session_contest.rb', line 5 def initialize(contest_hash) contest_hash.each do |k, v| if k.to_s == 'champion' instance_variable_set("@#{k}", NexosisApi::AlgorithmContestant.new(v)) elsif k.to_s == 'contestants' instance_variable_set("@#{k}", v.map { |c| NexosisApi::AlgorithmContestant.new(c) }) elsif k.to_s == 'championMetric' @champion_metric = v end end super(contest_hash.reject { |key, _v| key == 'champion' || key == 'contestants' }) end |