granite 0.12.1 → 0.13.0
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 +4 -4
- data/lib/granite/action/transaction_manager.rb +1 -1
- data/lib/granite/performer_proxy/proxy.rb +3 -1
- data/lib/granite/projector/helpers.rb +1 -2
- data/lib/granite/rspec/projector_helpers.rb +4 -10
- data/lib/granite/ruby3_compatibility.rb +15 -0
- data/lib/granite/version.rb +1 -1
- data/lib/granite.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17fb5bd6029503d159cdb3e5dd88d0f58961a30e81e1752327bc261733c62df9
|
4
|
+
data.tar.gz: cf15fd7b77203667a28c57ede076ee17a1df1014eca1cf97f15cc6efc2a3755a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3540905bc5f0198b002bfd0be1c7a2dca41b594c6a21538c4cfa0763d85fe770fafb45227fb6f28b73e206b63dfe302a3cbe04af97cfe1e1f055f9adaa48f4dc
|
7
|
+
data.tar.gz: f8837fc5c591f9c4169bcf60f6c6c9de8a3158e66c52d961b871f8bfe753f63ee353d7e560fa7fd3cb8667656fb30da01acf2065377ea50d6162f74ce8757202
|
@@ -4,6 +4,8 @@ module Granite
|
|
4
4
|
# performer-enabled context.
|
5
5
|
#
|
6
6
|
class Proxy
|
7
|
+
extend Granite::Ruby3Compatibility
|
8
|
+
|
7
9
|
def initialize(klass, performer)
|
8
10
|
@klass = klass
|
9
11
|
@performer = performer
|
@@ -13,7 +15,7 @@ module Granite
|
|
13
15
|
"<#{@klass}PerformerProxy #{@performer}>"
|
14
16
|
end
|
15
17
|
|
16
|
-
def method_missing(method, *args, &block)
|
18
|
+
ruby2_keywords def method_missing(method, *args, &block)
|
17
19
|
if @klass.respond_to?(method)
|
18
20
|
@klass.with_proxy_performer(@performer) do
|
19
21
|
@klass.public_send(method, *args, &block)
|
@@ -35,8 +35,7 @@ Do you have #{projector.action_class.name.underscore}##{projector.projector_name
|
|
35
35
|
|
36
36
|
def required_params
|
37
37
|
corresponding_route.required_parts
|
38
|
-
.
|
39
|
-
.to_h
|
38
|
+
.to_h { |name| [name, action.public_send(name)] }
|
40
39
|
end
|
41
40
|
|
42
41
|
def corresponding_route
|
@@ -30,16 +30,10 @@ module Granite::ProjectorHelpers
|
|
30
30
|
|
31
31
|
private
|
32
32
|
|
33
|
-
def setup_controller
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
before do
|
40
|
-
@controller = yield.controller_class.new
|
41
|
-
@controller.class.instance_variable_set(:@controller_path, yield.projector_path)
|
42
|
-
@controller.request = @request
|
33
|
+
def setup_controller(&block)
|
34
|
+
define_method :setup_controller_request_and_response do
|
35
|
+
@controller ||= instance_eval(&block).controller_class.new
|
36
|
+
super()
|
43
37
|
end
|
44
38
|
end
|
45
39
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Granite
|
2
|
+
module Ruby3Compatibility
|
3
|
+
# Method definition aimed to provide compatibility between Ruby 2.6 and 3.0
|
4
|
+
# It's being recommended in this article
|
5
|
+
# https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/
|
6
|
+
#
|
7
|
+
# Example:
|
8
|
+
#
|
9
|
+
# ruby2_keywords def a_method(argument, *args, &block)
|
10
|
+
# delegating_to_method(argument, *args, &block)
|
11
|
+
# end
|
12
|
+
def ruby2_keywords(*)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/granite/version.rb
CHANGED
data/lib/granite.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: granite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toptal Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -372,6 +372,7 @@ files:
|
|
372
372
|
- lib/granite/rspec/projector_helpers.rb
|
373
373
|
- lib/granite/rspec/raise_validation_error.rb
|
374
374
|
- lib/granite/rspec/satisfy_preconditions.rb
|
375
|
+
- lib/granite/ruby3_compatibility.rb
|
375
376
|
- lib/granite/translations.rb
|
376
377
|
- lib/granite/typecasters.rb
|
377
378
|
- lib/granite/util.rb
|
@@ -398,7 +399,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
398
399
|
- !ruby/object:Gem::Version
|
399
400
|
version: '0'
|
400
401
|
requirements: []
|
401
|
-
rubygems_version: 3.
|
402
|
+
rubygems_version: 3.3.17
|
402
403
|
signing_key:
|
403
404
|
specification_version: 4
|
404
405
|
summary: Another business actions architecture for Rails apps
|