Class: Things
- Inherits:
-
Object
- Object
- Things
- 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
-
#xml ⇒ Object
readonly
Hpricot doc of Things xml file.
Instance Method Summary collapse
-
#initialize ⇒ Boolean
constructor
initialize - change to the default Things directory and load the xml.
-
#load_database ⇒ Hpricot
load_database - loads the databse file into the xml property.
Methods included from Tasks
#task_complete?, #task_description, #tasks
Methods included from Projects
#project, #project_area, #project_title, #projects
Constructor Details
#initialize ⇒ Boolean
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
#xml ⇒ Object (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_database ⇒ Hpricot
load_database - loads the databse file into the xml property
37 38 39 |
# File 'lib/harvestthings/things.rb', line 37 def load_database @xml = Hpricot.XML(open(DATABASE_FILE)) end |