Module: DatashiftJourney
- Defined in:
- app/forms/datashift_journey/null_form.rb,
lib/datashift_journey.rb,
lib/datashift_journey/engine.rb,
lib/datashift_journey/version.rb,
lib/datashift_journey/exceptions.rb,
lib/datashift_journey/configuration.rb,
lib/datashift_journey/collector/snippet.rb,
lib/datashift_journey/helpers/back_link.rb,
lib/datashift_journey/reference_generator.rb,
app/models/datashift_journey/journey_review.rb,
lib/datashift_journey/state_machines/planner.rb,
lib/datashift_journey/collector/field_snippet.rb,
lib/datashift_journey/journey/machine_builder.rb,
lib/datashift_journey/prepare_data_for_review.rb,
lib/datashift_journey/state_machines/sequence.rb,
app/helpers/datashift_journey/back_link_helper.rb,
app/forms/datashift_journey/concerns/form_mixin.rb,
lib/datashift_journey/state_machines/extensions.rb,
app/helpers/datashift_journey/application_helper.rb,
app/models/datashift_journey/collector/data_node.rb,
app/models/datashift_journey/review_data_section.rb,
lib/generators/datashift_journey/forms_generator.rb,
lib/generators/datashift_journey/generate_common.rb,
lib/generators/datashift_journey/views_generator.rb,
app/models/datashift_journey/collector/form_field.rb,
lib/datashift_journey/collector/page_state_snippet.rb,
app/controllers/datashift_journey/errors_controller.rb,
app/factories/datashift_journey/form_object_factory.rb,
app/controllers/datashift_journey/reviews_controller.rb,
app/models/datashift_journey/collector/form_definition.rb,
lib/generators/datashift_journey/setup/setup_generator.rb,
app/controllers/datashift_journey/application_controller.rb,
app/controllers/datashift_journey/page_states_controller.rb,
lib/datashift_journey/state_machines/branch_sequence_map.rb,
app/controllers/concerns/datashift_journey/error_renderer.rb,
app/controllers/concerns/datashift_journey/validate_state.rb,
app/controllers/datashift_journey/abandonments_controller.rb,
app/controllers/datashift_journey/journey_ends_controller.rb,
app/controllers/datashift_journey/state_jumper_controller.rb,
app/forms/datashift_journey/collector/base_collector_form.rb,
app/controllers/concerns/datashift_journey/review_renderer.rb,
app/controllers/datashift_journey/api/v1/states_controller.rb,
app/controllers/datashift_journey/journey_plans_controller.rb,
app/controllers/concerns/datashift_journey/token_based_access.rb,
lib/generators/datashift_journey/collector/collector_generator.rb,
app/controllers/datashift_journey/abandon_enrollments_controller.rb,
app/serializers/datashift_journey/collector/page_state_serializer.rb,
lib/generators/datashift_journey/collector/install_collector_generator.rb,
lib/generators/datashift_journey/collector/install_mongo_collector_generator.rb
Overview
This is a development tool - for creating and jumping straight to any State
So that any data required for previous states can be created, it supports passing in a optional Factory that creates that data for you.
The factory should return an instance of your DatashiftJourney.journey_plan_class
For a full list of available factories you can call :
FactoryGirl.definition_file_paths.inspect
FactoryGirl.factories.collect(&:name).inspect
Defined Under Namespace
Modules: Api, ApplicationHelper, BackLinkHelper, Collector, ErrorRenderer, FormMixin, GenerateCommon, Journey, ReviewRenderer, StateMachines, TokenBasedAccess, ValidateState Classes: AbandonEnrollmentsController, AbandonmentsController, ApplicationController, BackLink, CollectorGenerator, Configuration, CoreException, Engine, ErrorsController, FormObjectError, FormObjectFactory, FormsController, FormsGenerator, InstallCollectorGenerator, InstallMongoCollectorGenerator, JourneyEndsController, JourneyPlansController, JourneyReview, NullForm, PlannerApiError, PlannerBlockError, ReferenceGenerator, ReviewDataSection, ReviewsController, SetupGenerator, StateJumperController, ViewsGenerator
Constant Summary collapse
- VERSION =
'0.1.2'
Class Method Summary collapse
- .journey_plan_class ⇒ Object
-
.journey_plan_class=(x) ⇒ Object
Set the main model class that contains the plan and associated state engine.
- .library_path ⇒ Object
-
.load_commands ⇒ Object
Load all the datashift Thor commands and make them available throughout app.
- .state_names(machine: :state) ⇒ Object
Class Method Details
.journey_plan_class ⇒ Object
48 49 50 51 |
# File 'lib/datashift_journey.rb', line 48 def self.journey_plan_class @journey_plan_class = @journey_plan_class.to_s.constantize if @journey_plan_class.is_a?(String) || @journey_plan_class.is_a?(Symbol) @journey_plan_class end |
.journey_plan_class=(x) ⇒ Object
Set the main model class that contains the plan and associated state engine
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/datashift_journey.rb', line 30 def self.journey_plan_class=(x) raise 'DSJ - journey_plan_class MUST be String or Symbol, not a Class.' if x.is_a?(Class) @journey_plan_class = x class << self define_method :"concern_file" do "#{@journey_plan_class.underscore}_journey.rb" end end # This is called from an initializer, we dont want to trigger the machine building till # the model class itself is loaded so do NOT do this here # @journey_plan_class = x.to_s.constantize if x.is_a?(String) || x.is_a?(Symbol) @journey_plan_class end |
.library_path ⇒ Object
13 14 15 |
# File 'lib/datashift_journey.rb', line 13 def self.library_path File.("#{File.dirname(__FILE__)}/../lib") end |
.load_commands ⇒ Object
Load all the datashift Thor commands and make them available throughout app
19 20 21 22 23 24 25 26 |
# File 'lib/datashift_journey.rb', line 19 def self.load_commands base = File.join(library_path, 'tasks', '**') Dir["#{base}/*.thor"].each do |f| next unless File.file?(f) load(f) end end |
.state_names(machine: :state) ⇒ Object
53 54 55 |
# File 'lib/datashift_journey.rb', line 53 def self.state_names(machine: :state) DatashiftJourney.journey_plan_class.state_machine(machine).states.map(&:name) end |