class Phase
Attributes
index[RW]
name[RW]
steps[RW]
Public Class Methods
new(name:, steps:, index:)
click to toggle source
# File lib/rf_app_serializer/phase.rb, line 6 def initialize(name:, steps:, index:) @name = name @steps = steps @index = index end
Public Instance Methods
active_step()
click to toggle source
# File lib/rf_app_serializer/phase.rb, line 24 def active_step most_recent_step.with_indifferent_access[:name] end
in_process_step()
click to toggle source
# File lib/rf_app_serializer/phase.rb, line 32 def in_process_step steps.find { |step| step.with_indifferent_access[:started_at] && !step.with_indifferent_access[:completed_at] } end
is_complete?()
click to toggle source
# File lib/rf_app_serializer/phase.rb, line 12 def is_complete? steps.all? { |step| step.with_indifferent_access[:completed_at] } end
is_current?()
click to toggle source
# File lib/rf_app_serializer/phase.rb, line 20 def is_current? is_started? && !is_complete? end
is_started?()
click to toggle source
# File lib/rf_app_serializer/phase.rb, line 16 def is_started? steps.any? { |step| step.with_indifferent_access[:started_at] } end
last_completed_step()
click to toggle source
# File lib/rf_app_serializer/phase.rb, line 36 def last_completed_step steps.select { |step| step.with_indifferent_access[:completed_at] }.last end
most_recent_step()
click to toggle source
# File lib/rf_app_serializer/phase.rb, line 28 def most_recent_step in_process_step || last_completed_step end