Class: TestUser
- Inherits:
-
Object
- Object
- TestUser
- Defined in:
- lib/test_user.rb
Constant Summary collapse
- @@users =
[]
- @@no_users =
0
Instance Attribute Summary collapse
-
#accuracy ⇒ Object
Returns the value of attribute accuracy.
-
#finish_time ⇒ Object
Returns the value of attribute finish_time.
-
#first_name ⇒ Object
readonly
Returns the value of attribute first_name.
-
#last_name ⇒ Object
readonly
Returns the value of attribute last_name.
-
#number_qs ⇒ Object
Returns the value of attribute number_qs.
-
#total_correct_answers ⇒ Object
Returns the value of attribute total_correct_answers.
-
#user_id ⇒ Object
readonly
Returns the value of attribute user_id.
Instance Method Summary collapse
-
#initialize(first_name, last_name) ⇒ TestUser
constructor
A new instance of TestUser.
Constructor Details
#initialize(first_name, last_name) ⇒ TestUser
Returns a new instance of TestUser.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/test_user.rb', line 6 def initialize(first_name,last_name) @first_name=first_name @last_name=last_name @user_id=first_name.downcase+"_"+last_name.downcase @number_qs = 0 @total_correct_answers = 0 @@users<<@user_id if File.file?("tester_summary.csv")==false CSV.open("tester_summary.csv","a+") do |csv| csv<<["user_id","first_name","last_name","number_qs","total_correct_answers","accuracy","time"] end @@no_users+=1 end end |
Instance Attribute Details
#accuracy ⇒ Object
Returns the value of attribute accuracy.
2 3 4 |
# File 'lib/test_user.rb', line 2 def accuracy @accuracy end |
#finish_time ⇒ Object
Returns the value of attribute finish_time.
2 3 4 |
# File 'lib/test_user.rb', line 2 def finish_time @finish_time end |
#first_name ⇒ Object (readonly)
Returns the value of attribute first_name.
3 4 5 |
# File 'lib/test_user.rb', line 3 def first_name @first_name end |
#last_name ⇒ Object (readonly)
Returns the value of attribute last_name.
3 4 5 |
# File 'lib/test_user.rb', line 3 def last_name @last_name end |
#number_qs ⇒ Object
Returns the value of attribute number_qs.
2 3 4 |
# File 'lib/test_user.rb', line 2 def number_qs @number_qs end |
#total_correct_answers ⇒ Object
Returns the value of attribute total_correct_answers.
2 3 4 |
# File 'lib/test_user.rb', line 2 def total_correct_answers @total_correct_answers end |
#user_id ⇒ Object (readonly)
Returns the value of attribute user_id.
3 4 5 |
# File 'lib/test_user.rb', line 3 def user_id @user_id end |