Class: LearnOpen::Lessons::BaseLesson
- Inherits:
-
Object
- Object
- LearnOpen::Lessons::BaseLesson
- Defined in:
- lib/learn_open/lessons/base_lesson.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#dot_learn ⇒ Object
readonly
Returns the value of attribute dot_learn.
-
#environment_vars ⇒ Object
readonly
Returns the value of attribute environment_vars.
-
#git_server ⇒ Object
readonly
Returns the value of attribute git_server.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#io ⇒ Object
readonly
Returns the value of attribute io.
-
#later_lesson ⇒ Object
readonly
Returns the value of attribute later_lesson.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#organization ⇒ Object
readonly
Returns the value of attribute organization.
-
#platform ⇒ Object
readonly
Returns the value of attribute platform.
-
#repo_path ⇒ Object
readonly
Returns the value of attribute repo_path.
-
#system_adapter ⇒ Object
readonly
Returns the value of attribute system_adapter.
-
#use_student_fork ⇒ Object
readonly
Returns the value of attribute use_student_fork.
Instance Method Summary collapse
-
#initialize(lesson_data, options = {}) ⇒ BaseLesson
constructor
A new instance of BaseLesson.
- #lab? ⇒ Boolean
- #readme? ⇒ Boolean
- #to_path ⇒ Object
- #to_url ⇒ Object
Constructor Details
#initialize(lesson_data, options = {}) ⇒ BaseLesson
Returns a new instance of BaseLesson.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/learn_open/lessons/base_lesson.rb', line 20 def initialize(lesson_data, = {}) lesson = lesson_data[:lesson] @repo_path = lesson.clone_repo @organization, @name = repo_path.split('/') @git_server = lesson.git_server @dot_learn = lesson.dot_learn @is_lab = lesson.lab @use_student_fork = lesson.use_student_fork @later_lesson = lesson_data[:later_lesson] @id = lesson_data[:id] @logger = .fetch(:logger, LearnOpen.logger) @io = .fetch(:io, LearnOpen.default_io) @system_adapter = .fetch(:system_adapter, LearnOpen.system_adapter) @platform = .fetch(:platform, LearnOpen.platform) @environment_vars = .fetch(:environment_vars, LearnOpen.environment_vars) @location = .fetch(:lessons_directory) {LearnOpen.lessons_directory} = end |
Instance Attribute Details
#dot_learn ⇒ Object (readonly)
Returns the value of attribute dot_learn.
4 5 6 |
# File 'lib/learn_open/lessons/base_lesson.rb', line 4 def dot_learn @dot_learn end |
#environment_vars ⇒ Object (readonly)
Returns the value of attribute environment_vars.
4 5 6 |
# File 'lib/learn_open/lessons/base_lesson.rb', line 4 def environment_vars @environment_vars end |
#git_server ⇒ Object (readonly)
Returns the value of attribute git_server.
4 5 6 |
# File 'lib/learn_open/lessons/base_lesson.rb', line 4 def git_server @git_server end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/learn_open/lessons/base_lesson.rb', line 4 def id @id end |
#io ⇒ Object (readonly)
Returns the value of attribute io.
4 5 6 |
# File 'lib/learn_open/lessons/base_lesson.rb', line 4 def io @io end |
#later_lesson ⇒ Object (readonly)
Returns the value of attribute later_lesson.
4 5 6 |
# File 'lib/learn_open/lessons/base_lesson.rb', line 4 def later_lesson @later_lesson end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
4 5 6 |
# File 'lib/learn_open/lessons/base_lesson.rb', line 4 def location @location end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
4 5 6 |
# File 'lib/learn_open/lessons/base_lesson.rb', line 4 def logger @logger end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/learn_open/lessons/base_lesson.rb', line 4 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/learn_open/lessons/base_lesson.rb', line 4 def end |
#organization ⇒ Object (readonly)
Returns the value of attribute organization.
4 5 6 |
# File 'lib/learn_open/lessons/base_lesson.rb', line 4 def organization @organization end |
#platform ⇒ Object (readonly)
Returns the value of attribute platform.
4 5 6 |
# File 'lib/learn_open/lessons/base_lesson.rb', line 4 def platform @platform end |
#repo_path ⇒ Object (readonly)
Returns the value of attribute repo_path.
4 5 6 |
# File 'lib/learn_open/lessons/base_lesson.rb', line 4 def repo_path @repo_path end |
#system_adapter ⇒ Object (readonly)
Returns the value of attribute system_adapter.
4 5 6 |
# File 'lib/learn_open/lessons/base_lesson.rb', line 4 def system_adapter @system_adapter end |
#use_student_fork ⇒ Object (readonly)
Returns the value of attribute use_student_fork.
4 5 6 |
# File 'lib/learn_open/lessons/base_lesson.rb', line 4 def use_student_fork @use_student_fork end |
Instance Method Details
#lab? ⇒ Boolean
42 43 44 |
# File 'lib/learn_open/lessons/base_lesson.rb', line 42 def lab? @is_lab end |
#readme? ⇒ Boolean
46 47 48 |
# File 'lib/learn_open/lessons/base_lesson.rb', line 46 def readme? !lab? end |
#to_path ⇒ Object
50 51 52 |
# File 'lib/learn_open/lessons/base_lesson.rb', line 50 def to_path "#{location}/#{name}" end |
#to_url ⇒ Object
54 55 56 |
# File 'lib/learn_open/lessons/base_lesson.rb', line 54 def to_url "https://learn.co/lessons/#{id}" end |