Module: Mexico::Constants::ParticipantRoles

Defined in:
lib/mexico/constants.rb

Overview

This module lists all participant roles that are part of the current MExiCo model.

Constant Summary collapse

NAIVE =

A naive participant who does not have additional background information about the experiment

Mexico::FileSystem::ParticipantRole.new :identifier =>'naive',       :name => 'Naive Participant'
CONFEDERATE =

A participant who has been instructed and informed about the experiment in at least one aspect, and who pretends to be naive to other participants

Mexico::FileSystem::ParticipantRole.new :identifier =>'confederate', :name => 'Confederate'
OTHER =

container for all other roles

Mexico::FileSystem::ParticipantRole.new :identifier =>'other-participant-role', :name => 'Other'
ALL =

A collection of all participant roles currently predefined.

Array.new

Class Method Summary collapse

Class Method Details

.get(key) ⇒ Mexico::FileSystem::ParticipantRole?

retrieves a participant role object by its key.

Parameters:

  • key (String)

    The key of the needed participant role.

Returns:



47
48
49
# File 'lib/mexico/constants.rb', line 47

def self.get(key)
  ::Mexico::Constants::ParticipantRoles::ALL.first{ |x| x.identifier==key}  
end

.has?(key) ⇒ true, false

checks for the existence of a predefined participant role object.

Parameters:

  • key (String)

    The key of the needed participant role.

Returns:

  • (true, false)

    true iff such a participant role object exists, false otherwise.



54
55
56
# File 'lib/mexico/constants.rb', line 54

def self.has?(key)
  ::Mexico::Constants::ParticipantRoles::ALL.select{ |x| x.identifier==key}.size>0
end