Class: Frostbitten::Score

Inherits:
Object
  • Object
show all
Defined in:
lib/frostbitten/score.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scores) ⇒ Score

Returns a new instance of Score.



16
17
18
19
# File 'lib/frostbitten/score.rb', line 16

def initialize(scores)
	self.team_one = scores[0].to_i
	self.team_two = scores[1].to_i
end

Instance Attribute Details

#team_oneObject

Returns the value of attribute team_one.



4
5
6
# File 'lib/frostbitten/score.rb', line 4

def team_one
  @team_one
end

#team_twoObject

Returns the value of attribute team_two.



4
5
6
# File 'lib/frostbitten/score.rb', line 4

def team_two
  @team_two
end

Class Method Details

.scores_from_list(list, index) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/frostbitten/score.rb', line 6

def scores_from_list(list,index)
	element_count = list.slice!(index).to_i
	return [].tap do |scores| 
		list.slice!(index,element_count).each_slice(2) do |slice|
			scores << Score.new(slice)
		end
	end
end