date_flag 1.0.6 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +71 -71
- data/LICENSE +1 -1
- data/README.md +2 -2
- data/VERSION +1 -1
- data/date_flag.gemspec +4 -4
- data/lib/date_flag.rb +14 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd2b8410f5a17d35acb3de9dad84680d1597e4aa7ce6ea46157cb77ed6d7515f
|
4
|
+
data.tar.gz: 4e260a4e0b54286e2646b14cfb001bfcc2dd3ea96e7f97583a9d51d5d5c49583
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e1c6bb6be598ed0f4e6a821ffed09ce68b93ff93e2d1f44e2ea6ae20e31654c2946d357ea431a679c4509ea7bf46ce39ac1f7492d2645b4673caa5daaa99b98
|
7
|
+
data.tar.gz: 4477728da3967cee94af6e4d5de2e2364ad786cda6bdd4866e8b6d068d39ed281b630ae8e4c9a9d69b01526ffcc3c2e168f67bd0dcdfacb706807e7bdd8bf10f
|
data/Gemfile.lock
CHANGED
@@ -1,71 +1,71 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
actioncable (6.0.
|
5
|
-
actionpack (= 6.0.
|
4
|
+
actioncable (6.0.3.4)
|
5
|
+
actionpack (= 6.0.3.4)
|
6
6
|
nio4r (~> 2.0)
|
7
7
|
websocket-driver (>= 0.6.1)
|
8
|
-
actionmailbox (6.0.
|
9
|
-
actionpack (= 6.0.
|
10
|
-
activejob (= 6.0.
|
11
|
-
activerecord (= 6.0.
|
12
|
-
activestorage (= 6.0.
|
13
|
-
activesupport (= 6.0.
|
8
|
+
actionmailbox (6.0.3.4)
|
9
|
+
actionpack (= 6.0.3.4)
|
10
|
+
activejob (= 6.0.3.4)
|
11
|
+
activerecord (= 6.0.3.4)
|
12
|
+
activestorage (= 6.0.3.4)
|
13
|
+
activesupport (= 6.0.3.4)
|
14
14
|
mail (>= 2.7.1)
|
15
|
-
actionmailer (6.0.
|
16
|
-
actionpack (= 6.0.
|
17
|
-
actionview (= 6.0.
|
18
|
-
activejob (= 6.0.
|
15
|
+
actionmailer (6.0.3.4)
|
16
|
+
actionpack (= 6.0.3.4)
|
17
|
+
actionview (= 6.0.3.4)
|
18
|
+
activejob (= 6.0.3.4)
|
19
19
|
mail (~> 2.5, >= 2.5.4)
|
20
20
|
rails-dom-testing (~> 2.0)
|
21
|
-
actionpack (6.0.
|
22
|
-
actionview (= 6.0.
|
23
|
-
activesupport (= 6.0.
|
21
|
+
actionpack (6.0.3.4)
|
22
|
+
actionview (= 6.0.3.4)
|
23
|
+
activesupport (= 6.0.3.4)
|
24
24
|
rack (~> 2.0, >= 2.0.8)
|
25
25
|
rack-test (>= 0.6.3)
|
26
26
|
rails-dom-testing (~> 2.0)
|
27
27
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
28
|
-
actiontext (6.0.
|
29
|
-
actionpack (= 6.0.
|
30
|
-
activerecord (= 6.0.
|
31
|
-
activestorage (= 6.0.
|
32
|
-
activesupport (= 6.0.
|
28
|
+
actiontext (6.0.3.4)
|
29
|
+
actionpack (= 6.0.3.4)
|
30
|
+
activerecord (= 6.0.3.4)
|
31
|
+
activestorage (= 6.0.3.4)
|
32
|
+
activesupport (= 6.0.3.4)
|
33
33
|
nokogiri (>= 1.8.5)
|
34
|
-
actionview (6.0.
|
35
|
-
activesupport (= 6.0.
|
34
|
+
actionview (6.0.3.4)
|
35
|
+
activesupport (= 6.0.3.4)
|
36
36
|
builder (~> 3.1)
|
37
37
|
erubi (~> 1.4)
|
38
38
|
rails-dom-testing (~> 2.0)
|
39
39
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
40
|
-
activejob (6.0.
|
41
|
-
activesupport (= 6.0.
|
40
|
+
activejob (6.0.3.4)
|
41
|
+
activesupport (= 6.0.3.4)
|
42
42
|
globalid (>= 0.3.6)
|
43
|
-
activemodel (6.0.
|
44
|
-
activesupport (= 6.0.
|
45
|
-
activerecord (6.0.
|
46
|
-
activemodel (= 6.0.
|
47
|
-
activesupport (= 6.0.
|
48
|
-
activestorage (6.0.
|
49
|
-
actionpack (= 6.0.
|
50
|
-
activejob (= 6.0.
|
51
|
-
activerecord (= 6.0.
|
43
|
+
activemodel (6.0.3.4)
|
44
|
+
activesupport (= 6.0.3.4)
|
45
|
+
activerecord (6.0.3.4)
|
46
|
+
activemodel (= 6.0.3.4)
|
47
|
+
activesupport (= 6.0.3.4)
|
48
|
+
activestorage (6.0.3.4)
|
49
|
+
actionpack (= 6.0.3.4)
|
50
|
+
activejob (= 6.0.3.4)
|
51
|
+
activerecord (= 6.0.3.4)
|
52
52
|
marcel (~> 0.3.1)
|
53
|
-
activesupport (6.0.
|
53
|
+
activesupport (6.0.3.4)
|
54
54
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
55
55
|
i18n (>= 0.7, < 2)
|
56
56
|
minitest (~> 5.1)
|
57
57
|
tzinfo (~> 1.1)
|
58
|
-
zeitwerk (~> 2.2)
|
58
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
59
59
|
addressable (2.4.0)
|
60
60
|
builder (3.2.4)
|
61
|
-
concurrent-ruby (1.1.
|
61
|
+
concurrent-ruby (1.1.7)
|
62
62
|
crass (1.0.6)
|
63
63
|
descendants_tracker (0.0.4)
|
64
64
|
thread_safe (~> 0.3, >= 0.3.1)
|
65
|
-
erubi (1.
|
65
|
+
erubi (1.10.0)
|
66
66
|
faraday (0.9.2)
|
67
67
|
multipart-post (>= 1.2, < 3)
|
68
|
-
git (1.
|
68
|
+
git (1.7.0)
|
69
69
|
rchardet (~> 1.8)
|
70
70
|
github_api (0.16.0)
|
71
71
|
addressable (~> 2.4.0)
|
@@ -78,7 +78,7 @@ GEM
|
|
78
78
|
activesupport (>= 4.2.0)
|
79
79
|
hashie (4.1.0)
|
80
80
|
highline (2.0.3)
|
81
|
-
i18n (1.8.
|
81
|
+
i18n (1.8.5)
|
82
82
|
concurrent-ruby (~> 1.0)
|
83
83
|
jeweler (2.3.9)
|
84
84
|
builder
|
@@ -91,25 +91,25 @@ GEM
|
|
91
91
|
rake
|
92
92
|
rdoc
|
93
93
|
semver2
|
94
|
-
jwt (2.2.
|
95
|
-
loofah (2.
|
94
|
+
jwt (2.2.2)
|
95
|
+
loofah (2.8.0)
|
96
96
|
crass (~> 1.0.2)
|
97
97
|
nokogiri (>= 1.5.9)
|
98
98
|
mail (2.7.1)
|
99
99
|
mini_mime (>= 0.1.1)
|
100
100
|
marcel (0.3.3)
|
101
101
|
mimemagic (~> 0.3.2)
|
102
|
-
method_source (0.
|
102
|
+
method_source (1.0.0)
|
103
103
|
mime-types (2.99.3)
|
104
|
-
mimemagic (0.3.
|
104
|
+
mimemagic (0.3.5)
|
105
105
|
mini_mime (1.0.2)
|
106
106
|
mini_portile2 (2.4.0)
|
107
|
-
minitest (5.14.
|
108
|
-
multi_json (1.
|
107
|
+
minitest (5.14.2)
|
108
|
+
multi_json (1.15.0)
|
109
109
|
multi_xml (0.6.0)
|
110
110
|
multipart-post (2.1.1)
|
111
|
-
nio4r (2.5.
|
112
|
-
nokogiri (1.10.
|
111
|
+
nio4r (2.5.4)
|
112
|
+
nokogiri (1.10.10)
|
113
113
|
mini_portile2 (~> 2.4.0)
|
114
114
|
oauth2 (1.4.4)
|
115
115
|
faraday (>= 0.8, < 2.0)
|
@@ -117,33 +117,33 @@ GEM
|
|
117
117
|
multi_json (~> 1.3)
|
118
118
|
multi_xml (~> 0.5)
|
119
119
|
rack (>= 1.2, < 3)
|
120
|
-
psych (3.
|
121
|
-
rack (2.2.
|
120
|
+
psych (3.2.0)
|
121
|
+
rack (2.2.3)
|
122
122
|
rack-test (1.1.0)
|
123
123
|
rack (>= 1.0, < 3)
|
124
|
-
rails (6.0.
|
125
|
-
actioncable (= 6.0.
|
126
|
-
actionmailbox (= 6.0.
|
127
|
-
actionmailer (= 6.0.
|
128
|
-
actionpack (= 6.0.
|
129
|
-
actiontext (= 6.0.
|
130
|
-
actionview (= 6.0.
|
131
|
-
activejob (= 6.0.
|
132
|
-
activemodel (= 6.0.
|
133
|
-
activerecord (= 6.0.
|
134
|
-
activestorage (= 6.0.
|
135
|
-
activesupport (= 6.0.
|
124
|
+
rails (6.0.3.4)
|
125
|
+
actioncable (= 6.0.3.4)
|
126
|
+
actionmailbox (= 6.0.3.4)
|
127
|
+
actionmailer (= 6.0.3.4)
|
128
|
+
actionpack (= 6.0.3.4)
|
129
|
+
actiontext (= 6.0.3.4)
|
130
|
+
actionview (= 6.0.3.4)
|
131
|
+
activejob (= 6.0.3.4)
|
132
|
+
activemodel (= 6.0.3.4)
|
133
|
+
activerecord (= 6.0.3.4)
|
134
|
+
activestorage (= 6.0.3.4)
|
135
|
+
activesupport (= 6.0.3.4)
|
136
136
|
bundler (>= 1.3.0)
|
137
|
-
railties (= 6.0.
|
137
|
+
railties (= 6.0.3.4)
|
138
138
|
sprockets-rails (>= 2.0.0)
|
139
139
|
rails-dom-testing (2.0.3)
|
140
140
|
activesupport (>= 4.2.0)
|
141
141
|
nokogiri (>= 1.6)
|
142
142
|
rails-html-sanitizer (1.3.0)
|
143
143
|
loofah (~> 2.3)
|
144
|
-
railties (6.0.
|
145
|
-
actionpack (= 6.0.
|
146
|
-
activesupport (= 6.0.
|
144
|
+
railties (6.0.3.4)
|
145
|
+
actionpack (= 6.0.3.4)
|
146
|
+
activesupport (= 6.0.3.4)
|
147
147
|
method_source
|
148
148
|
rake (>= 0.8.7)
|
149
149
|
thor (>= 0.20.3, < 2.0)
|
@@ -151,22 +151,22 @@ GEM
|
|
151
151
|
rchardet (1.8.0)
|
152
152
|
rdoc (6.2.1)
|
153
153
|
semver2 (3.4.2)
|
154
|
-
sprockets (4.0.
|
154
|
+
sprockets (4.0.2)
|
155
155
|
concurrent-ruby (~> 1.0)
|
156
156
|
rack (> 1, < 3)
|
157
|
-
sprockets-rails (3.2.
|
157
|
+
sprockets-rails (3.2.2)
|
158
158
|
actionpack (>= 4.0)
|
159
159
|
activesupport (>= 4.0)
|
160
160
|
sprockets (>= 3.0.0)
|
161
161
|
sqlite3 (1.4.2)
|
162
162
|
thor (1.0.1)
|
163
163
|
thread_safe (0.3.6)
|
164
|
-
tzinfo (1.2.
|
164
|
+
tzinfo (1.2.8)
|
165
165
|
thread_safe (~> 0.1)
|
166
|
-
websocket-driver (0.7.
|
166
|
+
websocket-driver (0.7.3)
|
167
167
|
websocket-extensions (>= 0.1.0)
|
168
|
-
websocket-extensions (0.1.
|
169
|
-
zeitwerk (2.
|
168
|
+
websocket-extensions (0.1.5)
|
169
|
+
zeitwerk (2.4.2)
|
170
170
|
|
171
171
|
PLATFORMS
|
172
172
|
ruby
|
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/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0
|
1
|
+
1.1.0
|
data/date_flag.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
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.0
|
5
|
+
# stub: date_flag 1.1.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "date_flag".freeze
|
9
|
-
s.version = "1.0
|
9
|
+
s.version = "1.1.0"
|
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
13
|
s.authors = ["Scott Tadman <scott@twg.ca>".freeze]
|
14
|
-
s.date = "2020-
|
14
|
+
s.date = "2020-12-09"
|
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
16
|
s.email = "scott@twg.ca".freeze
|
17
17
|
s.extra_rdoc_files = [
|
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
|
|
32
32
|
"test/test_helper.rb"
|
33
33
|
]
|
34
34
|
s.homepage = "http://github.com/twg/date_flag".freeze
|
35
|
-
s.rubygems_version = "3.1.
|
35
|
+
s.rubygems_version = "3.1.4".freeze
|
36
36
|
s.summary = "Date field exension for ActiveRecord".freeze
|
37
37
|
|
38
38
|
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,10 @@ module DateFlag
|
|
121
130
|
save!
|
122
131
|
end
|
123
132
|
end
|
133
|
+
|
134
|
+
def date_flag?(name)
|
135
|
+
name and @date_flags.include?(name.to_sym)
|
136
|
+
end
|
124
137
|
end
|
125
138
|
|
126
139
|
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.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Tadman <scott@twg.ca>
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -103,7 +103,7 @@ files:
|
|
103
103
|
homepage: http://github.com/twg/date_flag
|
104
104
|
licenses: []
|
105
105
|
metadata: {}
|
106
|
-
post_install_message:
|
106
|
+
post_install_message:
|
107
107
|
rdoc_options: []
|
108
108
|
require_paths:
|
109
109
|
- lib
|
@@ -118,8 +118,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
|
-
rubygems_version: 3.1.
|
122
|
-
signing_key:
|
121
|
+
rubygems_version: 3.1.4
|
122
|
+
signing_key:
|
123
123
|
specification_version: 4
|
124
124
|
summary: Date field exension for ActiveRecord
|
125
125
|
test_files: []
|