Class: Bumbleworks::ParticipantRegistration

Inherits:
Object
  • Object
show all
Defined in:
lib/bumbleworks/participant_registration.rb

Class Method Summary collapse

Class Method Details

.autoload_all(options = {}) ⇒ Object

Autoload all participant classes defined in files in the participants_directory. The symbol for autoload comes from the camelized version of the filename, so this method is dependent on following that convention. For example, file ‘goat_challenge.rb` should define `GoatChallenge`.



11
12
13
14
15
16
17
# File 'lib/bumbleworks/participant_registration.rb', line 11

def autoload_all(options = {})
  if directory = options[:directory] || Bumbleworks.participants_directory
    Bumbleworks::Support.all_files(directory, :camelize => true).each do |path, name|
      Object.autoload name.to_sym, path
    end
  end
end

.register!(options = {}) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/bumbleworks/participant_registration.rb', line 19

def register!(options = {})
  if file = options[:file] || Bumbleworks.participant_registration_file
    Kernel.load file
  else
    Bumbleworks.register_default_participants
  end
end