class Taskpaper::Item
Attributes
description[RW]
level[RW]
Public Class Methods
new(string)
click to toggle source
# File lib/taskpaper/item.rb, line 6 def initialize(string) @description = string || "" end
Public Instance Methods
classify()
click to toggle source
# File lib/taskpaper/item.rb, line 34 def classify return Taskpaper::Project if description.match project_regex return Taskpaper::Task if description.match task_regex return Taskpaper::Note end
inspect()
click to toggle source
# File lib/taskpaper/item.rb, line 44 def inspect "#<#{self.class}:#{object_id} \"#{description.strip}\" tags: #{tags.inspect}>" end
project_regex()
click to toggle source
# File lib/taskpaper/item.rb, line 22 def project_regex /(?<project>[[:alnum:]\s\'\"\_\-\(\)\{\}\[\]\<\>\?\+\!\@\#\$\%\^\&\*\|\\\~\`\,\.\=]+):/ end
tag_regex()
click to toggle source
# File lib/taskpaper/item.rb, line 18 def tag_regex /@[[:alnum:]_-]*\([[:alnum:]\s\-\_\:\'\"]*\)*|@[[:alnum:]]*/ end
task_regex()
click to toggle source
# File lib/taskpaper/item.rb, line 26 def task_regex /(?<task>\-[[:alnum:]\s'"]+)/ end
to_s()
click to toggle source
# File lib/taskpaper/item.rb, line 48 def to_s description end
untagged_description()
click to toggle source
# File lib/taskpaper/item.rb, line 10 def untagged_description untagged = description.dup tags.each do |tag| untagged.gsub!(tag, "") end untagged.strip end