pick_a_record 0.0.1 → 0.0.2
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/pick_a_record/selector.rb +10 -2
- data/lib/pick_a_record/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ace52706d23b8b557163c357117779329a05eb0c
|
4
|
+
data.tar.gz: 36899157a133ba8ff2b22ca4058cc7d77e4af330
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e31805a0cbe3b457e28df394cc7c67b3e7193f425040409ff3fb80c4be76b09e4d2a1a1d781f8c4b07452a4e1585f2bfda1d06c1a0f1d8fabe77736d1b8ee3fc
|
7
|
+
data.tar.gz: 89063ae6321fc9d06e7f364f6609e6c634b9438f6985c1f9e9e95f4c974bc44b6fae4632a6750cbb275183c67fc7282b274ef310796d1f9d771b25acba261f73
|
@@ -14,13 +14,13 @@ class PickARecord::Selector < Module
|
|
14
14
|
# @!attribute [rw] source_scope
|
15
15
|
# The source to draw a random record from.
|
16
16
|
# @return [Proc, Symbol]
|
17
|
-
|
17
|
+
attr_accessor :source_scope
|
18
18
|
|
19
19
|
calculi_computed :full_name do
|
20
20
|
[prefix, name].compact.join('_').to_sym
|
21
21
|
end
|
22
22
|
|
23
|
-
options! :name, prefix: 'random', store_last: 5, duration: 1.day
|
23
|
+
options! :name, prefix: 'random', store_last: 5, duration: 1.day, source_scope: :scoped
|
24
24
|
|
25
25
|
# @!group Duration attributes
|
26
26
|
|
@@ -41,6 +41,14 @@ class PickARecord::Selector < Module
|
|
41
41
|
# @!endgroup
|
42
42
|
|
43
43
|
calculi_functions do
|
44
|
+
function :meta_module do
|
45
|
+
name { "meta_module_for_#{full_name}" }
|
46
|
+
|
47
|
+
body do |target, fn, args|
|
48
|
+
target
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
44
52
|
function :cache_key do
|
45
53
|
name { "#{full_name}_cache_key" }
|
46
54
|
|