# frozen_string_literal: true require 'hs/loaders/chapter_loader' require 'hs/preview/chapter_preview' module HS class Chapter extend HS::ChapterLoader include HS::ChapterPreview def self.load(course, file) load_chapter(course, File.read(file)) end attr_reader :course, :content attr_accessor :slug, :title, :intro def initialize(course, args) @course = course @content = [] args.each do |key, val| instance_variable_set("@#{key}", val) end end def hs_url "#{course.hs_url}/#{slug}" end end end