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.6.27 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.6.26 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.6.25 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.6.24 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.6.23 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.6.22 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.6.21 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.6.20 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.6.19 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.6.18 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.6.17 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.6.16 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.6.15 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.6.14 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.6.13 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.6.12 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.6.11 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.6.10 tracks/ruby/lib/tasks/exercise.rb