class RfAppSerializer

Attributes

phases[RW]

Public Class Methods

new(phases) click to toggle source
# File lib/rf_app_serializer.rb, line 7
def initialize(phases)
  @phases = phases.each_with_index.map do |phase, index|
    Phase.new(
      name: phase.with_indifferent_access[:name],
      steps: phase.with_indifferent_access[:steps],
      index: index
    )
  end
end

Public Instance Methods

active_phase() click to toggle source
# File lib/rf_app_serializer.rb, line 17
def active_phase
  {
    name: find_active_phase.name,
    index: find_active_phase.index
  }
end
active_step() click to toggle source
# File lib/rf_app_serializer.rb, line 24
def active_step
  find_active_phase.active_step
end

Private Instance Methods

find_active_phase() click to toggle source
# File lib/rf_app_serializer.rb, line 30
def find_active_phase
  phases.find { |phase| phase.is_current? } || last_completed_phase
end
last_completed_phase() click to toggle source

For out of sync applications (i.e, NLS)

# File lib/rf_app_serializer.rb, line 35
def last_completed_phase
  phases.find { |phase| phase.most_recent_step }
end