Class: Exercism::Submission
- Inherits:
-
Object
- Object
- Exercism::Submission
- Defined in:
- lib/exercism/submission.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(file) ⇒ Submission
constructor
A new instance of Submission.
- #path ⇒ Object
- #test? ⇒ Boolean
- #test_identifiers ⇒ Object
Constructor Details
#initialize(file) ⇒ Submission
Returns a new instance of Submission.
9 10 11 |
# File 'lib/exercism/submission.rb', line 9 def initialize(file) @file = file end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
8 9 10 |
# File 'lib/exercism/submission.rb', line 8 def file @file end |
Class Method Details
.test?(file) ⇒ Boolean
4 5 6 |
# File 'lib/exercism/submission.rb', line 4 def self.test?(file) new(file).test? end |
Instance Method Details
#path ⇒ Object
13 14 15 |
# File 'lib/exercism/submission.rb', line 13 def path File.(file) end |
#test? ⇒ Boolean
17 18 19 20 21 |
# File 'lib/exercism/submission.rb', line 17 def test? test_identifiers.any? do |_, suffix| file.end_with?(suffix) end end |
#test_identifiers ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# 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 |