Sha256: 5cd7954ded837ecd781edf9f43f69d1e34a0820a0c12de0d6a985961fdf47799
Contents?: true
Size: 1.08 KB
Versions: 5
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true require 'forwardable' module Checkoff # Query different subtasks of Asana tasks class Subtasks MINUTE = 60 LONG_CACHE_TIME = MINUTE * 15 SHORT_CACHE_TIME = MINUTE * 5 extend Forwardable # pulls a Hash of subtasks broken out by section def by_section(tasks) current_section = nil by_section = {} tasks.each do |task| current_section, by_section = file_task_by_section(current_section, by_section, task) end by_section end # Returns all subtasks, including section headers def raw_subtasks(task) task.subtasks(projects.task_options) end cache_method :raw_subtasks, LONG_CACHE_TIME private def file_task_by_section(current_section, by_section, task) if task.name =~ /:$/ current_section = task.name by_section[current_section] = [] else by_section[current_section] ||= [] by_section[current_section] << task end [current_section, by_section] end end end
Version data entries
5 entries across 5 versions & 1 rubygems