Class: Set
- Inherits:
-
Object
- Object
- Set
- Defined in:
- lib/axiom_of_choice.rb
Instance Method Summary collapse
-
#pick ⇒ Object
Picks an arbitrary element from the set and returns it.
-
#pop ⇒ Object
Picks an arbitrary element from the set and deletes it.
Instance Method Details
#pick ⇒ Object
Picks an arbitrary element from the set and returns it. Use pop
to pick and delete simultaneously.
5 6 7 |
# File 'lib/axiom_of_choice.rb', line 5 def pick @hash.first.first end |
#pop ⇒ Object
Picks an arbitrary element from the set and deletes it. Use pick
to pick without deletion.
11 12 13 14 15 |
# File 'lib/axiom_of_choice.rb', line 11 def pop key = pick @hash.delete(key) key end |