Class: Rubyfocus::Project
- Includes:
- Parser
- Defined in:
- lib/rubyfocus/items/project.rb
Overview
The project represents an OmniFocus project object.
Instance Attribute Summary collapse
-
#last_review ⇒ Object
When did we last review the project?.
-
#review_interval ⇒ Object
How often to we review this project?.
-
#singleton ⇒ Object
(also: #singleton?)
Singleton: contains one-off tasks.
-
#status ⇒ Object
What’s the status of the project? Valid options: :active, :inactive, :done.
Attributes inherited from Task
#completed, #due, #flagged, #note, #order, #start
Attributes inherited from RankedItem
Attributes inherited from NamedItem
Attributes inherited from Item
#added, #document, #id, #modified
Class Method Summary collapse
-
.matches_node?(node) ⇒ Boolean
Projects are <task>s with an interior <project> node.
Instance Method Summary collapse
-
#active? ⇒ Boolean
Status methods.
-
#apply_xml(n) ⇒ Object
Apply XML node to project.
- #completed? ⇒ Boolean
- #dropped? ⇒ Boolean
-
#initialize(document = nil, n = nil) ⇒ Project
constructor
Initialize the project with a document and optional node to base it off of.
- #on_hold? ⇒ Boolean
-
#to_task ⇒ Object
————————————— Convert to a task.
Methods included from Parser
Methods inherited from Task
#actionable_tasks, #blocked?, #deferred?, #has_subtasks?, #immediate_tasks, #incomplete_tasks, #next_available_task, #next_tasks, #tasks, #tasks_remain?, #to_project
Methods inherited from Item
Methods included from ConditionalExec
Methods included from IDRef
Constructor Details
#initialize(document = nil, n = nil) ⇒ Project
Initialize the project with a document and optional node to base it off of. Also sets default values
29 30 31 32 33 34 |
# File 'lib/rubyfocus/items/project.rb', line 29 def initialize(document=nil, n=nil) @singleton = false @order = :sequential @status = :active super(document, n) end |
Instance Attribute Details
#last_review ⇒ Object
When did we last review the project?
21 22 23 |
# File 'lib/rubyfocus/items/project.rb', line 21 def last_review @last_review end |
#review_interval ⇒ Object
How often to we review this project?
18 19 20 |
# File 'lib/rubyfocus/items/project.rb', line 18 def review_interval @review_interval end |
#singleton ⇒ Object Also known as: singleton?
Singleton: contains one-off tasks
15 16 17 |
# File 'lib/rubyfocus/items/project.rb', line 15 def singleton @singleton end |
#status ⇒ Object
What’s the status of the project? Valid options: :active, :inactive, :done. Default is :active
25 26 27 |
# File 'lib/rubyfocus/items/project.rb', line 25 def status @status end |
Class Method Details
.matches_node?(node) ⇒ Boolean
Projects are <task>s with an interior <project> node
10 11 12 |
# File 'lib/rubyfocus/items/project.rb', line 10 def self.matches_node?(node) return (node.name == "task" && (node/"project").size > 0) end |
Instance Method Details
#active? ⇒ Boolean
Status methods
61 |
# File 'lib/rubyfocus/items/project.rb', line 61 def active?; status == :active; end |
#apply_xml(n) ⇒ Object
Apply XML node to project
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/rubyfocus/items/project.rb', line 37 def apply_xml(n) super(n) #First, set project p = n.at_xpath("xmlns:project") 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.parse e.inner_html } conditional_set(:status, p.at_xpath("xmlns:status")) { |e| e.inner_html.to_sym } end |
#completed? ⇒ Boolean
63 |
# File 'lib/rubyfocus/items/project.rb', line 63 def completed?; status == :done; end |
#dropped? ⇒ Boolean
64 |
# File 'lib/rubyfocus/items/project.rb', line 64 def dropped?; status == :dropped; end |
#on_hold? ⇒ Boolean
62 |
# File 'lib/rubyfocus/items/project.rb', line 62 def on_hold?; status == :inactive; end |
#to_task ⇒ Object
Convert to a task
68 69 70 71 72 73 74 75 |
# File 'lib/rubyfocus/items/project.rb', line 68 def to_task t = Rubyfocus::Task.new(self.document) instance_variables.each do |ivar| setter = ivar.to_s.gsub(/^@/,"") + "=" t.send(setter, self.instance_variable_get(ivar)) if t.respond_to?(setter) end t end |