class Rubyfocus::Project
The project represents an OmniFocus project object.
Attributes
last_review[RW]
When did we last review the project?
review_interval[RW]
How often to we review this project?
singleton[RW]
Singleton: contains one-off tasks
singleton?[RW]
Singleton: contains one-off tasks
status[RW]
What's the status of the project? Valid options: :active, :inactive, :done. Default is :active
Public Class Methods
matches_node?(node)
click to toggle source
Projects are <task>s with an interior <project> node
# File lib/rubyfocus/items/project.rb, line 9 def self.matches_node?(node) return ( node.name == "task" && (node/"project").size > 0 && (node/"project").first.children.size > 0 ) end
new(document=nil, n=nil)
click to toggle source
Initialize the project with a document and optional node to base it off of. Also sets default values
Calls superclass method
Rubyfocus::Task::new
# File lib/rubyfocus/items/project.rb, line 32 def initialize(document=nil, n=nil) @singleton = false @order = :sequential @status = :active super(document, n) end
Public Instance Methods
active?()
click to toggle source
Status methods
# File lib/rubyfocus/items/project.rb, line 67 def active?; status == :active; end
apply_xml(n)
click to toggle source
Apply XML node to project
Calls superclass method
Rubyfocus::Task#apply_xml
# File lib/rubyfocus/items/project.rb, line 40 def apply_xml(n) super(n) #First, set project p = n.at_xpath("xmlns:project") # We're not always going to have a project! And this *doesn't* mean that this project is demoted if p conditional_set(:singleton, p.at_xpath("xmlns:singleton")) { |e| e.inner_html == "true" } conditional_set(:review_interval, p.at_xpath("xmlns:review-interval") ) { |e| Rubyfocus::ReviewPeriod.from_string(e.inner_html) } conditional_set(:last_review, p.at_xpath("xmlns:last-review")) { |e| Time.safely_parse e.inner_html } conditional_set(:status, p.at_xpath("xmlns:status")) { |e| e.inner_html.to_sym } end end
completed?()
click to toggle source
# File lib/rubyfocus/items/project.rb, line 69 def completed?; status == :done; end
dropped?()
click to toggle source
# File lib/rubyfocus/items/project.rb, line 70 def dropped?; status == :dropped; end
on_hold?()
click to toggle source
# File lib/rubyfocus/items/project.rb, line 68 def on_hold?; status == :inactive; end
to_task()
click to toggle source
# File lib/rubyfocus/items/project.rb, line 74 def to_task t = Rubyfocus::Task.new(nil) instance_variables.each do |ivar| next if ivar == :"@document" setter = ivar.to_s.gsub(/^@/,"") + "=" t.send(setter, self.instance_variable_get(ivar)) if t.respond_to?(setter) end t end
Private Instance Methods
inspect_properties()
click to toggle source
Calls superclass method
Rubyfocus::Task#inspect_properties
# File lib/rubyfocus/items/project.rb, line 57 def inspect_properties super + %w(singleton review_interval last_review) end