strum 0.0.22 → 0.0.23

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: 5e8f1a992f7753d1e95d3b3a4595c4da54c9e425bd8cd973993070660597bb43
4
- data.tar.gz: 1eac3f924db75025c620418c616d32777b8a82ad7a6fc2a91e185807f9bc7aeb
3
+ metadata.gz: dc85d7b38bd4863da4e5400074af2533d2fa4401c3819ddffaf50427dec5c0ba
4
+ data.tar.gz: 04edcc96c072730db4057b1b678d833556287ef72da2bbcb09955d10a052efa8
5
5
  SHA512:
6
- metadata.gz: 0eeb529bf7ce9a93b44855844d180ed1ac9256daf200a32b556a3cc58221b01ac497234226f8063922f06db9e75f0749f40fc752d29cf6c393128999e90d4d88
7
- data.tar.gz: 9218ffe1bc3e47184b3b170e9802dd4cd54ec6f1204d06d971cf2fe52d126ad7c462c3b4136f1862afc33a4ea8f711be762fb9ebc29e42b2eae165cd68875a1e
6
+ metadata.gz: 79ff2f3b69b52eb8266b5d605ce1ac7d5447c722cece4f02f4604096682cc88a124fbcd95522b425c0f1dcaf309d502c49fa1175ce9fa0d780dc936b4bdafd7f
7
+ data.tar.gz: 49ede19f279f4c3a07d1dcb8b5f431af3ed6ce6ceafd62092d2ca435cf3754885ee503a3c60e06132c85f742054a3c905f2bb28931140d18b1ac516615c5fc2d
@@ -2,7 +2,7 @@ module Strum
2
2
  class Chain
3
3
  include Strum::Service
4
4
 
5
- def self.call(input = {}, *chain, &block)
5
+ def self.call(input = nil, *chain, &block)
6
6
  new(input).execute(*chain, &block)
7
7
  end
8
8
 
@@ -30,7 +30,7 @@ module Strum
30
30
 
31
31
  # Internal: Interactor class methods.
32
32
  module ClassMethods
33
- def call(input = {}, &block)
33
+ def call(input = nil, &block)
34
34
  new(input).execute(&block)
35
35
  end
36
36
  end
@@ -39,11 +39,7 @@ module Strum
39
39
  def initialize(input)
40
40
  self.strum_errors = {}
41
41
  self.outputs = {}
42
- raise Failure, "'input' must be a Hash" unless input.is_a?(Hash)
43
-
44
- self.input = input.transform_keys do |key|
45
- key_to_sym(key)
46
- end
42
+ self.input = input
47
43
  end
48
44
 
49
45
  def execute(&block)
@@ -87,7 +83,15 @@ module Strum
87
83
  end
88
84
 
89
85
  def required(*keys)
90
- keys.each { |key| add_error(key, :field_must_exist) unless input[key] }
86
+ if input.is_a?(Hash)
87
+ keys.each { |key| add_error(key, :field_must_exist) unless input[key] }
88
+ else
89
+ add_error(:input, :must_be_hash)
90
+ end
91
+ end
92
+
93
+ def array!
94
+ self.input = [*input]
91
95
  end
92
96
 
93
97
  private
@@ -1,6 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- $LOAD_PATH.unshift(File.expand_path("..", __dir__), File.expand_path("../lib", __dir__))
3
+ $LOAD_PATH.unshift(
4
+ File.expand_path("..", __dir__),
5
+ File.expand_path("../lib", __dir__),
6
+ File.expand_path("../services", __dir__)
7
+ )
4
8
 
5
9
  ENV["RACK_ENV"] ||= "development"
6
10
 
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ threads 4, 16
4
+ workers ENV.fetch("PUMA_WORKERS", 4)
5
+
6
+ on_worker_boot do
7
+ # initialize worker variables
8
+ # rabbit connection, as example
9
+
10
+ # Rabbit.rabbit_connection ||= begin
11
+ # rabbit_connection = Bunny.new
12
+ # rabbit_connection.start
13
+ # rabbit_connection
14
+ # end
15
+ end
16
+
17
+ on_worker_shutdown do
18
+ # utilize worker variables
19
+ # rabbit connection, as example
20
+
21
+ # Rabbit.rabbit_connection.close
22
+ end
23
+
24
+ preload_app!
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Strum
4
- VERSION = "0.0.22"
4
+ VERSION = "0.0.23"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.22
4
+ version: 0.0.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Serhiy Nazarov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-21 00:00:00.000000000 Z
11
+ date: 2020-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-inflector
@@ -170,6 +170,7 @@ files:
170
170
  - lib/strum/templates/app/blank/config.ru.tt
171
171
  - lib/strum/templates/app/blank/config/app.rb.tt
172
172
  - lib/strum/templates/app/blank/config/env.rb
173
+ - lib/strum/templates/app/blank/config/puma.rb
173
174
  - lib/strum/templates/app/blank/lib/.keep
174
175
  - lib/strum/templates/app/blank/routes/.keep
175
176
  - lib/strum/templates/app/blank/services/.keep