Class: TestUser

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

Constant Summary collapse

@@users =
[]
@@no_users =
0

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#accuracyObject

Returns the value of attribute accuracy.



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

def accuracy
  @accuracy
end

#finish_timeObject

Returns the value of attribute finish_time.



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

def finish_time
  @finish_time
end

#first_nameObject (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_nameObject (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_qsObject

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_answersObject

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_idObject (readonly)

Returns the value of attribute user_id.



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

def user_id
  @user_id
end