coactive 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/coactive/coactions.rb +15 -5
- data/lib/coactive/lookups/name.rb +2 -2
- data/lib/coactive/railtie.rb +1 -0
- data/lib/coactive/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b15dae4695420734d0486669dd7f88d7eeceb8815932dc5f47d37cedf0dd4c61
|
4
|
+
data.tar.gz: cd7f7aae30957f69c76230b8cb97ca846ad4d4c99f6c02045f54b9c866d2ec68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eebff4ac3fdb067eb44a59ffc634e4fdda567663e6be2c30923828a311f29a52679ea2aaf3295e17412ee492ef3705c1ff200a0065f5bfee03bbf36a045dd007
|
7
|
+
data.tar.gz: e94206eda575c397edc5686fe012cf7ebd66074fa74b1a4215c733d7462b01099a9e2d537041749a039bcfe079bbf4ade6c71d4c2a249e65fa2849175ed94532
|
data/CHANGELOG.md
CHANGED
data/lib/coactive/coactions.rb
CHANGED
@@ -6,16 +6,26 @@ module Coactive
|
|
6
6
|
module Coactions
|
7
7
|
extend ActiveSupport::Concern
|
8
8
|
|
9
|
-
|
10
|
-
class_attribute :
|
11
|
-
self.
|
9
|
+
class << self
|
10
|
+
class_attribute :registry
|
11
|
+
self.registry = {}
|
12
|
+
|
13
|
+
def [](base, name)
|
14
|
+
registry.dig(base, name)
|
15
|
+
end
|
16
|
+
|
17
|
+
def []=(base, name, array)
|
18
|
+
registry[base] ||= {}
|
19
|
+
registry[base][name] = array
|
20
|
+
end
|
12
21
|
end
|
13
22
|
|
14
23
|
class_methods do
|
15
24
|
def coaction(*names, **options)
|
25
|
+
base = coactive_config.base_class
|
16
26
|
names.each do |name|
|
17
|
-
coactions =
|
18
|
-
|
27
|
+
coactions = Coactions[base, name].to_a + [Coaction.new(self, name, options)]
|
28
|
+
Coactions[base, name] = coactions.sort_by.with_index { |coaction, i| [coaction.priority, i] }
|
19
29
|
end
|
20
30
|
end
|
21
31
|
end
|
@@ -11,11 +11,11 @@ module Coactive
|
|
11
11
|
private
|
12
12
|
|
13
13
|
def load_files
|
14
|
-
|
14
|
+
Loader.call(@config.load_paths)
|
15
15
|
end
|
16
16
|
|
17
17
|
def lookup
|
18
|
-
@config.base_class
|
18
|
+
Coactions[@config.base_class, @coactant].to_a.map(&:coactor)
|
19
19
|
end
|
20
20
|
|
21
21
|
class << self
|
data/lib/coactive/railtie.rb
CHANGED
data/lib/coactive/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coactive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yoshikazu Kaneta
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|