Class: Daigaku::Chapter
- Inherits:
-
Object
- Object
- Daigaku::Chapter
- Defined in:
- lib/daigaku/chapter.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(path) ⇒ Chapter
constructor
A new instance of Chapter.
- #mastered? ⇒ Boolean
- #started? ⇒ Boolean
- #units ⇒ Object
Constructor Details
#initialize(path) ⇒ Chapter
Returns a new instance of Chapter.
5 6 7 8 |
# File 'lib/daigaku/chapter.rb', line 5 def initialize(path) @path = path @title = File.basename(path).gsub(/\_+/, ' ') end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/daigaku/chapter.rb', line 3 def path @path end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
3 4 5 |
# File 'lib/daigaku/chapter.rb', line 3 def title @title end |
Instance Method Details
#mastered? ⇒ Boolean
18 19 20 |
# File 'lib/daigaku/chapter.rb', line 18 def mastered? units.all?(&:mastered?) end |
#started? ⇒ Boolean
14 15 16 |
# File 'lib/daigaku/chapter.rb', line 14 def started? units.any?(&:mastered?) end |