class DFilePriority

Public Instance Methods

get_files() click to toggle source
# File Entities/DFiles.rb, line 386
def get_files
  #dputs_func
  # Search for all tags, then filter according to priorities
  dputs(4) { "Searching tags #{tags.to_s} in #{self.inspect}" }
  DFiles.search_by_all(:tags, tags).select { |df|
    dputs(4) { "Searching DFile #{df.inspect}" }
    prio_min = 10
    df.tags.each { |prio, tag|
      if tags.index(tag)
        prio_min = [prio_min, prio.to_i].min
      end
    }

    # This will return nil if the priority is not matched,
    # else the priority found, which will be evaluated by
    # the select above to be true.
    if prio_min <= priority.to_i
      dputs(3) { "Found tags #{tags} with priority #{prio_min}" }
      df.priority = prio_min
    end
  }
end
tags() click to toggle source
# File Entities/DFiles.rb, line 409
def tags
  tags_str.split(' ')
end