Sha256: 8d74706af29ce1825a3a16763a4a7377ded573aafe95248181f936f5c7955700
Contents?: true
Size: 980 Bytes
Versions: 2
Compression:
Stored size: 980 Bytes
Contents
require_relative "watchbuffy/version" require "json" module Watchbuffy EPISODES = JSON.parse(File.read(__dir__ + "/../data/buffyverse-episodes.json"))["episodes"] BUFFY_SEASONS = [1, 2, 3, 4, 5, 6, 7] ANGEL_SEASONS = [1, 2, 3, 4, 5] class << self def pick(show: %w[buffy angel], buffy_season: BUFFY_SEASONS, angel_season: ANGEL_SEASONS) episode = EPISODES.select{ |e| show.include?(e["show"]) && ( e["show"] == "buffy" && Array(buffy_season).include?(e["season"]) || e["show"] == "angel" && Array(angel_season).include?(e["season"]) ) }.sample if episode watch(episode) else puts "No episode found" end end private def watch(episode) puts \ '▶️ Watch %s episode %s×%s: "%s"' % [ episode["show"].capitalize, episode["season"], episode["numberInSeason"], episode["title"], ] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
watchbuffy-1.0.1 | lib/watchbuffy.rb |
watchbuffy-1.0.0 | lib/watchbuffy.rb |