Class: GoobyXmlObject

Inherits:
GoobyBaseObject show all
Defined in:
lib/gooby_xml_object.rb

Overview

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

Direct Known Subclasses

GoobyActivity, GoobyLap, GoobyTrackpoint

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 collapse

Instance Method Summary collapse

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

#initializeGoobyXmlObject

Returns a new instance of GoobyXmlObject.



12
13
14
# File 'lib/gooby_xml_object.rb', line 12

def initialize
  base_initialize
end

Instance Attribute Details

#hashObject (readonly)

Returns the value of attribute hash.



10
11
12
# File 'lib/gooby_xml_object.rb', line 10

def hash
  @hash
end

#listObject (readonly)

Returns the value of attribute list.



10
11
12
# File 'lib/gooby_xml_object.rb', line 10

def list
  @list
end

Instance Method Details

#add(object) ⇒ Object



28
29
30
# File 'lib/gooby_xml_object.rb', line 28

def add(object)
  @list << object
end

#base_initializeObject



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

def base_initialize
  @hash, @list = Hash.new(''), []
end

#get(name) ⇒ Object



24
25
26
# File 'lib/gooby_xml_object.rb', line 24

def get(name)
  @hash[name]
end

#idObject



32
33
34
# File 'lib/gooby_xml_object.rb', line 32

def id
  get('Id')
end

#sequenceObject



36
37
38
# File 'lib/gooby_xml_object.rb', line 36

def sequence
  get('Seq')
end

#set(name, value) ⇒ Object



20
21
22
# File 'lib/gooby_xml_object.rb', line 20

def set(name, value)
  @hash[name] = value.to_s.strip  if name && value
end