class Exercism::Submission

Attributes

file[R]

Public Class Methods

new(file) click to toggle source
# File lib/exercism/submission.rb, line 9
def initialize(file)
  @file = file
end
test?(file) click to toggle source
# File lib/exercism/submission.rb, line 4
def self.test?(file)
  new(file).test?
end

Public Instance Methods

path() click to toggle source
# File lib/exercism/submission.rb, line 13
def path
  File.expand_path(file)
end
test?() click to toggle source
# File lib/exercism/submission.rb, line 17
def test?
  test_identifiers.any? do |_, suffix|
    file.end_with?(suffix)
  end
end
test_identifiers() click to toggle source
# File lib/exercism/submission.rb, line 23
def test_identifiers
  {
    :ruby => '_test.rb',
    :js => '.spec.js',
    :elixir => '_test.exs',
    :clojure => '_test.clj',
    :python => '_test.py',
    :go => '_test.go',
    :haskell => '_test.hs',
  }
end