Sha256: e7dc8401d171a2b445762339d182cb5909ae6347c5488ea391cc3266f0d3e818

Contents?: true

Size: 595 Bytes

Versions: 98

Compression:

Stored size: 595 Bytes

Contents

class Exercise
  class << self
    def all
      exercise_names.map { |e| new(e) }
    end

    private

    def exercise_names
      FileList['exercises/*'].pathmap('%f').exclude('TRACK_HINTS.md')
    end
  end

  attr_reader :name
  alias :to_s :name

  def initialize(name)
    @name = name
  end

  def directory
    "exercises/#{name}/."
  end

  def example_file
    'example.rb'
  end

  def testable_example_file
    "#{base_file_name}.rb"
  end

  def test_file
    "#{base_file_name}_test.rb"
  end

  private

  def base_file_name
    @_base_file_name ||= name.tr('-', '_')
  end
end

Version data entries

98 entries across 98 versions & 1 rubygems

Version Path
trackler-2.0.8.43 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.42 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.41 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.40 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.39 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.38 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.37 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.36 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.35 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.34 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.33 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.32 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.31 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.30 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.29 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.28 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.27 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.26 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.24 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.23 tracks/ruby/lib/tasks/exercise.rb