class Hitch::Author

Public Class Methods

add(author_github, author_email) click to toggle source
# File lib/hitch/author.rb, line 4
def self.add(author_github, author_email)
  unless find(author_github)
    available_pairs[author_github] = author_email
  end
end
find(author_github) click to toggle source
# File lib/hitch/author.rb, line 10
def self.find(author_github)
  available_pairs[author_github]
end
write_file() click to toggle source
# File lib/hitch/author.rb, line 14
def self.write_file
  File.open(hitch_pairs, 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/hitch/author.rb, line 26
def self.available_pairs
  @available_pairs ||= get_available_pairs
end
get_available_pairs() click to toggle source
# File lib/hitch/author.rb, line 30
def self.get_available_pairs
  if File.exists?(hitch_pairs)
    yamlized = YAML::load_file(hitch_pairs)
    return yamlized if yamlized.kind_of?(Hash)
  end
  return {}
end
hitch_pairs() click to toggle source
# File lib/hitch/author.rb, line 22
def self.hitch_pairs
  File.expand_path("~/.hitch_pairs")
end