class Tardef::Validator::Links
Public Class Methods
new()
click to toggle source
Calls superclass method
Tardef::Validator::Base::new
# File lib/tardef/validator/links.rb, line 3 def initialize super end
Public Instance Methods
validate(file_obj)
click to toggle source
# File lib/tardef/validator/links.rb, line 7 def validate(file_obj) file_obj.lists.each do |list| parent = list.parent if parent and not parent.empty? and not file_obj.has_list?(parent) @errors << "List parent #{parent} does not exist" end end file_obj.tags.each do |tag| parent = tag.parent if parent and not parent.empty? and not file_obj.has_tag?(parent) @errors << "Tag parent #{parent} does not exist" end end file_obj.tasks.each do |task| parent = task.list if parent and not parent.empty? and not file_obj.has_list?(parent) @errors << "Task list #{parent} does not exist" end task.tags.each do |tag| @errors << "Tag #{tag} does not exist" unless file_obj.has_tag?(tag) end end @errors end