Class: DatashiftJourney::Configuration

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

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/datashift_journey/configuration.rb', line 62

def initialize
  @forms_module_name = ''

  @partial_location  = ''

  @use_null_form_when_no_form = false
  @null_form_list = []

  @layout = 'application'
  @add_state_jumper_toolbar = false
  @state_jumper_states = []
end

Class Attribute Details

.configuration=(value) ⇒ Object (writeonly)

Sets the attribute configuration

Parameters:

  • value

    the value to set the attribute configuration to.



90
91
92
# File 'lib/datashift_journey/configuration.rb', line 90

def configuration=(value)
  @configuration = value
end

Instance Attribute Details

#add_state_jumper_toolbarObject

In development, you can add a state jumper toolbar, for jumping straight to any state



49
50
51
# File 'lib/datashift_journey/configuration.rb', line 49

def add_state_jumper_toolbar
  @add_state_jumper_toolbar
end

#backto_start_urlObject



75
76
77
# File 'lib/datashift_journey/configuration.rb', line 75

def backto_start_url
  @backto_start_url ||= Rails.application.routes.url_helpers.root_path
end

#forms_module_nameString<#call>

The module(s) under which to find Forms Form factory will look for a Form class related to a state called

"#{mod}::#{journey_plan.state}Form"

Parameters:

  • module (String<#call>)

    name under which Forms reside

Returns:



23
24
25
# File 'lib/datashift_journey/configuration.rb', line 23

def forms_module_name
  @forms_module_name
end

#layoutObject

Returns the value of attribute layout.



45
46
47
# File 'lib/datashift_journey/configuration.rb', line 45

def layout
  @layout
end

#null_form_listArray<#call>

When no Form is required for a specific HTML page, you an specify that a NullForm is to be used by adding that state to this list

Parameters:

  • List (Array<#call>)

    of states that require only a NullForm

Returns:



31
32
33
# File 'lib/datashift_journey/configuration.rb', line 31

def null_form_list
  @null_form_list
end

#partial_locationObject

The location of the View partials, for rendering

default is empty, for views stored directly in app/views



43
44
45
# File 'lib/datashift_journey/configuration.rb', line 43

def partial_location
  @partial_location
end

#state_jumper_statesObject

Add required details of states to jump to (see StateJumperEntry) to this ARRAY

So that any data required for previous states can be created, it supports passing in a Factory that creates that data for you by value. Use nil if no data required

The factory should return an instance of your DatashiftJourney.journey_plan_class

Parameters:

  • (StateJumperEntry.new(:state_name, "State Name", :state_factory), ....)


60
61
62
# File 'lib/datashift_journey/configuration.rb', line 60

def state_jumper_states
  @state_jumper_states
end

#use_null_form_when_no_formBoolean<#call>

Always use a NullForm when no designated Form for a page

Parameters:

Returns:



37
38
39
# File 'lib/datashift_journey/configuration.rb', line 37

def use_null_form_when_no_form
  @use_null_form_when_no_form
end

Class Method Details

.callDatashiftJourney::Configuration

Returns current configuration.

Returns:



80
81
82
# File 'lib/datashift_journey/configuration.rb', line 80

def self.call
  @configuration ||= DatashiftJourney::Configuration.new
end

.configure {|call| ... } ⇒ Object

Modify current DatashiftJourney configuration “‘

DatashiftJourney::Configuration.configure do |config|
  config.html_only = false
end

“‘

Yields:



99
100
101
# File 'lib/datashift_journey/configuration.rb', line 99

def self.configure
  yield call
end

.resetObject



84
85
86
# File 'lib/datashift_journey/configuration.rb', line 84

def self.reset
  @configuration = DatashiftJourney::Configuration.new
end