date_flag 1.0.6 → 1.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/LICENSE +1 -1
- data/README.md +2 -2
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/date_flag.gemspec +7 -8
- data/lib/date_flag.rb +17 -1
- metadata +9 -10
- data/Gemfile.lock +0 -182
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f7119a76c1320d2980f404c90ff76726b8322e43e40c6a0d3f77714838fc28f
|
4
|
+
data.tar.gz: 9c1094f7e131296518442433109fe71803f80982ae5409b85f1a62106749824f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4698721a9a43803a7cd9d0a2f42af08c3751b7392d50c9eb86e3bb93f95254d69dd0f3bef25a380a6e9a3e0511fc773013701828610eff8840d8f24143389fe
|
7
|
+
data.tar.gz: a269aed2ac3d8ffcde6327a5c854e47a9d70a7dd2aa884e7c6058654e36e711b7b2f45726e77b2e51340a15b234c1e175a3b702ae1672177b26d3719cc599230
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -41,7 +41,7 @@ method to unset the flag with the supplied name. If `:inverse` is set, that
|
|
41
41
|
name will be used by default.
|
42
42
|
|
43
43
|
These might be used together like this:
|
44
|
-
|
44
|
+
|
45
45
|
date_flag :was_published_at,
|
46
46
|
name: :published,
|
47
47
|
scope: :published,
|
@@ -55,4 +55,4 @@ This results in instance methods `publish!` but the scopes are named
|
|
55
55
|
|
56
56
|
## License
|
57
57
|
|
58
|
-
(C) 2009-
|
58
|
+
(C) 2009-2020 Scott Tadman, [PostageApp Ltd.](https://postageapp.com/)
|
data/Rakefile
CHANGED
@@ -21,10 +21,10 @@ Jeweler::Tasks.new do |gem|
|
|
21
21
|
gem.name = "date_flag"
|
22
22
|
gem.summary = %Q{Date field exension for ActiveRecord}
|
23
23
|
gem.description = %Q{Represents boolean fields as DateTime values to trigger events in the future or record when events happened in the past.}
|
24
|
-
gem.email = '
|
25
|
-
gem.homepage = "
|
24
|
+
gem.email = 'tadman@postageapp.com'
|
25
|
+
gem.homepage = "https://github.com/postageapp/date_flag"
|
26
26
|
gem.authors = [
|
27
|
-
"Scott Tadman <
|
27
|
+
"Scott Tadman <tadman@postageapp.com>"
|
28
28
|
]
|
29
29
|
end
|
30
30
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.2
|
data/date_flag.gemspec
CHANGED
@@ -2,25 +2,24 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: date_flag 1.
|
5
|
+
# stub: date_flag 1.1.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "date_flag".freeze
|
9
|
-
s.version = "1.
|
9
|
+
s.version = "1.1.2"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
|
-
s.authors = ["Scott Tadman <
|
14
|
-
s.date = "
|
13
|
+
s.authors = ["Scott Tadman <tadman@postageapp.com>".freeze]
|
14
|
+
s.date = "2022-07-20"
|
15
15
|
s.description = "Represents boolean fields as DateTime values to trigger events in the future or record when events happened in the past.".freeze
|
16
|
-
s.email = "
|
16
|
+
s.email = "tadman@postageapp.com".freeze
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"LICENSE",
|
19
19
|
"README.md"
|
20
20
|
]
|
21
21
|
s.files = [
|
22
22
|
"Gemfile",
|
23
|
-
"Gemfile.lock",
|
24
23
|
"LICENSE",
|
25
24
|
"README.md",
|
26
25
|
"Rakefile",
|
@@ -31,8 +30,8 @@ Gem::Specification.new do |s|
|
|
31
30
|
"test/date_flag_test.rb",
|
32
31
|
"test/test_helper.rb"
|
33
32
|
]
|
34
|
-
s.homepage = "
|
35
|
-
s.rubygems_version = "3.
|
33
|
+
s.homepage = "https://github.com/postageapp/date_flag".freeze
|
34
|
+
s.rubygems_version = "3.3.7".freeze
|
36
35
|
s.summary = "Date field exension for ActiveRecord".freeze
|
37
36
|
|
38
37
|
if s.respond_to? :specification_version then
|
data/lib/date_flag.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'set'
|
2
|
+
|
1
3
|
module DateFlag
|
2
4
|
VERSION = File.read(File.expand_path('../VERSION', File.dirname(__FILE__))).chomp
|
3
5
|
|
@@ -14,9 +16,16 @@ module DateFlag
|
|
14
16
|
# m.flagged? # => true
|
15
17
|
|
16
18
|
def date_flag(field, options = { })
|
19
|
+
unless (defined?(@date_flags))
|
20
|
+
@date_flags = Set.new
|
21
|
+
end
|
22
|
+
|
17
23
|
name = (options[:name] ? options[:name] : field.to_s.sub(/_at$/, '')).to_sym
|
18
24
|
action = (options[:action] ? options[:action] : name).to_sym
|
19
25
|
|
26
|
+
@date_flags << name
|
27
|
+
@date_flags << :"#{name}_at"
|
28
|
+
|
20
29
|
scope_name =
|
21
30
|
case (options[:scope])
|
22
31
|
when nil, true
|
@@ -63,7 +72,7 @@ module DateFlag
|
|
63
72
|
if (inverse_action = options[:inverse_action] || options[:inverse])
|
64
73
|
define_method(:"#{inverse_action}!") do
|
65
74
|
write_attribute(field, nil)
|
66
|
-
|
75
|
+
|
67
76
|
save!
|
68
77
|
end
|
69
78
|
end
|
@@ -121,6 +130,13 @@ module DateFlag
|
|
121
130
|
save!
|
122
131
|
end
|
123
132
|
end
|
133
|
+
|
134
|
+
def date_flag?(name)
|
135
|
+
return false unless (defined?(@date_flags))
|
136
|
+
return unless (name)
|
137
|
+
|
138
|
+
@date_flags.include?(name.to_sym)
|
139
|
+
end
|
124
140
|
end
|
125
141
|
|
126
142
|
if (defined?(ActiveRecord))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: date_flag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Scott Tadman <
|
8
|
-
autorequire:
|
7
|
+
- Scott Tadman <tadman@postageapp.com>
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -82,7 +82,7 @@ dependencies:
|
|
82
82
|
version: '0'
|
83
83
|
description: Represents boolean fields as DateTime values to trigger events in the
|
84
84
|
future or record when events happened in the past.
|
85
|
-
email:
|
85
|
+
email: tadman@postageapp.com
|
86
86
|
executables: []
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files:
|
@@ -90,7 +90,6 @@ extra_rdoc_files:
|
|
90
90
|
- README.md
|
91
91
|
files:
|
92
92
|
- Gemfile
|
93
|
-
- Gemfile.lock
|
94
93
|
- LICENSE
|
95
94
|
- README.md
|
96
95
|
- Rakefile
|
@@ -100,10 +99,10 @@ files:
|
|
100
99
|
- lib/date_flag.rb
|
101
100
|
- test/date_flag_test.rb
|
102
101
|
- test/test_helper.rb
|
103
|
-
homepage:
|
102
|
+
homepage: https://github.com/postageapp/date_flag
|
104
103
|
licenses: []
|
105
104
|
metadata: {}
|
106
|
-
post_install_message:
|
105
|
+
post_install_message:
|
107
106
|
rdoc_options: []
|
108
107
|
require_paths:
|
109
108
|
- lib
|
@@ -118,8 +117,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
117
|
- !ruby/object:Gem::Version
|
119
118
|
version: '0'
|
120
119
|
requirements: []
|
121
|
-
rubygems_version: 3.
|
122
|
-
signing_key:
|
120
|
+
rubygems_version: 3.3.7
|
121
|
+
signing_key:
|
123
122
|
specification_version: 4
|
124
123
|
summary: Date field exension for ActiveRecord
|
125
124
|
test_files: []
|
data/Gemfile.lock
DELETED
@@ -1,182 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: https://rubygems.org/
|
3
|
-
specs:
|
4
|
-
actioncable (6.0.2.1)
|
5
|
-
actionpack (= 6.0.2.1)
|
6
|
-
nio4r (~> 2.0)
|
7
|
-
websocket-driver (>= 0.6.1)
|
8
|
-
actionmailbox (6.0.2.1)
|
9
|
-
actionpack (= 6.0.2.1)
|
10
|
-
activejob (= 6.0.2.1)
|
11
|
-
activerecord (= 6.0.2.1)
|
12
|
-
activestorage (= 6.0.2.1)
|
13
|
-
activesupport (= 6.0.2.1)
|
14
|
-
mail (>= 2.7.1)
|
15
|
-
actionmailer (6.0.2.1)
|
16
|
-
actionpack (= 6.0.2.1)
|
17
|
-
actionview (= 6.0.2.1)
|
18
|
-
activejob (= 6.0.2.1)
|
19
|
-
mail (~> 2.5, >= 2.5.4)
|
20
|
-
rails-dom-testing (~> 2.0)
|
21
|
-
actionpack (6.0.2.1)
|
22
|
-
actionview (= 6.0.2.1)
|
23
|
-
activesupport (= 6.0.2.1)
|
24
|
-
rack (~> 2.0, >= 2.0.8)
|
25
|
-
rack-test (>= 0.6.3)
|
26
|
-
rails-dom-testing (~> 2.0)
|
27
|
-
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
28
|
-
actiontext (6.0.2.1)
|
29
|
-
actionpack (= 6.0.2.1)
|
30
|
-
activerecord (= 6.0.2.1)
|
31
|
-
activestorage (= 6.0.2.1)
|
32
|
-
activesupport (= 6.0.2.1)
|
33
|
-
nokogiri (>= 1.8.5)
|
34
|
-
actionview (6.0.2.1)
|
35
|
-
activesupport (= 6.0.2.1)
|
36
|
-
builder (~> 3.1)
|
37
|
-
erubi (~> 1.4)
|
38
|
-
rails-dom-testing (~> 2.0)
|
39
|
-
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
40
|
-
activejob (6.0.2.1)
|
41
|
-
activesupport (= 6.0.2.1)
|
42
|
-
globalid (>= 0.3.6)
|
43
|
-
activemodel (6.0.2.1)
|
44
|
-
activesupport (= 6.0.2.1)
|
45
|
-
activerecord (6.0.2.1)
|
46
|
-
activemodel (= 6.0.2.1)
|
47
|
-
activesupport (= 6.0.2.1)
|
48
|
-
activestorage (6.0.2.1)
|
49
|
-
actionpack (= 6.0.2.1)
|
50
|
-
activejob (= 6.0.2.1)
|
51
|
-
activerecord (= 6.0.2.1)
|
52
|
-
marcel (~> 0.3.1)
|
53
|
-
activesupport (6.0.2.1)
|
54
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
55
|
-
i18n (>= 0.7, < 2)
|
56
|
-
minitest (~> 5.1)
|
57
|
-
tzinfo (~> 1.1)
|
58
|
-
zeitwerk (~> 2.2)
|
59
|
-
addressable (2.4.0)
|
60
|
-
builder (3.2.4)
|
61
|
-
concurrent-ruby (1.1.6)
|
62
|
-
crass (1.0.6)
|
63
|
-
descendants_tracker (0.0.4)
|
64
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
65
|
-
erubi (1.9.0)
|
66
|
-
faraday (0.9.2)
|
67
|
-
multipart-post (>= 1.2, < 3)
|
68
|
-
git (1.6.0)
|
69
|
-
rchardet (~> 1.8)
|
70
|
-
github_api (0.16.0)
|
71
|
-
addressable (~> 2.4.0)
|
72
|
-
descendants_tracker (~> 0.0.4)
|
73
|
-
faraday (~> 0.8, < 0.10)
|
74
|
-
hashie (>= 3.4)
|
75
|
-
mime-types (>= 1.16, < 3.0)
|
76
|
-
oauth2 (~> 1.0)
|
77
|
-
globalid (0.4.2)
|
78
|
-
activesupport (>= 4.2.0)
|
79
|
-
hashie (4.1.0)
|
80
|
-
highline (2.0.3)
|
81
|
-
i18n (1.8.2)
|
82
|
-
concurrent-ruby (~> 1.0)
|
83
|
-
jeweler (2.3.9)
|
84
|
-
builder
|
85
|
-
bundler
|
86
|
-
git (>= 1.2.5)
|
87
|
-
github_api (~> 0.16.0)
|
88
|
-
highline (>= 1.6.15)
|
89
|
-
nokogiri (>= 1.5.10)
|
90
|
-
psych
|
91
|
-
rake
|
92
|
-
rdoc
|
93
|
-
semver2
|
94
|
-
jwt (2.2.1)
|
95
|
-
loofah (2.4.0)
|
96
|
-
crass (~> 1.0.2)
|
97
|
-
nokogiri (>= 1.5.9)
|
98
|
-
mail (2.7.1)
|
99
|
-
mini_mime (>= 0.1.1)
|
100
|
-
marcel (0.3.3)
|
101
|
-
mimemagic (~> 0.3.2)
|
102
|
-
method_source (0.9.2)
|
103
|
-
mime-types (2.99.3)
|
104
|
-
mimemagic (0.3.4)
|
105
|
-
mini_mime (1.0.2)
|
106
|
-
mini_portile2 (2.4.0)
|
107
|
-
minitest (5.14.0)
|
108
|
-
multi_json (1.14.1)
|
109
|
-
multi_xml (0.6.0)
|
110
|
-
multipart-post (2.1.1)
|
111
|
-
nio4r (2.5.2)
|
112
|
-
nokogiri (1.10.8)
|
113
|
-
mini_portile2 (~> 2.4.0)
|
114
|
-
oauth2 (1.4.4)
|
115
|
-
faraday (>= 0.8, < 2.0)
|
116
|
-
jwt (>= 1.0, < 3.0)
|
117
|
-
multi_json (~> 1.3)
|
118
|
-
multi_xml (~> 0.5)
|
119
|
-
rack (>= 1.2, < 3)
|
120
|
-
psych (3.1.0)
|
121
|
-
rack (2.2.2)
|
122
|
-
rack-test (1.1.0)
|
123
|
-
rack (>= 1.0, < 3)
|
124
|
-
rails (6.0.2.1)
|
125
|
-
actioncable (= 6.0.2.1)
|
126
|
-
actionmailbox (= 6.0.2.1)
|
127
|
-
actionmailer (= 6.0.2.1)
|
128
|
-
actionpack (= 6.0.2.1)
|
129
|
-
actiontext (= 6.0.2.1)
|
130
|
-
actionview (= 6.0.2.1)
|
131
|
-
activejob (= 6.0.2.1)
|
132
|
-
activemodel (= 6.0.2.1)
|
133
|
-
activerecord (= 6.0.2.1)
|
134
|
-
activestorage (= 6.0.2.1)
|
135
|
-
activesupport (= 6.0.2.1)
|
136
|
-
bundler (>= 1.3.0)
|
137
|
-
railties (= 6.0.2.1)
|
138
|
-
sprockets-rails (>= 2.0.0)
|
139
|
-
rails-dom-testing (2.0.3)
|
140
|
-
activesupport (>= 4.2.0)
|
141
|
-
nokogiri (>= 1.6)
|
142
|
-
rails-html-sanitizer (1.3.0)
|
143
|
-
loofah (~> 2.3)
|
144
|
-
railties (6.0.2.1)
|
145
|
-
actionpack (= 6.0.2.1)
|
146
|
-
activesupport (= 6.0.2.1)
|
147
|
-
method_source
|
148
|
-
rake (>= 0.8.7)
|
149
|
-
thor (>= 0.20.3, < 2.0)
|
150
|
-
rake (13.0.1)
|
151
|
-
rchardet (1.8.0)
|
152
|
-
rdoc (6.2.1)
|
153
|
-
semver2 (3.4.2)
|
154
|
-
sprockets (4.0.0)
|
155
|
-
concurrent-ruby (~> 1.0)
|
156
|
-
rack (> 1, < 3)
|
157
|
-
sprockets-rails (3.2.1)
|
158
|
-
actionpack (>= 4.0)
|
159
|
-
activesupport (>= 4.0)
|
160
|
-
sprockets (>= 3.0.0)
|
161
|
-
sqlite3 (1.4.2)
|
162
|
-
thor (1.0.1)
|
163
|
-
thread_safe (0.3.6)
|
164
|
-
tzinfo (1.2.6)
|
165
|
-
thread_safe (~> 0.1)
|
166
|
-
websocket-driver (0.7.1)
|
167
|
-
websocket-extensions (>= 0.1.0)
|
168
|
-
websocket-extensions (0.1.4)
|
169
|
-
zeitwerk (2.2.2)
|
170
|
-
|
171
|
-
PLATFORMS
|
172
|
-
ruby
|
173
|
-
|
174
|
-
DEPENDENCIES
|
175
|
-
activerecord (>= 3.0.0)
|
176
|
-
jeweler
|
177
|
-
rails
|
178
|
-
rdoc
|
179
|
-
sqlite3
|
180
|
-
|
181
|
-
BUNDLED WITH
|
182
|
-
2.1.4
|