easy_flow 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7beeb603b60c113d63219761c29a84858b1d9bc5c870c877ea628cd6cde8cb3
4
- data.tar.gz: 2fac26b851b947941aa562c785e78f037f2647e8cce611f1230026b4a5f2b063
3
+ metadata.gz: 8ff52593be51a666b42de7e2b05f7fea31de7b09240a21884d341ee0d7bfc1d2
4
+ data.tar.gz: cb2902b162132cdbfa5060b64acc49835fdbfaeacffc83665a8d2ab74a5de722
5
5
  SHA512:
6
- metadata.gz: 73e4f10cba25f80dabc9ca201b09ae971d1369ddacfbe97e511649d007dd1d55e873573b096ef5c34c00b8a6b5e6134e9384374d348893d1d6031c466fb3000c
7
- data.tar.gz: 85320b6c006c40e196f62ac1511e73ce87ac9edc0484a35e2d02e42b89d574f7b8e716c0a4d4ada5c35f21b63be4fc857aec4a055c655bfa2fefc3403ab62879
6
+ metadata.gz: 10a1e356dfcddc779ffc9f0ada50195c03a676ff2717ed64f0e6bbbbab1df3e834e6f7be22758a0de79c7ee6e490fe471c1654d4f4af97f1172a9bed69f2749b
7
+ data.tar.gz: 4cb65c539b7a12d104e0c12db6cb304267ef966b892ba3cdfe920e0e4e50d703936189ad685a2412761e5f4c4e9bed292048723c8c1c84e9ff43408a83eb193b
@@ -7,11 +7,11 @@ module EasyFlow
7
7
  end
8
8
 
9
9
  def start
10
- redirect_to easy_flow.run_path(Run.start(flow))
10
+ redirect_to run_location(start_run(flow))
11
11
  end
12
12
 
13
13
  def step
14
- @guide = QuestionRunner.new(running_definition)
14
+ @guide = runner_for(running_definition)
15
15
  @progress = progress
16
16
  @guide.run(@progress)
17
17
  @answers = @progress.recorded
@@ -24,11 +24,23 @@ module EasyFlow
24
24
 
25
25
  def update
26
26
  params[:back] ? progress.discard_last : record_submitted
27
- redirect_to easy_flow.run_path(run)
27
+ redirect_to run_location(run)
28
28
  end
29
29
 
30
30
  private
31
31
 
32
+ def runner_for(definition)
33
+ QuestionRunner.new(definition)
34
+ end
35
+
36
+ def run_location(run)
37
+ easy_flow.run_path(run)
38
+ end
39
+
40
+ def start_run(flow)
41
+ Run.start(flow)
42
+ end
43
+
32
44
  def flow_start_path(slug)
33
45
  easy_flow.flow_path(slug)
34
46
  end
@@ -42,7 +54,7 @@ module EasyFlow
42
54
  end
43
55
 
44
56
  def step_form
45
- return { url: easy_flow.run_path(run), method: :patch } if run
57
+ return { url: run_location(run), method: :patch } if run
46
58
 
47
59
  { url: flow_step_path(@guide.slug), method: :get }
48
60
  end
@@ -53,7 +65,10 @@ module EasyFlow
53
65
 
54
66
  def render_completion
55
67
  @answered = @guide.state_on_path(@answers)
56
- @progress.finish(@answered)
68
+ finished(@answered, @progress.finish(@answered))
69
+ end
70
+
71
+ def finished(_answers, _run)
57
72
  render :complete
58
73
  end
59
74
 
@@ -97,7 +112,7 @@ module EasyFlow
97
112
  end
98
113
 
99
114
  def asked
100
- QuestionRunner.new(run.pinned_definition).steps.map(&:id)
115
+ runner_for(run.pinned_definition).steps.map(&:id)
101
116
  end
102
117
  end
103
118
  end
@@ -1,3 +1,3 @@
1
1
  module EasyFlow
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_flow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - tylercschneider