Class: PnoteClient::Documents::Pnote
- Inherits:
-
Object
- Object
- PnoteClient::Documents::Pnote
- Defined in:
- lib/pnote_client/documents/pnote.rb,
lib/pnote_client/documents/pnote/image.rb,
lib/pnote_client/documents/pnote/chapter.rb,
lib/pnote_client/documents/pnote/concept.rb,
lib/pnote_client/documents/pnote/problem.rb,
lib/pnote_client/documents/pnote/sub_chapter.rb,
lib/pnote_client/documents/pnote/teacher_comment.rb
Defined Under Namespace
Classes: Chapter, Concept, Image, Problem, SubChapter, TeacherComment
Instance Attribute Summary collapse
-
#chapters ⇒ Object
readonly
Returns the value of attribute chapters.
-
#images ⇒ Object
readonly
Returns the value of attribute images.
Instance Method Summary collapse
- #add_chapter(new_chapter) ⇒ Object
- #add_image(new_image) ⇒ Object
- #exercise_count ⇒ Object
-
#initialize ⇒ Pnote
constructor
A new instance of Pnote.
- #practice_count ⇒ Object
Constructor Details
#initialize ⇒ Pnote
Returns a new instance of Pnote.
6 7 8 9 |
# File 'lib/pnote_client/documents/pnote.rb', line 6 def initialize() @chapters = [] @images = [] end |
Instance Attribute Details
#chapters ⇒ Object (readonly)
Returns the value of attribute chapters.
4 5 6 |
# File 'lib/pnote_client/documents/pnote.rb', line 4 def chapters @chapters end |
#images ⇒ Object (readonly)
Returns the value of attribute images.
4 5 6 |
# File 'lib/pnote_client/documents/pnote.rb', line 4 def images @images end |
Instance Method Details
#add_chapter(new_chapter) ⇒ Object
11 12 13 |
# File 'lib/pnote_client/documents/pnote.rb', line 11 def add_chapter(new_chapter) @chapters << new_chapter end |
#add_image(new_image) ⇒ Object
15 16 17 |
# File 'lib/pnote_client/documents/pnote.rb', line 15 def add_image(new_image) @images << new_image end |
#exercise_count ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/pnote_client/documents/pnote.rb', line 19 def exercise_count return @chapters.sum do |chapter| chapter.sub_chapters.sum do |sub_chapter| sub_chapter.exercises.count end end end |
#practice_count ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/pnote_client/documents/pnote.rb', line 27 def practice_count return @chapters.sum do |chapter| chapter.sub_chapters.sum do |sub_chapter| sub_chapter.practices.count end end end |