Class: GoobyLap

Inherits:
GoobyXmlObject show all
Defined in:
lib/gooby_lap.rb

Overview

Gooby = Google APIs + Ruby. Copyright 2009 by Chris Joakim. Gooby is available under GNU General Public License (GPL) license.

Constant Summary

Constants inherited from GoobyBaseObject

GoobyBaseObject::KILOMETERS_PER_MILE, GoobyBaseObject::METERS_PER_FOOT, GoobyBaseObject::MILES_PER_KILOMETER, GoobyBaseObject::SECONDS_PER_HOUR, GoobyBaseObject::UOM_KILOMETERS, GoobyBaseObject::UOM_MILES, GoobyBaseObject::UOM_YARDS, GoobyBaseObject::YARDS_PER_KILOMETER, GoobyBaseObject::YARDS_PER_MILE

Instance Attribute Summary

Attributes inherited from GoobyXmlObject

#hash, #list

Instance Method Summary collapse

Methods inherited from GoobyXmlObject

#add, #base_initialize, #get, #id, #sequence, #set

Methods inherited from GoobyBaseObject

boolean_config_value, config_value, get_config, set_config

Methods included from GoobyIO

#read_file_as_lines, #write_file, #write_lines

Methods included from GoobyIntrospection

#classname, included

Methods included from GoobyEnvironment

#array_param, #boolean_param, #command_line_arg, #float_param, #integer_param, #string_param

Constructor Details

#initialize(attrs = nil) ⇒ GoobyLap

Returns a new instance of GoobyLap.



10
11
12
13
14
15
# File 'lib/gooby_lap.rb', line 10

def initialize(attrs=nil)
  base_initialize
  if attrs
    attrs.keys.each { | name | set(name, attrs[name]) }
  end
end

Instance Method Details

#distance_in_metersObject



25
26
27
# File 'lib/gooby_lap.rb', line 25

def distance_in_meters
  get('DistanceMeters').to_f
end

#dumpObject



33
34
35
# File 'lib/gooby_lap.rb', line 33

def dump
  puts "Lap: #{id}, #{sequence}, #{start_time}, #{distance_in_meters}, #{max_speed}"
end

#max_speedObject



29
30
31
# File 'lib/gooby_lap.rb', line 29

def max_speed
  get('MaximumSpeed').to_f
end

#secondsObject



21
22
23
# File 'lib/gooby_lap.rb', line 21

def seconds
  get('TotalTimeSeconds').to_f
end

#start_timeObject



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

def start_time
  get('StartTime')
end