class MyEpisodes::Dump
Public Class Methods
new(client, output, options={})
click to toggle source
# File lib/my_episodes/dump.rb, line 5 def initialize(client, output, options={}) @client = client @output = output @separator = options.fetch(:separator, ';') end
Public Instance Methods
execute()
click to toggle source
# File lib/my_episodes/dump.rb, line 11 def execute @output.puts(headers.join(@separator)) @client.shows.each do |show| show.seasons.each do |season| season.episodes.each do |episode| @output.puts(to_line(show, season, episode).join(@separator)) end end end end
Private Instance Methods
headers()
click to toggle source
# File lib/my_episodes/dump.rb, line 28 def headers @headers ||= %w[show season number episode_name acquired watched].freeze end
to_line(s, se, e)
click to toggle source
# File lib/my_episodes/dump.rb, line 24 def to_line(s, se, e) [s.name, se.name, e.number, e.name, e.acquired?, e.watched?] end