Class: Ace::Overseer::Models::WorkContext

Inherits:
Object
  • Object
show all
Defined in:
lib/ace/overseer/models/work_context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(task_id:, worktree_path:, branch:, assignments: [], git_status: nil, tmux_window: nil, location_type: :worktree) ⇒ WorkContext

Returns a new instance of WorkContext.



10
11
12
13
14
15
16
17
18
19
# File 'lib/ace/overseer/models/work_context.rb', line 10

def initialize(task_id:, worktree_path:, branch:, assignments: [], git_status: nil,
  tmux_window: nil, location_type: :worktree)
  @task_id = task_id.to_s.freeze
  @worktree_path = worktree_path.to_s.freeze
  @branch = branch.to_s.freeze
  @assignments = Array(assignments)
  @git_status = git_status
  @tmux_window = tmux_window&.to_s&.freeze
  @location_type = location_type.to_sym
end

Instance Attribute Details

#assignmentsObject (readonly)

Returns the value of attribute assignments.



7
8
9
# File 'lib/ace/overseer/models/work_context.rb', line 7

def assignments
  @assignments
end

#branchObject (readonly)

Returns the value of attribute branch.



7
8
9
# File 'lib/ace/overseer/models/work_context.rb', line 7

def branch
  @branch
end

#git_statusObject (readonly)

Returns the value of attribute git_status.



7
8
9
# File 'lib/ace/overseer/models/work_context.rb', line 7

def git_status
  @git_status
end

#location_typeObject (readonly)

Returns the value of attribute location_type.



7
8
9
# File 'lib/ace/overseer/models/work_context.rb', line 7

def location_type
  @location_type
end

#task_idObject (readonly)

Returns the value of attribute task_id.



7
8
9
# File 'lib/ace/overseer/models/work_context.rb', line 7

def task_id
  @task_id
end

#tmux_windowObject (readonly)

Returns the value of attribute tmux_window.



7
8
9
# File 'lib/ace/overseer/models/work_context.rb', line 7

def tmux_window
  @tmux_window
end

#worktree_pathObject (readonly)

Returns the value of attribute worktree_path.



7
8
9
# File 'lib/ace/overseer/models/work_context.rb', line 7

def worktree_path
  @worktree_path
end

Instance Method Details

#assignment_countObject



25
26
27
# File 'lib/ace/overseer/models/work_context.rb', line 25

def assignment_count
  @assignments.size
end

#assignment_statusObject



21
22
23
# File 'lib/ace/overseer/models/work_context.rb', line 21

def assignment_status
  @assignments.first
end

#to_hObject



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/ace/overseer/models/work_context.rb', line 29

def to_h
  {
    task_id: task_id,
    worktree_path: worktree_path,
    branch: branch,
    assignments: assignments,
    git_status: git_status,
    tmux_window: tmux_window,
    location_type: location_type
  }
end