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.22 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.21 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.20 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.19 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.18 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.17 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.16 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.15 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.14 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.13 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.12 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.11 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.10 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.9 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.8 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.7 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.6 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.5 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.4 tracks/ruby/lib/tasks/exercise.rb
trackler-2.0.8.3 tracks/ruby/lib/tasks/exercise.rb