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.1.0.7 tracks/ruby/lib/tasks/exercise.rb
trackler-2.1.0.6 tracks/ruby/lib/tasks/exercise.rb
trackler-2.1.0.5 tracks/ruby/lib/tasks/exercise.rb
trackler-2.1.0.4 tracks/ruby/lib/tasks/exercise.rb
trackler-2.1.0.3 tracks/ruby/lib/tasks/exercise.rb
trackler-2.1.0.2 tracks/ruby/lib/tasks/exercise.rb
trackler-2.1.0.1 tracks/ruby/lib/tasks/exercise.rb
trackler-2.1.0.0 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.55 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.54 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.53 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.52 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.51 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.50 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.49 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.48 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.47 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.46 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.45 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.44 tracks/ruby/lib/tasks/exercise.rb