Class: Things

Inherits:
Object
  • Object
show all
Includes:
Projects, Tasks
Defined in:
lib/harvestthings/things.rb

Constant Summary collapse

DATABASE_PATH =

Define default Things database file path and file name

"Library/Application\ Support/Cultured\ Code/Things"
DATABASE_FILE =
"Database.xml"

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Tasks

#task_complete?, #task_description, #tasks

Methods included from Projects

#project, #project_area, #project_title, #projects

Constructor Details

#initializeBoolean

initialize - change to the default Things directory and load the xml



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/harvestthings/things.rb', line 21

def initialize
  current_pwd = Dir.pwd 
  Dir.chdir() # changes to HOME environment variable
  Dir.chdir(DATABASE_PATH)
  if File.exists?(DATABASE_FILE)
    load_database
    methods
  else
    raise SystemError, "can't find the default Things database file"
  end
  Dir.chdir(current_pwd)
end

Instance Attribute Details

#xmlObject (readonly)

Hpricot doc of Things xml file



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

def xml
  @xml
end

Instance Method Details

#load_databaseHpricot

load_database - loads the databse file into the xml property

Returns:

  • (Hpricot)


37
38
39
# File 'lib/harvestthings/things.rb', line 37

def load_database
  @xml = Hpricot.XML(open(DATABASE_FILE))
end