Class: Things::Document

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

Constant Summary collapse

DEFAULT_DATABASE_PATH =
"#{ENV['HOME']}/Library/Application Support/Cultured Code/Things/Database.xml"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) {|_self| ... } ⇒ Document

Returns a new instance of Document.

Yields:

  • (_self)

Yield Parameters:



7
8
9
10
11
12
# File 'lib/things/document.rb', line 7

def initialize(options = {}, &block)
  @database_file = options[:database] || DEFAULT_DATABASE_PATH
  @focus_cache = {}
  parse!
  yield self if block_given?
end

Instance Attribute Details

#database_fileObject (readonly)

Returns the value of attribute database_file.



5
6
7
# File 'lib/things/document.rb', line 5

def database_file
  @database_file
end

Instance Method Details

#databaseObject



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

def database
  @doc
end

#focus(name) ⇒ Object



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

def focus(name)
  @focus_cache[name] ||= Focus.new(name, @doc)
end