nostalgic 0.5.2 → 0.6.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/nostalgic/nostalgic_attr.rb +17 -38
- data/lib/nostalgic/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f714bb70f485db22d0910b1529315a6acd2f0d9db84f2835efaada57a32ca37c
|
4
|
+
data.tar.gz: 74f4bc356fe080d08125998b1eb4c6f1f5f7819674f5270c06d0cb5ba787ec57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7f49d3fba6fffeec8248adf4323d47f170121431974a61b3c674facf8ad7187baca20f34acc52d88d9c2359c6fb7fb8439942347faa43e1cf301cd529e6236a
|
7
|
+
data.tar.gz: 0456f778b53c9c7be2166b96b9488f8fcd4de035e7fad95c4e54645f99899de9b78c60dcee90531b4cb4167d65f2fcc55386f396288246778096ed66c204e955
|
@@ -68,46 +68,25 @@ module Nostalgic
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
METHODS
|
88
|
-
end
|
89
|
-
end
|
90
|
-
else
|
91
|
-
def belongs_to(name, scope = nil, options = {})
|
92
|
-
scope ||= {}
|
93
|
-
super(name, scope.except(:nostalgic), options)
|
94
|
-
|
95
|
-
if scope.fetch(:nostalgic, false)
|
96
|
-
foreign_key = options.fetch(:foreign_key, "#{name}_id")
|
97
|
-
nostalgic_attr foreign_key
|
98
|
-
|
99
|
-
class_eval <<-METHODS, __FILE__, __LINE__ + 1
|
100
|
-
def #{name}_on(date)
|
101
|
-
return self.#{name} unless date.present?
|
102
|
-
|
103
|
-
'#{name}'.classify.constantize.find_by_id(#{foreign_key}_on(date))
|
104
|
-
end
|
105
|
-
|
106
|
-
alias_method :#{name}_at, :#{name}_on
|
107
|
-
METHODS
|
108
|
-
end
|
71
|
+
def belongs_to(name, scope = nil, **options)
|
72
|
+
super(name, scope, **options.except(:nostalgic))
|
73
|
+
|
74
|
+
if options.fetch(:nostalgic, false)
|
75
|
+
foreign_key = options.fetch(:foreign_key, "#{name}_id")
|
76
|
+
nostalgic_attr foreign_key
|
77
|
+
|
78
|
+
class_eval <<-METHODS, __FILE__, __LINE__ + 1
|
79
|
+
def #{name}_on(date)
|
80
|
+
return self.#{name} unless date.present?
|
81
|
+
|
82
|
+
'#{name}'.classify.constantize.find_by_id(#{foreign_key}_on(date))
|
83
|
+
end
|
84
|
+
|
85
|
+
alias_method :#{name}_at, :#{name}_on
|
86
|
+
METHODS
|
109
87
|
end
|
110
88
|
end
|
89
|
+
|
111
90
|
end
|
112
91
|
end
|
113
92
|
end
|
data/lib/nostalgic/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nostalgic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ichy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5.2'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '7'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
29
|
+
version: '5.2'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '7'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: bundler
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -135,14 +135,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
135
135
|
requirements:
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 2.
|
138
|
+
version: 2.7.0
|
139
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
140
|
requirements:
|
141
141
|
- - ">="
|
142
142
|
- !ruby/object:Gem::Version
|
143
143
|
version: '0'
|
144
144
|
requirements: []
|
145
|
-
rubygems_version: 3.
|
145
|
+
rubygems_version: 3.3.10
|
146
146
|
signing_key:
|
147
147
|
specification_version: 4
|
148
148
|
summary: column versioning utility
|