Class: FlightControl::IdentifiedElements
- Inherits:
-
Object
- Object
- FlightControl::IdentifiedElements
- Includes:
- Enumerable
- Defined in:
- lib/flight_control/identified_elements.rb
Overview
A collection of elements offering a Hash-like access based on
their id.
Direct Known Subclasses
Instance Method Summary collapse
- #<<(item) ⇒ Object
-
#initialize ⇒ IdentifiedElements
constructor
A new instance of IdentifiedElements.
- #to_a ⇒ Object
Constructor Details
#initialize ⇒ IdentifiedElements
Returns a new instance of IdentifiedElements.
9 10 11 |
# File 'lib/flight_control/identified_elements.rb', line 9 def initialize @elements = HashWithIndifferentAccess.new end |
Instance Method Details
#<<(item) ⇒ Object
13 14 15 |
# File 'lib/flight_control/identified_elements.rb', line 13 def <<(item) @elements[item.id] = item end |
#to_a ⇒ Object
17 18 19 |
# File 'lib/flight_control/identified_elements.rb', line 17 def to_a @elements.values end |