Class: AhoyCaptain::GoalCollection
- Inherits:
-
Object
- Object
- AhoyCaptain::GoalCollection
- Includes:
- Enumerable
- Defined in:
- lib/ahoy_captain/goals.rb
Instance Method Summary collapse
- #[](value) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize ⇒ GoalCollection
constructor
A new instance of GoalCollection.
- #register(goal) ⇒ Object
Constructor Details
#initialize ⇒ GoalCollection
Returns a new instance of GoalCollection.
35 36 37 |
# File 'lib/ahoy_captain/goals.rb', line 35 def initialize @goals = {}.with_indifferent_access end |
Instance Method Details
#[](value) ⇒ Object
47 48 49 |
# File 'lib/ahoy_captain/goals.rb', line 47 def [](value) @goals[value] end |
#each(&block) ⇒ Object
43 44 45 |
# File 'lib/ahoy_captain/goals.rb', line 43 def each(&block) @goals.values.each(&block) end |
#register(goal) ⇒ Object
39 40 41 |
# File 'lib/ahoy_captain/goals.rb', line 39 def register(goal) @goals[goal.id] = goal end |