strum 0.0.24 → 0.0.25

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: bc7336797dffa593b1ded3db023942532139be3dc9acc0db1db24d6f69996b48
4
- data.tar.gz: ee8e8d2814c4647eef0dfb9719ed6a73b9177c2cb4e9d347073d6de983dbaab2
3
+ metadata.gz: 1fe0b1d1b61058e17af6b6e7b9cf775cd5cdfa0c8ace295f1424f274ffbaaadf
4
+ data.tar.gz: 668ed074e8870bcdaa8badf23bed56b18a9f1ba98c4c91ba9f9aba9965145d2a
5
5
  SHA512:
6
- metadata.gz: b84068b05010c295455cc6921cdb5e6b6eba9261b77f8d8b6500a2392a02084391f1e06b3cd02b6c3f6992dc6172f1f1ceb94ebe44a0299d9556199eca210ff8
7
- data.tar.gz: 6da2e5f49d7bd908ab608fda80d85f2c1dc01a7c14681669b2b91e051da1c8e87e351334dc2963d872f2e5a4ff5b9c71f3b5a999cd7bdf6c585822825ed6ece6
6
+ metadata.gz: 9521ad19dcd7ec87e2870128bb7b4cb32a4de5a8bb3647a9a7a615fa13ae462160e98611113373fff0a2189f25bcc323e4c7b83da0808c6479c38d027fa250ac
7
+ data.tar.gz: '08a0b846e11138e6a0a38f9aadad666871a1d2bb6064a4270531ee33f8a901e80a13502605e2ec8d2f4429ccf464ac598c6d1dfb94b0060a17fce51971c74f9b'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- strum (0.0.24)
4
+ strum (0.0.25)
5
5
  dry-inflector (~> 0.2.0)
6
6
  dry-matcher (~> 0.8.2)
7
7
  thor (~> 0.20)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Strum
2
4
  class Chain
3
5
  include Strum::Service
@@ -12,11 +14,11 @@ module Strum
12
14
  while (service = chain.shift) && valid?
13
15
  service.public_send(:call, output) do |m|
14
16
  m.success do |result|
15
- if @output.is_a?(Hash) && result.is_a?(Hash)
16
- @output = @output.merge(result)
17
- else
18
- @output = result
19
- end
17
+ @output = if @output.is_a?(Hash) && result.is_a?(Hash)
18
+ @output.merge(result)
19
+ else
20
+ result
21
+ end
20
22
  end
21
23
  m.failure { |errors| add_errors(errors) }
22
24
  end
@@ -24,4 +26,4 @@ module Strum
24
26
  valid? ? valid_result(&block) : invalid_result(&block)
25
27
  end
26
28
  end
27
- end
29
+ end
@@ -1,9 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Strum
2
4
  module Commands
3
5
  module Mixin
4
6
  # Is it strum folder
5
7
  module AppCheck
6
8
  protected
9
+
7
10
  class StrumGenerateError < StandardError; end
8
11
 
9
12
  def app_class_name
@@ -18,4 +21,4 @@ module Strum
18
21
  end
19
22
  end
20
23
  end
21
- end
24
+ end
@@ -45,7 +45,7 @@ module Strum::Commands::Resource
45
45
  if model?
46
46
  "#{new_migration_number}_create_#{table_name}"
47
47
  else
48
- "#{new_migration_number}_#{name_components.join("_")}"
48
+ "#{new_migration_number}_#{name_components.join('_')}"
49
49
  end
50
50
  end
51
51
 
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "strum/serializer_name"
4
+
5
+ module Strum
6
+ module JsonSerializer
7
+ def self.const_missing(name)
8
+ Class.new do
9
+ include Strum::Service
10
+ define_method :call do
11
+ serializer_class = Strum::SerializerName.call(name: name)
12
+ @output = serializer_class.new(input).serializable_hash
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "strum/service"
4
+
5
+ module Strum
6
+ class SerializerName
7
+ include Strum::Service
8
+
9
+ def call
10
+ @output = Kernel.const_get(input[:name].to_s + "Serializer")
11
+ rescue StandardError => e
12
+ add_error(:serializer, e)
13
+ end
14
+
15
+ def audit
16
+ required(:name)
17
+ end
18
+ end
19
+ end
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  $LOAD_PATH.unshift(
4
- File.expand_path("..", __dir__),
5
- File.expand_path("../lib", __dir__),
6
- File.expand_path("../services", __dir__)
4
+ File.expand_path("..", __dir__),
5
+ File.expand_path("../lib", __dir__),
6
+ File.expand_path("../services", __dir__)
7
7
  )
8
8
 
9
9
  ENV["RACK_ENV"] ||= "development"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Strum
4
- VERSION = "0.0.24"
4
+ VERSION = "0.0.25"
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.24
4
+ version: 0.0.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Serhiy Nazarov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-10 00:00:00.000000000 Z
11
+ date: 2020-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-inflector
@@ -156,6 +156,8 @@ files:
156
156
  - lib/strum/commands/resource/scaffold.rb
157
157
  - lib/strum/commands/resource/serializer.rb
158
158
  - lib/strum/commands/resource/service.rb
159
+ - lib/strum/json_serializer.rb
160
+ - lib/strum/serializer_name.rb
159
161
  - lib/strum/service.rb
160
162
  - lib/strum/sub_command_base.rb
161
163
  - lib/strum/tasks/sequel.rake