Class: Tutorial::Prerequisite
- Inherits:
-
Object
- Object
- Tutorial::Prerequisite
- Defined in:
- lib/nexmo_developer/app/models/tutorial/prerequisite.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #active? ⇒ Boolean
- #description ⇒ Object
-
#initialize(current_step:, code_language:, name:) ⇒ Prerequisite
constructor
A new instance of Prerequisite.
- #load_file! ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(current_step:, code_language:, name:) ⇒ Prerequisite
Returns a new instance of Prerequisite.
6 7 8 9 10 11 |
# File 'lib/nexmo_developer/app/models/tutorial/prerequisite.rb', line 6 def initialize(current_step:, code_language:, name:) @current_step = current_step @code_language = code_language @name = name @file_loader = load_file! end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/nexmo_developer/app/models/tutorial/prerequisite.rb', line 2 def name @name end |
Instance Method Details
#active? ⇒ Boolean
21 22 23 |
# File 'lib/nexmo_developer/app/models/tutorial/prerequisite.rb', line 21 def active? @name == @current_step end |
#description ⇒ Object
17 18 19 |
# File 'lib/nexmo_developer/app/models/tutorial/prerequisite.rb', line 17 def description @description ||= yaml['description'] end |
#load_file! ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/nexmo_developer/app/models/tutorial/prerequisite.rb', line 25 def load_file! Tutorial::FileLoader.new( root: Tutorial.task_content_path, code_language: nil, doc_name: @name, format: 'md' ) end |
#title ⇒ Object
13 14 15 |
# File 'lib/nexmo_developer/app/models/tutorial/prerequisite.rb', line 13 def title @title ||= yaml['title'] end |