Class: RfAppSerializer

Inherits:
Object
  • Object
show all
Defined in:
lib/rf_app_serializer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(phases) ⇒ RfAppSerializer

Returns a new instance of RfAppSerializer.



7
8
9
10
11
12
13
14
15
# 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

Instance Attribute Details

#phasesObject

Returns the value of attribute phases.



5
6
7
# File 'lib/rf_app_serializer.rb', line 5

def phases
  @phases
end

Instance Method Details

#active_phaseObject



17
18
19
20
21
22
# File 'lib/rf_app_serializer.rb', line 17

def active_phase
  {
    name: find_active_phase.name,
    index: find_active_phase.index
  }
end

#active_stepObject



24
25
26
# File 'lib/rf_app_serializer.rb', line 24

def active_step
  find_active_phase.active_step
end