Sha256: 1335d7d2c914caccb0a7bc0867db78d34c28abc487eb7c39c1ff27f0446bd858

Contents?: true

Size: 485 Bytes

Versions: 2

Compression:

Stored size: 485 Bytes

Contents

module Daigaku
  class Course

    attr_reader :title, :path, :author, :link

    def initialize(path)
      @path = path
      @title = File.basename(path).gsub(/\_+/, ' ')
    end

    def chapters
      @chapters ||= Loading::Chapters.load(@path)
    end

    def started?
      chapters.reduce(false) { |started, chapter| started ||= chapter.started? }
    end

    def mastered?
      chapters.reduce(true) { |mastered, chapter| mastered &&= chapter.mastered? }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
daigaku-0.0.2 lib/daigaku/course.rb
daigaku-0.0.1 lib/daigaku/course.rb