in_time_scope 0.1.1 → 0.1.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/in_time_scope/version.rb +1 -1
- data/lib/in_time_scope.rb +3 -4
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7ae5a251a71cec0f0ad9ac7890d9e1e88de46dade545cbfcff2cf0201d603939
|
|
4
|
+
data.tar.gz: 9a4c17e7f1ad5a1b62ebf37038332d43a7610fcce5f770e66df70e51670dc415
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4480bbfaee296c29a87e96b26c2f32f29a78792712765cb48b51699c01bc552526ab1764972bd6cb19bfa4ce5de115abd099a7d0abf8701a26fa69eedc780d6e
|
|
7
|
+
data.tar.gz: b905e3bf65da95f7b4868e49c386051616b071cd67de613617d0443caa4679cbb4cc0c729ca9b6ec2776a32af4cfda32deedd48d61ceca4d326c833748b382a4
|
data/lib/in_time_scope.rb
CHANGED
|
@@ -15,19 +15,18 @@ module InTimeScope
|
|
|
15
15
|
scope_name ||= :in_time
|
|
16
16
|
scope_prefix = scope_name == :in_time ? "" : "#{scope_name}_"
|
|
17
17
|
|
|
18
|
-
start_config = normalize_config(start_at, :"#{scope_prefix}start_at"
|
|
19
|
-
end_config = normalize_config(end_at, :"#{scope_prefix}end_at"
|
|
18
|
+
start_config = normalize_config(start_at, :"#{scope_prefix}start_at")
|
|
19
|
+
end_config = normalize_config(end_at, :"#{scope_prefix}end_at")
|
|
20
20
|
|
|
21
21
|
define_scope_methods(scope_name, start_config, end_config, prefix)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
private
|
|
25
25
|
|
|
26
|
-
def normalize_config(config, default_column
|
|
26
|
+
def normalize_config(config, default_column)
|
|
27
27
|
return { column: nil, null: true } if config[:column].nil? && config.key?(:column)
|
|
28
28
|
|
|
29
29
|
column = config[:column] || default_column
|
|
30
|
-
column = fallback_column unless column_names.include?(column.to_s)
|
|
31
30
|
column = nil unless column_names.include?(column.to_s)
|
|
32
31
|
|
|
33
32
|
null = config.key?(:null) ? config[:null] : column_nullable?(column)
|