nostalgic 0.5.2 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +3 -23
- data/lib/nostalgic/nostalgic_attr.rb +17 -38
- data/lib/nostalgic/version.rb +1 -1
- metadata +18 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1c913b6a9c20163ea1909c231cc1d79e41835bbd508f5f0da14e04fed37c3b5
|
4
|
+
data.tar.gz: 420b51558070d3ee4e6b0cd2f36604be960c413ac08a2a86bd8a8a5de859a17d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b99e202af9dfb5346a95da64b144e366dc3a2726b42d1fb52fcad2e4f646c16193d6f044a9633cbbc425fbd4857adef7c8ee1d82e07b074f2130e7ad9b22c320
|
7
|
+
data.tar.gz: 3df24780e47be0477a2c46e353188a6812392ed771584269c64d93fa8e6ddb58b89a30ccae70337345c96ba498d0b5b12c336780786235ac21bc20c03c80a827
|
data/Rakefile
CHANGED
@@ -1,32 +1,12 @@
|
|
1
|
-
|
2
|
-
require 'bundler/setup'
|
3
|
-
rescue LoadError
|
4
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
-
end
|
6
|
-
|
7
|
-
require 'rdoc/task'
|
8
|
-
|
9
|
-
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
-
rdoc.rdoc_dir = 'rdoc'
|
11
|
-
rdoc.title = 'Nostalgic'
|
12
|
-
rdoc.options << '--line-numbers'
|
13
|
-
rdoc.rdoc_files.include('README.md')
|
14
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
-
end
|
16
|
-
|
17
|
-
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
18
|
-
load 'rails/tasks/engine.rake'
|
19
|
-
|
20
|
-
load 'rails/tasks/statistics.rake'
|
21
|
-
|
22
|
-
require 'bundler/gem_tasks'
|
1
|
+
require "bundler/gem_tasks"
|
23
2
|
|
24
3
|
require 'rake/testtask'
|
25
4
|
|
26
5
|
Rake::TestTask.new(:test) do |t|
|
6
|
+
t.libs << 'lib'
|
27
7
|
t.libs << 'test'
|
28
8
|
t.pattern = 'test/**/*_test.rb'
|
29
9
|
t.verbose = false
|
30
10
|
end
|
31
11
|
|
32
|
-
task default
|
12
|
+
task :default => :test
|
@@ -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.1
|
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: 2024-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,76 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
-
- - "<"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: '6'
|
19
|
+
version: '5.2'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
30
|
-
- - "<"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: '6'
|
26
|
+
version: '5.2'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: bundler
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
36
30
|
requirements:
|
37
|
-
- - "
|
31
|
+
- - "~>"
|
38
32
|
- !ruby/object:Gem::Version
|
39
|
-
version: '0'
|
33
|
+
version: '2.0'
|
40
34
|
type: :development
|
41
35
|
prerelease: false
|
42
36
|
version_requirements: !ruby/object:Gem::Requirement
|
43
37
|
requirements:
|
44
|
-
- - "
|
38
|
+
- - "~>"
|
45
39
|
- !ruby/object:Gem::Version
|
46
|
-
version: '0'
|
40
|
+
version: '2.0'
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
42
|
name: minitest
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
50
44
|
requirements:
|
51
|
-
- - "
|
45
|
+
- - "~>"
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
47
|
+
version: '5.25'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
51
|
requirements:
|
58
|
-
- - "
|
52
|
+
- - "~>"
|
59
53
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
54
|
+
version: '5.25'
|
61
55
|
- !ruby/object:Gem::Dependency
|
62
56
|
name: rake
|
63
57
|
requirement: !ruby/object:Gem::Requirement
|
64
58
|
requirements:
|
65
|
-
- - "
|
59
|
+
- - "~>"
|
66
60
|
- !ruby/object:Gem::Version
|
67
|
-
version: '0'
|
61
|
+
version: '12.0'
|
68
62
|
type: :development
|
69
63
|
prerelease: false
|
70
64
|
version_requirements: !ruby/object:Gem::Requirement
|
71
65
|
requirements:
|
72
|
-
- - "
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version: '0'
|
75
|
-
- !ruby/object:Gem::Dependency
|
76
|
-
name: sqlite3
|
77
|
-
requirement: !ruby/object:Gem::Requirement
|
78
|
-
requirements:
|
79
|
-
- - ">="
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: '0'
|
82
|
-
type: :development
|
83
|
-
prerelease: false
|
84
|
-
version_requirements: !ruby/object:Gem::Requirement
|
85
|
-
requirements:
|
86
|
-
- - ">="
|
66
|
+
- - "~>"
|
87
67
|
- !ruby/object:Gem::Version
|
88
|
-
version: '0'
|
68
|
+
version: '12.0'
|
89
69
|
description: column versioning utility
|
90
70
|
email:
|
91
71
|
- ichylinux@gmail.com
|
@@ -135,14 +115,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
135
115
|
requirements:
|
136
116
|
- - ">="
|
137
117
|
- !ruby/object:Gem::Version
|
138
|
-
version: 2.
|
118
|
+
version: 2.7.0
|
139
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
120
|
requirements:
|
141
121
|
- - ">="
|
142
122
|
- !ruby/object:Gem::Version
|
143
123
|
version: '0'
|
144
124
|
requirements: []
|
145
|
-
rubygems_version: 3.
|
125
|
+
rubygems_version: 3.4.22
|
146
126
|
signing_key:
|
147
127
|
specification_version: 4
|
148
128
|
summary: column versioning utility
|