class PairUp::Participant

Public Class Methods

add(github, email, name) click to toggle source
# File lib/pair-up/participant.rb, line 4
def self.add(github, email, name)
  unless find(github)
    available_pairs[github] = {}
    available_pairs[github]["email"] = email
    available_pairs[github]["name"] = name
  end
end
find(github) click to toggle source
# File lib/pair-up/participant.rb, line 12
def self.find(github)
  available_pairs[github]
end
write_file() click to toggle source
# File lib/pair-up/participant.rb, line 16
def self.write_file
  File.open(pairs_file, File::CREAT|File::TRUNC|File::RDWR, 0644) do |out|
    YAML.dump(available_pairs, out)
  end
end

Private Class Methods

available_pairs() click to toggle source
# File lib/pair-up/participant.rb, line 28
def self.available_pairs
  @available_pairs ||= get_available_pairs
end
get_available_pairs() click to toggle source
# File lib/pair-up/participant.rb, line 32
def self.get_available_pairs
  if File.exists?(pairs_file)
    yamlized = YAML::load_file(pairs_file)
    return yamlized if yamlized.kind_of?(Hash)
  end
  return {}
end
pairs_file() click to toggle source
# File lib/pair-up/participant.rb, line 24
def self.pairs_file
  File.expand_path("~/.pair-up_pairs")
end