Class: DmtdVbmappData::GuideChapter
- Inherits:
-
Object
- Object
- DmtdVbmappData::GuideChapter
- Defined in:
- lib/dmtd_vbmapp_data/guide_chapter.rb
Overview
Provides for the retrieving of VB-MAPP Guide chapters from the VB-MAPP Data Server.
Instance Attribute Summary collapse
-
#chapter_num ⇒ Object
readonly
Returns the value of attribute chapter_num.
-
#chapter_title ⇒ String
readonly
The title of the chapter.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#content ⇒ String
The preamble of the Guide’s chapter.
-
#initialize(opts) ⇒ GuideChapter
constructor
Creates an accessor for the VB-MAPP Guide Chapter on the VB-MAPP Data Server.
-
#sections ⇒ Array<GuideChapterSection>
All of the the VB-MAPP Guide’s GuideChapterSection instances.
Constructor Details
#initialize(opts) ⇒ GuideChapter
This method does not block, simply creates an accessor and returns
Creates an accessor for the VB-MAPP Guide Chapter on the VB-MAPP Data Server
28 29 30 31 32 33 34 35 36 |
# File 'lib/dmtd_vbmapp_data/guide_chapter.rb', line 28 def initialize(opts) @client = opts.fetch(:client) @chapter_num = opts.fetch(:chapter_num).to_i index_json = opts.fetch(:chapter_index_json) @title = index_json[:title] @sections_index = index_json[:sections] end |
Instance Attribute Details
#chapter_num ⇒ Object (readonly)
Returns the value of attribute chapter_num.
14 15 16 |
# File 'lib/dmtd_vbmapp_data/guide_chapter.rb', line 14 def chapter_num @chapter_num end |
#chapter_title ⇒ String (readonly)
Returns the title of the chapter.
18 |
# File 'lib/dmtd_vbmapp_data/guide_chapter.rb', line 18 attr_reader :title |
#client ⇒ Object (readonly)
Returns the value of attribute client.
10 11 12 |
# File 'lib/dmtd_vbmapp_data/guide_chapter.rb', line 10 def client @client end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
18 19 20 |
# File 'lib/dmtd_vbmapp_data/guide_chapter.rb', line 18 def title @title end |
Instance Method Details
#content ⇒ String
This method does block as the content is retrieved
Returns The preamble of the Guide’s chapter.
41 42 43 44 45 |
# File 'lib/dmtd_vbmapp_data/guide_chapter.rb', line 41 def content @content = retrieve_guide_chapter[:content] if @content.nil? @content end |
#sections ⇒ Array<GuideChapterSection>
This method does not block
Returns all of the the VB-MAPP Guide’s DmtdVbmappData::GuideChapterSection instances.
50 51 52 53 54 55 56 |
# File 'lib/dmtd_vbmapp_data/guide_chapter.rb', line 50 def sections @sections = @sections_index.map.with_index do |section_index_json, section_num| GuideChapterSection.new(client: client, chapter_num: chapter_num, section_num: section_num, section_index_json: section_index_json) end if @sections.nil? @sections end |