Class: ZedTestToggle::Project
- Inherits:
-
Object
- Object
- ZedTestToggle::Project
- Defined in:
- lib/zed_test_toggle/project.rb
Instance Attribute Summary collapse
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
-
#initialize(root) ⇒ Project
constructor
A new instance of Project.
- #src_paths ⇒ Object
- #test_anchor ⇒ Object
- #test_paths ⇒ Object
- #test_regexes ⇒ Object
- #testify(path) ⇒ Object
Constructor Details
Instance Attribute Details
#root ⇒ Object (readonly)
Returns the value of attribute root.
5 6 7 |
# File 'lib/zed_test_toggle/project.rb', line 5 def root @root end |
Instance Method Details
#src_paths ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/zed_test_toggle/project.rb', line 11 def src_paths if gem? ["lib", ""] else ["app", "lib"] end end |
#test_anchor ⇒ Object
23 24 25 |
# File 'lib/zed_test_toggle/project.rb', line 23 def test_anchor spec? ? "spec" : "test" end |
#test_paths ⇒ Object
19 20 21 |
# File 'lib/zed_test_toggle/project.rb', line 19 def test_paths [test_anchor, File.join(test_anchor, "lib")] end |
#test_regexes ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/zed_test_toggle/project.rb', line 27 def test_regexes if spec? [/_spec\.rb$/] else [/_test\.rb$/, /test_[a-zA-Z0-9_]*\.rb$/] end end |
#testify(path) ⇒ Object
35 36 37 |
# File 'lib/zed_test_toggle/project.rb', line 35 def testify(path) path.gsub(/\.rb$/, test_suffix) end |