Class: AnalyzedClass
- Inherits:
-
Object
- Object
- AnalyzedClass
- Defined in:
- lib/AnalyzedClass.rb
Instance Method Summary collapse
- #addFunction(name, numLines) ⇒ Object
- #addTestedFunction(function) ⇒ Object
- #addVariable(variable) ⇒ Object
- #fileName ⇒ Object
- #fileName=(fileName) ⇒ Object
- #functions ⇒ Object
-
#initialize ⇒ AnalyzedClass
constructor
A new instance of AnalyzedClass.
- #isLineWithTestedFunction(line) ⇒ Object
- #isTestedFunctionInArray(functionName) ⇒ Object
- #name ⇒ Object
- #name=(name) ⇒ Object
- #numberOfLines ⇒ Object
- #numberOfLines=(numberOfLines) ⇒ Object
- #numberOfLinesTested ⇒ Object
- #testedFunctions ⇒ Object
- #variables ⇒ Object
- #variablesWithType ⇒ Object
Constructor Details
#initialize ⇒ AnalyzedClass
Returns a new instance of AnalyzedClass.
5 6 7 8 9 10 |
# File 'lib/AnalyzedClass.rb', line 5 def initialize @functions = Array.new @variables = Array.new @testedFunctions = Array.new @numberOfLines = 0 end |
Instance Method Details
#addFunction(name, numLines) ⇒ Object
12 13 14 |
# File 'lib/AnalyzedClass.rb', line 12 def addFunction (name, numLines) @functions.push(Function.new(name, numLines)) end |
#addTestedFunction(function) ⇒ Object
20 21 22 23 24 |
# File 'lib/AnalyzedClass.rb', line 20 def addTestedFunction function if !(isTestedFunctionInArray function.name) @testedFunctions.push(function) end end |
#addVariable(variable) ⇒ Object
16 17 18 |
# File 'lib/AnalyzedClass.rb', line 16 def addVariable variable @variables.push(variable) end |
#fileName ⇒ Object
81 82 83 |
# File 'lib/AnalyzedClass.rb', line 81 def fileName @fileName end |
#fileName=(fileName) ⇒ Object
85 86 87 |
# File 'lib/AnalyzedClass.rb', line 85 def fileName=(fileName) @fileName = fileName end |
#functions ⇒ Object
44 45 46 |
# File 'lib/AnalyzedClass.rb', line 44 def functions @functions end |
#isLineWithTestedFunction(line) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/AnalyzedClass.rb', line 35 def isLineWithTestedFunction line for function in @testedFunctions if line.include? function.name return true end end return false end |
#isTestedFunctionInArray(functionName) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/AnalyzedClass.rb', line 26 def isTestedFunctionInArray functionName for function in @testedFunctions if function.name == functionName return true end end return false end |
#name ⇒ Object
56 57 58 |
# File 'lib/AnalyzedClass.rb', line 56 def name @name end |
#name=(name) ⇒ Object
76 77 78 79 |
# File 'lib/AnalyzedClass.rb', line 76 def name=(name) name = name.strip @name = name end |
#numberOfLines ⇒ Object
64 65 66 |
# File 'lib/AnalyzedClass.rb', line 64 def numberOfLines @numberOfLines end |
#numberOfLines=(numberOfLines) ⇒ Object
60 61 62 |
# File 'lib/AnalyzedClass.rb', line 60 def numberOfLines=(numberOfLines) @numberOfLines = numberOfLines end |
#numberOfLinesTested ⇒ Object
68 69 70 71 72 73 74 |
# File 'lib/AnalyzedClass.rb', line 68 def numberOfLinesTested count = 0 for function in @testedFunctions count += function.numLines end return count end |
#testedFunctions ⇒ Object
52 53 54 |
# File 'lib/AnalyzedClass.rb', line 52 def testedFunctions @testedFunctions end |
#variables ⇒ Object
48 49 50 |
# File 'lib/AnalyzedClass.rb', line 48 def variables @variables end |
#variablesWithType ⇒ Object
89 90 91 92 93 94 95 96 97 |
# File 'lib/AnalyzedClass.rb', line 89 def variablesWithType varsWithType = Array.new for vari in @variables if vari.type != nil varsWithType.push(vari) end end return varsWithType end |