Class: HS::Module
- Inherits:
-
Object
- Object
- HS::Module
- Extended by:
- ModuleLoader
- Includes:
- ContentPreview, ReviewStatus
- Defined in:
- lib/hs/models/module.rb
Constant Summary
Constants included from ModuleLoader
HS::ModuleLoader::CUSTOM_LOADERS
Constants included from ReviewStatus
Constants included from ReviewStatusPreview
ReviewStatusPreview::REVIEW_COLOR, ReviewStatusPreview::REVIEW_ICON, ReviewStatusPreview::REVIEW_TITLE
Instance Attribute Summary collapse
-
#chapter ⇒ Object
readonly
Returns the value of attribute chapter.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#intro ⇒ Object
Returns the value of attribute intro.
-
#slug ⇒ Object
Returns the value of attribute slug.
-
#title ⇒ Object
Returns the value of attribute title.
Attributes included from ReviewStatus
Class Method Summary collapse
Instance Method Summary collapse
-
#hs_url ⇒ Object
URL of this module when published.
-
#initialize(chapter, args) ⇒ Module
constructor
A new instance of Module.
Methods included from ModuleLoader
Methods included from ElementLoader
Methods included from XMLParser
Methods included from ContentPreview
Methods included from ReviewStatusPreview
#review_color, #review_icon, #review_title
Constructor Details
#initialize(chapter, args) ⇒ Module
Returns a new instance of Module.
20 21 22 23 24 25 26 27 |
# File 'lib/hs/models/module.rb', line 20 def initialize(chapter, args) @chapter = chapter @content = [] args.each do |key, val| instance_variable_set("@#{key}", val) end end |
Instance Attribute Details
#chapter ⇒ Object (readonly)
Returns the value of attribute chapter.
13 14 15 |
# File 'lib/hs/models/module.rb', line 13 def chapter @chapter end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
13 14 15 |
# File 'lib/hs/models/module.rb', line 13 def content @content end |
#intro ⇒ Object
Returns the value of attribute intro.
14 15 16 |
# File 'lib/hs/models/module.rb', line 14 def intro @intro end |
#slug ⇒ Object
Returns the value of attribute slug.
14 15 16 |
# File 'lib/hs/models/module.rb', line 14 def slug @slug end |
#title ⇒ Object
Returns the value of attribute title.
14 15 16 |
# File 'lib/hs/models/module.rb', line 14 def title @title end |
Class Method Details
.load(chapter, file) ⇒ Object
16 17 18 |
# File 'lib/hs/models/module.rb', line 16 def self.load(chapter, file) load_module(chapter, File.read(file)) end |
Instance Method Details
#hs_url ⇒ Object
URL of this module when published.
30 31 32 |
# File 'lib/hs/models/module.rb', line 30 def hs_url "#{chapter.hs_url}/#{slug}" end |