Class: Semilla::TestCaseFile
- Inherits:
-
Object
- Object
- Semilla::TestCaseFile
- Defined in:
- lib/semilla/test_runner.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
-
#import ⇒ Object
The import statement for this class.
-
#initialize(fpath) ⇒ TestCaseFile
constructor
Constructor.
-
#name ⇒ Object
The file name without extension.
-
#package ⇒ Object
Get the package name from the contents of the file.
Constructor Details
#initialize(fpath) ⇒ TestCaseFile
Constructor. The parameter should be a string from rake
9 10 11 |
# File 'lib/semilla/test_runner.rb', line 9 def initialize(fpath) @path = fpath end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
6 7 8 |
# File 'lib/semilla/test_runner.rb', line 6 def path @path end |
Instance Method Details
#import ⇒ Object
The import statement for this class
40 41 42 43 44 45 46 |
# File 'lib/semilla/test_runner.rb', line 40 def import if self.package != "" return "#{self.package}.#{self.name}" else return self.name end end |
#name ⇒ Object
The file name without extension
15 16 17 |
# File 'lib/semilla/test_runner.rb', line 15 def name @path.pathmap '%n' end |
#package ⇒ Object
Get the package name from the contents of the file
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/semilla/test_runner.rb', line 21 def package if !@_package #Open the file File.open @path do |io| io.each do |line| #Search for the package name if line =~ /^package (.*)/ @_package = $1.rstrip end end #no package name found, set to empty string @_package = "" if !@_package end end return @_package end |