Class: Commands::Track::LearningTrack

Inherits:
Object
  • Object
show all
Defined in:
lib/commands/track/learning_track.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#exercisesObject (readonly)

Returns the value of attribute exercises.



4
5
6
# File 'lib/commands/track/learning_track.rb', line 4

def exercises
  @exercises
end

#nameObject (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

#validateObject



14
15
16
# File 'lib/commands/track/learning_track.rb', line 14

def validate
  exercises.each(&:validate)
end