Class: MutuallyExclusiveCollection

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

Overview

A collection of mutually exclusive events.

Instance Method Summary collapse

Constructor Details

#initialize(events) ⇒ MutuallyExclusiveCollection

create a new collection with the given events



5
6
7
# File 'lib/MutuallyExclusiveCollection.rb', line 5

def initialize(events)
  @events = events.sort
end

Instance Method Details

#favoriteFixedOdds

the most likely of the events to occur



17
18
19
# File 'lib/MutuallyExclusiveCollection.rb', line 17

def favorite
  @events.last
end

#in_ascending_probabilityArray<FixedOdds>

the events in ascending order of probability



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

def in_ascending_probability
  @events
end

#in_descending_probabilityArray<FixedOdds>

the events in descending order of probability



29
30
31
# File 'lib/MutuallyExclusiveCollection.rb', line 29

def in_descending_probability
  @events.reverse
end

#underdogFixedOdds

the least likely of the events to occur



11
12
13
# File 'lib/MutuallyExclusiveCollection.rb', line 11

def underdog
  @events.first
end