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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ee13444e9141b32314ebd0303d96ef3667773291
4
- data.tar.gz: 0540beb2691841d94ab4e75eab487beaf5755f48
3
+ metadata.gz: 11fe1b1eb2083aae444968de381654c254282479
4
+ data.tar.gz: b7f47712b4f46bf5b08d4e1f34086adf1927efcc
5
5
  SHA512:
6
- metadata.gz: ef6ace847bd139f5ecd626cc6a3bd3319b6a90295f767b09afe748ee3b52ca63a5ead655d675f662c771628c840bb3046d9295a0be406f6d4c4b84cf2956c2e0
7
- data.tar.gz: cd8f7870a30545478097ecab4666792ecf301839a38493b2288dbc83b69fd694cd70a8eee42da5054b0d9c7911598083d9c2e09a7c82708320ef47c6ea6e7c74
6
+ metadata.gz: 114d75567ba4148cef1d798b46d39eeb619fc6e98a329cb27f19f3c6bdb7df7208d80b0e313cee61e878dd6f5388c1f6baaf41c4b41c4cda03273870f65eeed8
7
+ data.tar.gz: 01a4e8da80b5b6d4490f6ad0ec3e492cd79981f42fbf1736e1af59267db5a378376694ac885ab0871a23ae259cceefbaf758602f8629c068b2a908b0b6b100b4
@@ -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
- builder = ::Subroutine::Factory::Builder.new(config, *args)
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
- protected
23
+ def inputs
24
+ out = {}
23
25
 
24
- def op_class
25
- klass = @options[:op].constantize
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 build_inputs(overrides)
38
- out = {}
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)
@@ -1,5 +1,5 @@
1
1
  module Subroutine
2
2
  module Factory
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
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.2
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-14 00:00:00.000000000 Z
11
+ date: 2015-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: subroutine