Class: Xtctimer::Timer

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

Constant Summary collapse

BASE_URL =
"http://xtc-timings.azurewebsites.net/"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(guid, scenario, isTestCloud, isAndroid, device = "Local device") ⇒ Timer

Returns a new instance of Timer.



21
22
23
24
25
26
27
28
29
# File 'lib/xtctimer.rb', line 21

def initialize(guid, scenario, isTestCloud, isAndroid, device = "Local device")
  @guid = guid
  @scenario = scenario
  @isTestCloud = isTestCloud
  @isAndroid = isAndroid
  @device = device

  @runTime = nil
end

Instance Attribute Details

#deviceObject (readonly)

Returns the value of attribute device.



17
18
19
# File 'lib/xtctimer.rb', line 17

def device
  @device
end

#guidObject (readonly)

Returns the value of attribute guid.



13
14
15
# File 'lib/xtctimer.rb', line 13

def guid
  @guid
end

#isAndroidObject (readonly)

Returns the value of attribute isAndroid.



16
17
18
# File 'lib/xtctimer.rb', line 16

def isAndroid
  @isAndroid
end

#isTestCloudObject (readonly)

Returns the value of attribute isTestCloud.



15
16
17
# File 'lib/xtctimer.rb', line 15

def isTestCloud
  @isTestCloud
end

#runTimeObject (readonly)

Returns the value of attribute runTime.



18
19
20
# File 'lib/xtctimer.rb', line 18

def runTime
  @runTime
end

#scenarioObject (readonly)

Returns the value of attribute scenario.



14
15
16
# File 'lib/xtctimer.rb', line 14

def scenario
  @scenario
end

#startTimeObject (readonly)

Returns the value of attribute startTime.



19
20
21
# File 'lib/xtctimer.rb', line 19

def startTime
  @startTime
end

Instance Method Details

#finishObject



35
36
37
38
39
40
# File 'lib/xtctimer.rb', line 35

def finish()
  endTime = Time.now
  @runTime = endTime - startTime
  post(self)
  puts "Ended timer. Elapsed: #{@runTime}"
end

#startObject



31
32
33
# File 'lib/xtctimer.rb', line 31

def start()
  @startTime = Time.now
end