Class: DatashiftJourney::FormsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/datashift_journey/forms_generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#stateObject

Returns the value of attribute state.



7
8
9
# File 'lib/generators/datashift_journey/forms_generator.rb', line 7

def state
  @state
end

Instance Method Details

#create_form_per_stateObject



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/generators/datashift_journey/forms_generator.rb', line 16

def create_form_per_state

  method_ptr = if options["no-collector"] == false || DatashiftJourney.journey_plan_class == DatashiftJourney::Collector::Collector
                 ->() { state_forms_for_collector_definition }
               else
                 ->() { state_form_definition }
               end

  DatashiftJourney.journey_plan_class.state_machine(:state).states.map(&:name).each do |state|
    @state = state
    method_ptr.call
  end
end