flowing 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/flowing/flow.rb +6 -4
- data/lib/flowing/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62ae207491569c18bebc4bbaa86d17d86a0cde64
|
4
|
+
data.tar.gz: 2bf1fd3865a94743106e88bb0cf272ef8b296571
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cbe04c35b5f62cbc57609a7e1d31b317876691665dda0d8aa01316b1eb541bef121128ce3f16575bf64c1358958239f638709562872bf216d49b0d2941da1b8
|
7
|
+
data.tar.gz: f7fa33f73588f8e551ded45f044924905711afce185648fceb45a8aa0cc8724734142d9d1ef299ebf81d83143e606c81595d98412eecc718fb8dbaf57e7257d5
|
data/lib/flowing/flow.rb
CHANGED
@@ -5,14 +5,15 @@ module Flowing
|
|
5
5
|
class NoActionError < StandardError; end
|
6
6
|
attr_reader :context
|
7
7
|
|
8
|
-
def self.run(context)
|
9
|
-
flow = new(context)
|
8
|
+
def self.run(context, options = {})
|
9
|
+
flow = new(context, options)
|
10
10
|
yield(flow)
|
11
11
|
end
|
12
12
|
|
13
13
|
def method_missing(method, *args, &block)
|
14
|
+
|
14
15
|
action_class = begin
|
15
|
-
"
|
16
|
+
"#{@namespace}::#{method.to_s.camelize}".constantize
|
16
17
|
rescue
|
17
18
|
raise NoActionError, "Unregistered action '#{method}'"
|
18
19
|
end
|
@@ -20,8 +21,9 @@ module Flowing
|
|
20
21
|
action.call(*args)
|
21
22
|
end
|
22
23
|
|
23
|
-
def initialize(context)
|
24
|
+
def initialize(context, options = {})
|
24
25
|
@context = context
|
26
|
+
@namespace = options[:namespace] || "Flowing::Actions"
|
25
27
|
end
|
26
28
|
end
|
27
29
|
end
|
data/lib/flowing/version.rb
CHANGED