Class: TestInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/test_info.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTestInfo

Returns a new instance of TestInfo.



5
6
7
8
9
10
11
12
# File 'lib/test_info.rb', line 5

def initialize
  @achievements = []
  @level = 1
  @xp = 0
  @number_of_tests = 0
  @number_of_failed_tests = 0
  @total_time = 0.0
end

Instance Attribute Details

#achievementsObject (readonly)

Returns the value of attribute achievements.



3
4
5
# File 'lib/test_info.rb', line 3

def achievements
  @achievements
end

#levelObject (readonly)

Returns the value of attribute level.



3
4
5
# File 'lib/test_info.rb', line 3

def level
  @level
end

#number_of_failed_testsObject

Returns the value of attribute number_of_failed_tests.



2
3
4
# File 'lib/test_info.rb', line 2

def number_of_failed_tests
  @number_of_failed_tests
end

#number_of_testsObject

Returns the value of attribute number_of_tests.



2
3
4
# File 'lib/test_info.rb', line 2

def number_of_tests
  @number_of_tests
end

#total_timeObject

Returns the value of attribute total_time.



2
3
4
# File 'lib/test_info.rb', line 2

def total_time
  @total_time
end

#xpObject (readonly)

Returns the value of attribute xp.



3
4
5
# File 'lib/test_info.rb', line 3

def xp
  @xp
end

Instance Method Details

#==(o) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/test_info.rb', line 23

def ==(o)
  o.class == self.class &&
  o.number_of_tests == number_of_tests &&
  o.total_time == total_time &&
  o.number_of_failed_tests == number_of_failed_tests &&
  o.xp == xp &&
  o.level == level &&
  o.achievements == achievements
end

#addAchievement(value) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/test_info.rb', line 14

def addAchievement(value)
  unless value && value.empty?
    incrimentXpAndLevel
    @achievements << value
  end

  nil
end