steppy 0.5.4 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/steppy.rb +35 -12
- data/lib/steppy/error.rb +0 -2
- data/lib/steppy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a3e69bd0bf6da2bc6ad68601777f7aaf6c350afabf6f899db8dcb244ea9ebcf
|
4
|
+
data.tar.gz: c2e3b695f6f791c3c90c523c357915071fe0a5cff19151d10ca4bed3b795e3b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c694feb7e483edbee03a84d936f5d64295911c318232ec31ea6f7ba9b58068d199cec2df97e1f9f14284387dd01c0e0c56b20f18e7c61d63ddfcac668110dbb0
|
7
|
+
data.tar.gz: 4865f642107ed0cfd33d1c5ac2200cdeef40adc71407e73f9cd349f33994c556fcc65f44556faa66b7000a7c3a199496bfed05297087b05bb305fa97692854e3
|
data/Gemfile.lock
CHANGED
data/lib/steppy.rb
CHANGED
@@ -16,7 +16,12 @@ module Steppy
|
|
16
16
|
if !defined? step
|
17
17
|
def step(method, **args, &block)
|
18
18
|
args[:prefix] ||= :step
|
19
|
-
|
19
|
+
|
20
|
+
steppy_add(
|
21
|
+
step_method: method,
|
22
|
+
step_args: args,
|
23
|
+
step_block: block,
|
24
|
+
)
|
20
25
|
end
|
21
26
|
end
|
22
27
|
|
@@ -26,6 +31,15 @@ module Steppy
|
|
26
31
|
end
|
27
32
|
end
|
28
33
|
|
34
|
+
if !defined? step_unless
|
35
|
+
def step_unless(condition, &block)
|
36
|
+
steppy_add(
|
37
|
+
step_if: -> { !steppy_run_block(condition) },
|
38
|
+
step_block: block,
|
39
|
+
)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
29
43
|
if !defined? step_set
|
30
44
|
def step_set(*sets)
|
31
45
|
steppy_cache[:sets] = *sets
|
@@ -91,16 +105,24 @@ module Steppy
|
|
91
105
|
end
|
92
106
|
end
|
93
107
|
|
94
|
-
def
|
95
|
-
|
96
|
-
return
|
97
|
-
end
|
108
|
+
def steppy_run_step(step)
|
109
|
+
step_method = step[:step_method]
|
98
110
|
|
99
|
-
|
100
|
-
|
111
|
+
if step.key?(:step_if)
|
112
|
+
steppy_if_block(step)
|
113
|
+
elsif step_method.is_a? Proc
|
114
|
+
steppy_run_block(step_method)
|
115
|
+
else
|
116
|
+
steppy_step(step)
|
101
117
|
end
|
102
118
|
end
|
103
119
|
|
120
|
+
def steppy_run_steps(steps)
|
121
|
+
return if !steps
|
122
|
+
|
123
|
+
steps.each { |step| @steppy[:result] = steppy_run_step(step) }
|
124
|
+
end
|
125
|
+
|
104
126
|
def steppy_step(step_method:, step_args:, step_block:)
|
105
127
|
if steppy_if(step_args[:if]) || @steppy_prefix != step_args[:prefix]
|
106
128
|
return
|
@@ -109,15 +131,15 @@ module Steppy
|
|
109
131
|
method_name = "#{@steppy_prefix}_#{step_method}"
|
110
132
|
|
111
133
|
result = if step_block
|
112
|
-
steppy_run_block(step_block
|
134
|
+
steppy_run_block(step_block)
|
113
135
|
else
|
114
|
-
steppy_run_method(method_name
|
136
|
+
steppy_run_method(method_name)
|
115
137
|
end
|
116
138
|
|
117
139
|
steppy_set(step_args[:set], result)
|
118
140
|
end
|
119
141
|
|
120
|
-
def steppy_run_method(method_name
|
142
|
+
def steppy_run_method(method_name)
|
121
143
|
if method(method_name).arity > 0
|
122
144
|
public_send(method_name, steppy_attributes)
|
123
145
|
else
|
@@ -125,10 +147,11 @@ module Steppy
|
|
125
147
|
end
|
126
148
|
end
|
127
149
|
|
128
|
-
def steppy_run_block(step_block
|
150
|
+
def steppy_run_block(step_block)
|
129
151
|
if step_block.arity > 0
|
130
152
|
instance_exec(steppy_attributes, &step_block)
|
131
|
-
else
|
153
|
+
else
|
154
|
+
instance_exec(&step_block)
|
132
155
|
end
|
133
156
|
end
|
134
157
|
|
data/lib/steppy/error.rb
CHANGED
data/lib/steppy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: steppy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cj
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|