class Topic

Attributes

day[R]
description[R]
phase[R]
week[R]

Public Class Methods

all() click to toggle source
# File lib/dbc_today/models/topic.rb, line 11
def self.all
  list = []
  
  CSV.foreach(
    "#{current_directory}/../data/topics.csv",
    headers: true,
    header_converters: :symbol,
    skip_blanks: true
  ) do |row|
    list << Topic.new(row)
  end

  list
end
current_directory() click to toggle source
# File lib/dbc_today/models/topic.rb, line 34
def self.current_directory
  File.expand_path File.dirname(__FILE__)
end
new(attributes) click to toggle source
# File lib/dbc_today/models/topic.rb, line 4
def initialize(attributes)
  @phase = attributes.fetch(:phase)
  @week = attributes.fetch(:week)
  @day = attributes.fetch(:day)
  @description = attributes.fetch(:description)
end
where(args) click to toggle source
# File lib/dbc_today/models/topic.rb, line 26
def self.where(args)
  all.select { |topic|
    topic.phase == args[:phase] &&
      topic.week == args[:week] &&
      topic.day == args[:day]
  }
end