Class: Musa::Sequencer::BaseSequencer::Timeslots
- Inherits:
-
Hash
- Object
- Hash
- Musa::Sequencer::BaseSequencer::Timeslots
- Defined in:
- lib/musa-dsl/sequencer/timeslots.rb
Instance Method Summary collapse
- #[]=(key, value) ⇒ Object
- #delete(key) ⇒ Object
- #first_after(position) ⇒ Object
-
#initialize(*several_variants) ⇒ Timeslots
constructor
A new instance of Timeslots.
Constructor Details
#initialize(*several_variants) ⇒ Timeslots
Returns a new instance of Timeslots.
8 9 10 11 |
# File 'lib/musa-dsl/sequencer/timeslots.rb', line 8 def initialize(*several_variants) super @sorted_keys = SortedSet.new end |
Instance Method Details
#[]=(key, value) ⇒ Object
13 14 15 16 |
# File 'lib/musa-dsl/sequencer/timeslots.rb', line 13 def []=(key, value) super @sorted_keys << key end |
#delete(key) ⇒ Object
18 19 20 21 22 |
# File 'lib/musa-dsl/sequencer/timeslots.rb', line 18 def delete(key) super @sorted_keys.delete key end |
#first_after(position) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/musa-dsl/sequencer/timeslots.rb', line 24 def first_after(position) if position.nil? @sorted_keys.first else @sorted_keys.find { |k| k >= position } end end |