Module: Ace::Task::Atoms::TaskFrontmatterDefaults
- Defined in:
- lib/ace/task/atoms/task_frontmatter_defaults.rb
Overview
Builds default frontmatter hash for new tasks matching the task schema.
Constant Summary collapse
- VALID_STATUSES =
%w[pending in-progress done blocked draft skipped cancelled].freeze
- VALID_PRIORITIES =
%w[critical high medium low].freeze
Class Method Summary collapse
-
.build(id:, status: "pending", priority: nil, tags: [], dependencies: [], created_at: nil, parent: nil, estimate: nil, github_issue: nil) ⇒ Hash
Build a frontmatter hash with defaults for missing values.
-
.format_time(time) ⇒ String?
Format time for frontmatter.
Class Method Details
.build(id:, status: "pending", priority: nil, tags: [], dependencies: [], created_at: nil, parent: nil, estimate: nil, github_issue: nil) ⇒ Hash
Build a frontmatter hash with defaults for missing values.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/ace/task/atoms/task_frontmatter_defaults.rb', line 21 def self.build( id:, status: "pending", priority: nil, tags: [], dependencies: [], created_at: nil, parent: nil, estimate: nil, github_issue: nil ) fm = { "id" => id, "status" => status || "pending", "priority" => priority || "medium", "created_at" => format_time(created_at) } fm["estimate"] = estimate fm["dependencies"] = dependencies || [] fm["tags"] = || [] fm["parent"] = parent if parent fm["github_issue"] = github_issue if github_issue fm end |
.format_time(time) ⇒ String?
Format time for frontmatter
49 50 51 52 53 |
# File 'lib/ace/task/atoms/task_frontmatter_defaults.rb', line 49 def self.format_time(time) return nil unless time time.strftime("%Y-%m-%d %H:%M:%S") end |