Sha256: 103dcef2ac1729146172d7ad5fddad67bf795c3f40d189f100b513674d700eca
Contents?: true
Size: 848 Bytes
Versions: 1
Compression:
Stored size: 848 Bytes
Contents
module GetHappy extend self @urls = %w( https://www.youtube.com/watch?v=s3Q80mk7bxE https://www.youtube.com/watch?v=LxDhlzJR4XQ https://www.youtube.com/watch?v=HqYnevHibaI https://www.youtube.com/watch?v=8kMZcA5oEAA ) COLLECTION_DIR = Dir.home + '/.get_happy' COLLECTION = COLLECTION_DIR + "/collection.yml" def write_collection(collection) collection = collection.compact.uniq File.open(COLLECTION, "w") do |file| file.write collection.to_yaml end end def seed write_collection get_collection + @urls end def get_collection unless File.directory?(COLLECTION_DIR) FileUtils.mkdir_p(COLLECTION_DIR) end File.open(COLLECTION, "w+") do |file| file.write [].to_yaml end unless File.file?(COLLECTION) YAML::load_file(COLLECTION) || [] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
get_happy-0.0.1 | lib/get_happy/engine.rb |