Class: Ace::Overseer::Models::AssignmentPruneCandidate

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(assignment_id:, assignment_name:, assignment_state:, location_path:, reasons: []) ⇒ AssignmentPruneCandidate

Returns a new instance of AssignmentPruneCandidate.



9
10
11
12
13
14
15
# File 'lib/ace/overseer/models/assignment_prune_candidate.rb', line 9

def initialize(assignment_id:, assignment_name:, assignment_state:, location_path:, reasons: [])
  @assignment_id = assignment_id.to_s.freeze
  @assignment_name = assignment_name.to_s.freeze
  @assignment_state = assignment_state.to_s.freeze
  @location_path = location_path.to_s.freeze
  @reasons = reasons.map(&:to_s).freeze
end

Instance Attribute Details

#assignment_idObject (readonly)

Returns the value of attribute assignment_id.



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

def assignment_id
  @assignment_id
end

#assignment_nameObject (readonly)

Returns the value of attribute assignment_name.



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

def assignment_name
  @assignment_name
end

#assignment_stateObject (readonly)

Returns the value of attribute assignment_state.



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

def assignment_state
  @assignment_state
end

#location_pathObject (readonly)

Returns the value of attribute location_path.



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

def location_path
  @location_path
end

#reasonsObject (readonly)

Returns the value of attribute reasons.



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

def reasons
  @reasons
end

Instance Method Details

#safe_to_prune?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/ace/overseer/models/assignment_prune_candidate.rb', line 17

def safe_to_prune?
  assignment_state == "completed"
end

#to_hObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/ace/overseer/models/assignment_prune_candidate.rb', line 21

def to_h
  {
    assignment_id: assignment_id,
    assignment_name: assignment_name,
    assignment_state: assignment_state,
    location_path: location_path,
    reasons: reasons,
    safe_to_prune: safe_to_prune?
  }
end