Class: Commands::Track::LearningTrack
- Inherits:
-
Object
- Object
- Commands::Track::LearningTrack
- Defined in:
- lib/commands/track/learning_track.rb
Instance Attribute Summary collapse
-
#exercises ⇒ Object
readonly
Returns the value of attribute exercises.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #exercise(name:, path:) ⇒ Object
-
#initialize(name) ⇒ LearningTrack
constructor
A new instance of LearningTrack.
- #validate ⇒ Object
Constructor Details
#initialize(name) ⇒ LearningTrack
Returns a new instance of LearningTrack.
5 6 7 8 |
# File 'lib/commands/track/learning_track.rb', line 5 def initialize(name) @name = name @exercises = [] end |
Instance Attribute Details
#exercises ⇒ Object (readonly)
Returns the value of attribute exercises.
4 5 6 |
# File 'lib/commands/track/learning_track.rb', line 4 def exercises @exercises end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/commands/track/learning_track.rb', line 4 def name @name end |
Instance Method Details
#==(other) ⇒ Object
18 19 20 |
# File 'lib/commands/track/learning_track.rb', line 18 def ==(other) name == other.name && exercises == other.exercises end |
#exercise(name:, path:) ⇒ Object
10 11 12 |
# File 'lib/commands/track/learning_track.rb', line 10 def exercise(name:, path:) exercises << Exercise.new(track: self.name, name: name, path: path) end |
#validate ⇒ Object
14 15 16 |
# File 'lib/commands/track/learning_track.rb', line 14 def validate exercises.each(&:validate) end |