subroutine-factory 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/subroutine/factory.rb +9 -2
- data/lib/subroutine/factory/builder.rb +14 -17
- data/lib/subroutine/factory/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11fe1b1eb2083aae444968de381654c254282479
|
4
|
+
data.tar.gz: b7f47712b4f46bf5b08d4e1f34086adf1927efcc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 114d75567ba4148cef1d798b46d39eeb619fc6e98a329cb27f19f3c6bdb7df7208d80b0e313cee61e878dd6f5388c1f6baaf41c4b41c4cda03273870f65eeed8
|
7
|
+
data.tar.gz: 01a4e8da80b5b6d4490f6ad0ec3e492cd79981f42fbf1736e1af59267db5a378376694ac885ab0871a23ae259cceefbaf758602f8629c068b2a908b0b6b100b4
|
data/lib/subroutine/factory.rb
CHANGED
@@ -33,9 +33,16 @@ module Subroutine
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def self.create(name, *args)
|
36
|
+
builder(name, *args).execute!
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.inputs(name, *args)
|
40
|
+
builder(name, *args).inputs
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.builder(name, *args)
|
36
44
|
config = get_config!(name)
|
37
|
-
|
38
|
-
builder.execute!
|
45
|
+
::Subroutine::Factory::Builder.new(config, *args)
|
39
46
|
end
|
40
47
|
|
41
48
|
def self.sequence(&lambda)
|
@@ -8,6 +8,7 @@ module Subroutine
|
|
8
8
|
@config = config
|
9
9
|
@options = config.options
|
10
10
|
@args = args
|
11
|
+
@overrides = @args.extract_options!
|
11
12
|
end
|
12
13
|
|
13
14
|
def execute!
|
@@ -19,32 +20,28 @@ module Subroutine
|
|
19
20
|
output
|
20
21
|
end
|
21
22
|
|
22
|
-
|
23
|
+
def inputs
|
24
|
+
out = {}
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
+
@options[:inputs].each_pair do |k,v|
|
27
|
+
if @overrides.has_key?(k)
|
28
|
+
out[k] = @overrides[k]
|
29
|
+
else
|
30
|
+
out[k] = v.respond_to?(:call) ? v.call : v
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
out
|
26
35
|
end
|
27
36
|
|
28
37
|
def input_args
|
29
38
|
args = @args.dup
|
30
|
-
overrides = args.extract_options!
|
31
|
-
inputs = build_inputs(overrides)
|
32
|
-
|
33
39
|
args.push(inputs)
|
34
40
|
args
|
35
41
|
end
|
36
42
|
|
37
|
-
def
|
38
|
-
|
39
|
-
@options[:inputs].each_pair do |k,v|
|
40
|
-
if overrides.has_key?(k)
|
41
|
-
out[k] = overrides[k]
|
42
|
-
else
|
43
|
-
out[k] = v.respond_to?(:call) ? v.call : v
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
out
|
43
|
+
def op_class
|
44
|
+
klass = @options[:op].constantize
|
48
45
|
end
|
49
46
|
|
50
47
|
def extract_output(op)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: subroutine-factory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Nelson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: subroutine
|