Class: RfAppSerializer
- Inherits:
-
Object
- Object
- RfAppSerializer
- Defined in:
- lib/rf_app_serializer.rb
Instance Attribute Summary collapse
-
#phases ⇒ Object
Returns the value of attribute phases.
Instance Method Summary collapse
- #active_phase ⇒ Object
- #active_step ⇒ Object
- #find_active_phase ⇒ Object
-
#initialize(phases) ⇒ RfAppSerializer
constructor
A new instance of RfAppSerializer.
Constructor Details
#initialize(phases) ⇒ RfAppSerializer
Returns a new instance of RfAppSerializer.
6 7 8 |
# File 'lib/rf_app_serializer.rb', line 6 def initialize(phases) @phases = phases.each_with_index.map { |phase, index| Phase.new(name: phase[:name], steps: phase[:steps], index: index) } end |
Instance Attribute Details
#phases ⇒ Object
Returns the value of attribute phases.
4 5 6 |
# File 'lib/rf_app_serializer.rb', line 4 def phases @phases end |
Instance Method Details
#active_phase ⇒ Object
16 17 18 19 20 21 |
# File 'lib/rf_app_serializer.rb', line 16 def active_phase { name: find_active_phase.name, index: find_active_phase.index } end |
#active_step ⇒ Object
23 24 25 |
# File 'lib/rf_app_serializer.rb', line 23 def active_step find_active_phase.most_recent_step end |
#find_active_phase ⇒ Object
10 11 12 13 14 |
# File 'lib/rf_app_serializer.rb', line 10 def find_active_phase phases.find do |phase| phase.is_started? end end |