counterwise 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/concerns/counter/definable.rb +16 -5
- data/lib/counter/integration/countable.rb +5 -0
- data/lib/counter/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: f1cdc6acd0972160c280ad8df73b8a97716f7cac8a5f2a8b45149c73426ece5f
|
4
|
+
data.tar.gz: e64e450d2e6e430db5acdd0042ec796183f7640cddffa6a1d86f8020846b284d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65ab2e425276794f29b05286566fdf6009833f500d57e521774dcccd99adca0e2068edf894dd9de667aebad8d0a246b819874554855fc678f1ba1e8aa00e522f
|
7
|
+
data.tar.gz: 40efd582468d6d310bb1487081202fd0912f3d77765656222d5a0f6b14bc5d237e846cbda25d80ebfc0060bbc7a1e1fedad65d91ffca152de437736e0a65117e
|
@@ -4,13 +4,24 @@ module Counter::Definable
|
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
6
|
included do
|
7
|
+
def definition= definition
|
8
|
+
@definition = definition
|
9
|
+
end
|
10
|
+
|
7
11
|
# Fetch the definition for this counter
|
8
12
|
def definition
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
13
|
+
@definition ||= begin
|
14
|
+
if parent.nil?
|
15
|
+
# We don't have a parent, so we're a global counter
|
16
|
+
Counter::Definition.find_definition name
|
17
|
+
else
|
18
|
+
parent.class.ancestors.find do |ancestor|
|
19
|
+
return nil if ancestor == ApplicationRecord
|
20
|
+
next unless ancestor.respond_to?(:counter_configs)
|
21
|
+
config = ancestor.counter_configs.find { |c| c.record_name == name }
|
22
|
+
return config if config
|
23
|
+
end
|
24
|
+
end
|
14
25
|
end
|
15
26
|
end
|
16
27
|
end
|
data/lib/counter/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: counterwise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Lawrence
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|