steel_wheel 0.8.0 → 0.8.1

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: 63187c69f05601bdc4504a3b85244d9ecd14c7ed882434ae3c87526f39e57b9a
4
- data.tar.gz: 5c7734353306c7f214b370a35206cc71f3eb903a1b79b0b3331cba999afca3a0
3
+ metadata.gz: 912e93a5e7a633d15cfb74c32537ba1d2521205caa018415a21ece318c8a21db
4
+ data.tar.gz: 6e2a4b01be53efb80daa8c2f02638bb2e03fcf49d2ebe445a9fa7fe3c60ddd8a
5
5
  SHA512:
6
- metadata.gz: ac0acddfa4074ac236e3f2bc1b2693d6cf58fb99f0da6c06bd8c409c53d625da91fdc384ec629cb7646edd0c82fe3ce4107338156fb068f4574772ca572d97ef
7
- data.tar.gz: 81f1ff20c703273f06f683e836c6fc5966f5d1ed308f7ab0b45714b05bdae01ea2778116826a4c8cb3ecdbb1b4b9ec2e4db9b98ede03eb403b08a2011e5996ec
6
+ metadata.gz: 07c425b762ca98490f0399a5d8eb5556fc86254817ad2a4d0ee1be127aa18b5fa76449639cee6c7785614fce1d0fe7cc6b98b8158c91fdc297304ff8b8425f5b
7
+ data.tar.gz: 2fe241132614b31f1144e25b4dd9df50c8c80e72f92cf0222f18c365674951455c2fd9ce711aaab13bd9f73f2ac8a1207040d2f0a032442d5c683384545e8cc7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- steel_wheel (0.8.0)
4
+ steel_wheel (0.8.1)
5
5
  action_form (~> 0.6.6)
6
6
  easy_params (~> 0.9.1)
7
7
  memery (~> 1)
@@ -10,13 +10,13 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- action_form (0.6.6)
13
+ action_form (0.6.7)
14
14
  easy_params (~> 0.9.1)
15
15
  phlex (>= 2)
16
16
  railties (>= 6.0.0)
17
- actionpack (8.1.1)
18
- actionview (= 8.1.1)
19
- activesupport (= 8.1.1)
17
+ actionpack (8.1.3)
18
+ actionview (= 8.1.3)
19
+ activesupport (= 8.1.3)
20
20
  nokogiri (>= 1.8.5)
21
21
  rack (>= 2.2.4)
22
22
  rack-session (>= 1.0.1)
@@ -24,15 +24,15 @@ GEM
24
24
  rails-dom-testing (~> 2.2)
25
25
  rails-html-sanitizer (~> 1.6)
26
26
  useragent (~> 0.16)
27
- actionview (8.1.1)
28
- activesupport (= 8.1.1)
27
+ actionview (8.1.3)
28
+ activesupport (= 8.1.3)
29
29
  builder (~> 3.1)
30
30
  erubi (~> 1.11)
31
31
  rails-dom-testing (~> 2.2)
32
32
  rails-html-sanitizer (~> 1.6)
33
- activemodel (8.1.1)
34
- activesupport (= 8.1.1)
35
- activesupport (8.1.1)
33
+ activemodel (8.1.3)
34
+ activesupport (= 8.1.3)
35
+ activesupport (8.1.3)
36
36
  base64
37
37
  bigdecimal
38
38
  concurrent-ruby (~> 1.0, >= 1.3.1)
@@ -47,38 +47,41 @@ GEM
47
47
  uri (>= 0.13.1)
48
48
  ast (2.4.3)
49
49
  base64 (0.3.0)
50
- bigdecimal (3.3.1)
50
+ bigdecimal (4.1.2)
51
51
  builder (3.3.0)
52
52
  coderay (1.1.3)
53
- concurrent-ruby (1.3.5)
54
- connection_pool (2.5.4)
53
+ concurrent-ruby (1.3.6)
54
+ connection_pool (3.0.2)
55
55
  crass (1.0.6)
56
- date (3.5.0)
56
+ date (3.5.1)
57
57
  diff-lcs (1.6.2)
58
58
  docile (1.4.1)
59
59
  drb (2.2.3)
60
60
  easy_params (0.9.1)
61
61
  activemodel (>= 3.2)
62
- erb (6.0.0)
62
+ erb (6.0.4)
63
63
  erubi (1.13.1)
64
- i18n (1.14.7)
64
+ i18n (1.14.8)
65
65
  concurrent-ruby (~> 1.0)
66
- io-console (0.8.1)
67
- irb (1.15.3)
66
+ io-console (0.8.2)
67
+ irb (1.18.0)
68
68
  pp (>= 0.6.0)
69
+ prism (>= 1.3.0)
69
70
  rdoc (>= 4.0.0)
70
71
  reline (>= 0.4.2)
71
72
  json (2.15.2)
72
73
  language_server-protocol (3.17.0.5)
73
74
  lint_roller (1.1.0)
74
75
  logger (1.7.0)
75
- loofah (2.24.1)
76
+ loofah (2.25.1)
76
77
  crass (~> 1.0.2)
77
78
  nokogiri (>= 1.12.0)
78
79
  memery (1.8.0)
79
80
  method_source (1.1.0)
80
81
  mini_portile2 (2.8.9)
81
- minitest (5.26.1)
82
+ minitest (6.0.6)
83
+ drb (~> 2.0)
84
+ prism (~> 1.5)
82
85
  nokogiri (1.18.1)
83
86
  mini_portile2 (~> 2.8.2)
84
87
  racc (~> 1.4)
@@ -88,7 +91,8 @@ GEM
88
91
  parser (3.3.10.0)
89
92
  ast (~> 2.4.1)
90
93
  racc
91
- phlex (2.3.1)
94
+ phlex (2.4.1)
95
+ refract (~> 1.0)
92
96
  zeitwerk (~> 2.7)
93
97
  pp (0.6.3)
94
98
  prettyprint
@@ -97,28 +101,28 @@ GEM
97
101
  pry (0.15.2)
98
102
  coderay (~> 1.1)
99
103
  method_source (~> 1.0)
100
- psych (5.2.6)
104
+ psych (5.4.0)
101
105
  date
102
106
  stringio
103
107
  racc (1.8.1)
104
- rack (3.2.4)
105
- rack-session (2.1.1)
108
+ rack (3.2.6)
109
+ rack-session (2.1.2)
106
110
  base64 (>= 0.1.0)
107
111
  rack (>= 3.0.0)
108
112
  rack-test (2.2.0)
109
113
  rack (>= 1.3)
110
- rackup (2.2.1)
114
+ rackup (2.3.1)
111
115
  rack (>= 3)
112
116
  rails-dom-testing (2.3.0)
113
117
  activesupport (>= 5.0.0)
114
118
  minitest
115
119
  nokogiri (>= 1.6)
116
- rails-html-sanitizer (1.6.2)
117
- loofah (~> 2.21)
120
+ rails-html-sanitizer (1.7.0)
121
+ loofah (~> 2.25)
118
122
  nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
119
- railties (8.1.1)
120
- actionpack (= 8.1.1)
121
- activesupport (= 8.1.1)
123
+ railties (8.1.3)
124
+ actionpack (= 8.1.3)
125
+ activesupport (= 8.1.3)
122
126
  irb (~> 1.13)
123
127
  rackup (>= 1.0.0)
124
128
  rake (>= 12.2)
@@ -127,10 +131,13 @@ GEM
127
131
  zeitwerk (~> 2.6)
128
132
  rainbow (3.1.1)
129
133
  rake (13.3.1)
130
- rdoc (6.15.1)
134
+ rdoc (7.2.0)
131
135
  erb
132
136
  psych (>= 4.0.0)
133
137
  tsort
138
+ refract (1.1.0)
139
+ prism
140
+ zeitwerk
134
141
  regexp_parser (2.11.3)
135
142
  reline (0.6.3)
136
143
  io-console (~> 0.5)
@@ -171,8 +178,8 @@ GEM
171
178
  simplecov_json_formatter (~> 0.1)
172
179
  simplecov-html (0.13.2)
173
180
  simplecov_json_formatter (0.1.4)
174
- stringio (3.1.8)
175
- thor (1.4.0)
181
+ stringio (3.2.0)
182
+ thor (1.5.0)
176
183
  tsort (0.2.0)
177
184
  tzinfo (2.0.6)
178
185
  concurrent-ruby (~> 1.0)
@@ -181,7 +188,7 @@ GEM
181
188
  unicode-emoji (4.1.0)
182
189
  uri (1.1.1)
183
190
  useragent (0.16.11)
184
- zeitwerk (2.7.3)
191
+ zeitwerk (2.8.2)
185
192
 
186
193
  PLATFORMS
187
194
  arm64-darwin
@@ -9,20 +9,35 @@ module SteelWheel # rubocop:disable Style/Documentation
9
9
  end
10
10
 
11
11
  module ClassMethods # rubocop:disable Style/Documentation
12
- def action(action_name, handler: action_name, &block)
12
+ def action(action_name, handler: action_name, with_handlers: [], &block)
13
+ composed_handlers = Array(with_handlers)
14
+
13
15
  define_method(action_name) do
14
- handler_klass = handler_class_for(handler)
15
- handler_klass.handle(params) do |handler_instance|
16
- handler_instance.owner = self
17
- handler_instance.helpers = view_context
18
- instance_exec(handler_instance, &block)
19
- failure_callbacks(handler_instance)
20
- end
16
+ run_action(handler, composed_handlers, &block)
21
17
  end
22
18
  end
23
19
  end
24
20
 
25
21
  module InstanceMethods # rubocop:disable Style/Documentation
22
+ def run_action(handler, composed_handlers, &block)
23
+ compose_handler(handler).handle do |primary_handler|
24
+ if composed_handlers.empty?
25
+ instance_exec(primary_handler, &block)
26
+ else
27
+ handlers = [primary_handler, *composed_handlers.map { |name| compose_handler(name) }]
28
+ instance_exec(*handlers, &block)
29
+ end
30
+ failure_callbacks(primary_handler)
31
+ end
32
+ end
33
+
34
+ def compose_handler(handler_name, handler_params = params)
35
+ handler_class_for(handler_name).new(handler_params).tap do |handler|
36
+ handler.helpers = view_context
37
+ handler.owner = self
38
+ end
39
+ end
40
+
26
41
  def handler_class_for(handler)
27
42
  different_namespace = handler.to_s.split('/').size > 1
28
43
  return "#{handler.to_s.camelize}Handler".constantize if different_namespace
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SteelWheel
4
- VERSION = '0.8.0'
4
+ VERSION = '0.8.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: steel_wheel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrii Baran
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  requirements: []
154
- rubygems_version: 3.7.1
154
+ rubygems_version: 4.0.13
155
155
  specification_version: 4
156
156
  summary: Adds operations to your rails code
157
157
  test_files: []