Class: MutuallyExclusiveCollection
- Inherits:
-
Object
- Object
- MutuallyExclusiveCollection
- Defined in:
- lib/MutuallyExclusiveCollection.rb
Overview
A collection of mutually exclusive events.
Instance Method Summary collapse
-
#favorite ⇒ FixedOdds
the most likely of the events to occur.
-
#in_ascending_probability ⇒ Array<FixedOdds>
the events in ascending order of probability.
-
#in_descending_probability ⇒ Array<FixedOdds>
the events in descending order of probability.
-
#initialize(events) ⇒ MutuallyExclusiveCollection
constructor
create a new collection with the given events.
-
#underdog ⇒ FixedOdds
the least likely of the events to occur.
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
#favorite ⇒ FixedOdds
the most likely of the events to occur
17 18 19 |
# File 'lib/MutuallyExclusiveCollection.rb', line 17 def favorite @events.last end |
#in_ascending_probability ⇒ Array<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_probability ⇒ Array<FixedOdds>
the events in descending order of probability
29 30 31 |
# File 'lib/MutuallyExclusiveCollection.rb', line 29 def in_descending_probability @events.reverse end |
#underdog ⇒ FixedOdds
the least likely of the events to occur
11 12 13 |
# File 'lib/MutuallyExclusiveCollection.rb', line 11 def underdog @events.first end |