class TEF::ProgramSelection::ProgramSheet

Convenience class. Mainly extends {Sequencing::Sheet} with an {#add_key} function, which self-registers this program under the last created {SequenceCollection}.

Attributes

program_key[RW]

Optional key to use when passing to {Sequencing::Player#[]=}. Different keys are necessary to not overwrite the previous running program.

Public Class Methods

new() { |self| ... } click to toggle source
Calls superclass method TEF::Sequencing::Sheet::new
# File lib/tef/ProgramSelection/SequenceCollection.rb, line 119
def initialize()
        super()

        yield(self) if block_given?
end

Public Instance Methods

add_key(title, groups = [], variation = '.mp3', options = nil) click to toggle source

Register this sheet under a given key. Syntax is the same as {Selector#register_ID}, with a default variant of '.mp3' to comply with the default variant set by {SoundCollection}.

# File lib/tef/ProgramSelection/SequenceCollection.rb, line 129
def add_key(title, groups = [], variation = '.mp3', options = nil)
        prog_collection = SequenceCollection.current_collection
        raise "No program collection was instantiated yet!" unless prog_collection

        id = ID.new(title, groups, variation)

        prog_collection[id] = self

        prog_collection.sheet_opts[id] = options if options.is_a? Hash
end