Sha256: 0ac513f7b4cd51ee8344fd241e139df2898439c7c0da283048c37b5deafa2b9d
Contents?: true
Size: 810 Bytes
Versions: 1
Compression:
Stored size: 810 Bytes
Contents
# frozen_string_literal: true require 'hs/loaders/chapter_loader' require 'hs/preview/chapter_preview' module HS class Chapter extend HS::ChapterLoader include HS::ChapterPreview REVIEW_STATUSES = %w[none translated first second final].freeze def self.load(course, file) load_chapter(course, File.read(file)) end attr_reader :course, :content attr_accessor :slug, :title, :intro attr_writer :review_status def initialize(course, args) @course = course @content = [] args.each do |key, val| instance_variable_set("@#{key}", val) end end def review_status return 'none' unless REVIEW_STATUSES.include?(@review_status) @review_status end def hs_url "#{course.hs_url}/#{slug}" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hs-cli-0.2.2 | lib/hs/models/chapter.rb |