date_flag 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile.lock +138 -101
- data/LICENSE +1 -1
- data/README.md +2 -2
- data/VERSION +1 -1
- data/date_flag.gemspec +24 -30
- data/lib/date_flag.rb +14 -1
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
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,145 +1,182 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
5
|
-
actionpack (=
|
6
|
-
|
7
|
-
|
4
|
+
actioncable (6.0.3.4)
|
5
|
+
actionpack (= 6.0.3.4)
|
6
|
+
nio4r (~> 2.0)
|
7
|
+
websocket-driver (>= 0.6.1)
|
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
|
+
mail (>= 2.7.1)
|
15
|
+
actionmailer (6.0.3.4)
|
16
|
+
actionpack (= 6.0.3.4)
|
17
|
+
actionview (= 6.0.3.4)
|
18
|
+
activejob (= 6.0.3.4)
|
8
19
|
mail (~> 2.5, >= 2.5.4)
|
9
|
-
rails-dom-testing (~>
|
10
|
-
actionpack (
|
11
|
-
actionview (=
|
12
|
-
activesupport (=
|
13
|
-
rack (~>
|
14
|
-
rack-test (
|
15
|
-
rails-dom-testing (~>
|
16
|
-
rails-html-sanitizer (~> 1.0, >= 1.0
|
17
|
-
|
18
|
-
|
20
|
+
rails-dom-testing (~> 2.0)
|
21
|
+
actionpack (6.0.3.4)
|
22
|
+
actionview (= 6.0.3.4)
|
23
|
+
activesupport (= 6.0.3.4)
|
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.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
|
+
nokogiri (>= 1.8.5)
|
34
|
+
actionview (6.0.3.4)
|
35
|
+
activesupport (= 6.0.3.4)
|
19
36
|
builder (~> 3.1)
|
20
|
-
|
21
|
-
rails-dom-testing (~>
|
22
|
-
rails-html-sanitizer (~> 1.
|
23
|
-
activejob (
|
24
|
-
activesupport (=
|
25
|
-
globalid (>= 0.3.
|
26
|
-
activemodel (
|
27
|
-
activesupport (=
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
37
|
+
erubi (~> 1.4)
|
38
|
+
rails-dom-testing (~> 2.0)
|
39
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
40
|
+
activejob (6.0.3.4)
|
41
|
+
activesupport (= 6.0.3.4)
|
42
|
+
globalid (>= 0.3.6)
|
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
|
+
marcel (~> 0.3.1)
|
53
|
+
activesupport (6.0.3.4)
|
54
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
55
|
+
i18n (>= 0.7, < 2)
|
36
56
|
minitest (~> 5.1)
|
37
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
38
57
|
tzinfo (~> 1.1)
|
58
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
39
59
|
addressable (2.4.0)
|
40
|
-
|
41
|
-
|
42
|
-
|
60
|
+
builder (3.2.4)
|
61
|
+
concurrent-ruby (1.1.7)
|
62
|
+
crass (1.0.6)
|
43
63
|
descendants_tracker (0.0.4)
|
44
64
|
thread_safe (~> 0.3, >= 0.3.1)
|
45
|
-
|
65
|
+
erubi (1.10.0)
|
46
66
|
faraday (0.9.2)
|
47
67
|
multipart-post (>= 1.2, < 3)
|
48
|
-
git (1.
|
49
|
-
|
68
|
+
git (1.7.0)
|
69
|
+
rchardet (~> 1.8)
|
70
|
+
github_api (0.16.0)
|
50
71
|
addressable (~> 2.4.0)
|
51
72
|
descendants_tracker (~> 0.0.4)
|
52
73
|
faraday (~> 0.8, < 0.10)
|
53
74
|
hashie (>= 3.4)
|
54
|
-
|
55
|
-
oauth2
|
56
|
-
globalid (0.
|
57
|
-
activesupport (>= 4.
|
58
|
-
hashie (
|
59
|
-
highline (
|
60
|
-
i18n (
|
61
|
-
|
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.5)
|
82
|
+
concurrent-ruby (~> 1.0)
|
83
|
+
jeweler (2.3.9)
|
62
84
|
builder
|
63
|
-
bundler
|
85
|
+
bundler
|
64
86
|
git (>= 1.2.5)
|
65
|
-
github_api
|
87
|
+
github_api (~> 0.16.0)
|
66
88
|
highline (>= 1.6.15)
|
67
89
|
nokogiri (>= 1.5.10)
|
90
|
+
psych
|
68
91
|
rake
|
69
92
|
rdoc
|
70
|
-
|
71
|
-
jwt (
|
72
|
-
loofah (2.0
|
93
|
+
semver2
|
94
|
+
jwt (2.2.2)
|
95
|
+
loofah (2.8.0)
|
96
|
+
crass (~> 1.0.2)
|
73
97
|
nokogiri (>= 1.5.9)
|
74
|
-
mail (2.
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
98
|
+
mail (2.7.1)
|
99
|
+
mini_mime (>= 0.1.1)
|
100
|
+
marcel (0.3.3)
|
101
|
+
mimemagic (~> 0.3.2)
|
102
|
+
method_source (1.0.0)
|
103
|
+
mime-types (2.99.3)
|
104
|
+
mimemagic (0.3.5)
|
105
|
+
mini_mime (1.0.2)
|
106
|
+
mini_portile2 (2.4.0)
|
107
|
+
minitest (5.14.2)
|
108
|
+
multi_json (1.15.0)
|
109
|
+
multi_xml (0.6.0)
|
110
|
+
multipart-post (2.1.1)
|
111
|
+
nio4r (2.5.4)
|
112
|
+
nokogiri (1.10.10)
|
113
|
+
mini_portile2 (~> 2.4.0)
|
114
|
+
oauth2 (1.4.4)
|
115
|
+
faraday (>= 0.8, < 2.0)
|
116
|
+
jwt (>= 1.0, < 3.0)
|
89
117
|
multi_json (~> 1.3)
|
90
118
|
multi_xml (~> 0.5)
|
91
119
|
rack (>= 1.2, < 3)
|
92
|
-
|
93
|
-
rack
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
activesupport (
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
120
|
+
psych (3.2.0)
|
121
|
+
rack (2.2.3)
|
122
|
+
rack-test (1.1.0)
|
123
|
+
rack (>= 1.0, < 3)
|
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
|
+
bundler (>= 1.3.0)
|
137
|
+
railties (= 6.0.3.4)
|
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.3.4)
|
145
|
+
actionpack (= 6.0.3.4)
|
146
|
+
activesupport (= 6.0.3.4)
|
147
|
+
method_source
|
117
148
|
rake (>= 0.8.7)
|
118
|
-
thor (>= 0.
|
119
|
-
rake (
|
120
|
-
|
121
|
-
|
122
|
-
|
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.2)
|
123
155
|
concurrent-ruby (~> 1.0)
|
124
156
|
rack (> 1, < 3)
|
125
|
-
sprockets-rails (3.
|
157
|
+
sprockets-rails (3.2.2)
|
126
158
|
actionpack (>= 4.0)
|
127
159
|
activesupport (>= 4.0)
|
128
160
|
sprockets (>= 3.0.0)
|
129
|
-
sqlite3 (1.
|
130
|
-
thor (0.
|
131
|
-
thread_safe (0.3.
|
132
|
-
tzinfo (1.2.
|
161
|
+
sqlite3 (1.4.2)
|
162
|
+
thor (1.0.1)
|
163
|
+
thread_safe (0.3.6)
|
164
|
+
tzinfo (1.2.8)
|
133
165
|
thread_safe (~> 0.1)
|
166
|
+
websocket-driver (0.7.3)
|
167
|
+
websocket-extensions (>= 0.1.0)
|
168
|
+
websocket-extensions (0.1.5)
|
169
|
+
zeitwerk (2.4.2)
|
134
170
|
|
135
171
|
PLATFORMS
|
136
172
|
ruby
|
137
173
|
|
138
174
|
DEPENDENCIES
|
175
|
+
activerecord (>= 3.0.0)
|
139
176
|
jeweler
|
140
177
|
rails
|
141
178
|
rdoc
|
142
179
|
sqlite3
|
143
180
|
|
144
181
|
BUNDLED WITH
|
145
|
-
1.
|
182
|
+
2.1.4
|
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,18 +2,18 @@
|
|
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
|
-
s.name = "date_flag"
|
9
|
-
s.version = "1.0
|
8
|
+
s.name = "date_flag".freeze
|
9
|
+
s.version = "1.1.0"
|
10
10
|
|
11
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
-
s.require_paths = ["lib"]
|
13
|
-
s.authors = ["Scott Tadman <scott@twg.ca>"]
|
14
|
-
s.date = "
|
15
|
-
s.description = "Represents boolean fields as DateTime values to trigger events in the future or record when events happened in the past."
|
16
|
-
s.email = "scott@twg.ca"
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib".freeze]
|
13
|
+
s.authors = ["Scott Tadman <scott@twg.ca>".freeze]
|
14
|
+
s.date = "2020-12-09"
|
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 = "scott@twg.ca".freeze
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"LICENSE",
|
19
19
|
"README.md"
|
@@ -31,32 +31,26 @@ Gem::Specification.new do |s|
|
|
31
31
|
"test/date_flag_test.rb",
|
32
32
|
"test/test_helper.rb"
|
33
33
|
]
|
34
|
-
s.homepage = "http://github.com/twg/date_flag"
|
35
|
-
s.rubygems_version = "
|
36
|
-
s.summary = "Date field exension for ActiveRecord"
|
34
|
+
s.homepage = "http://github.com/twg/date_flag".freeze
|
35
|
+
s.rubygems_version = "3.1.4".freeze
|
36
|
+
s.summary = "Date field exension for ActiveRecord".freeze
|
37
37
|
|
38
38
|
if s.respond_to? :specification_version then
|
39
39
|
s.specification_version = 4
|
40
|
+
end
|
40
41
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
else
|
48
|
-
s.add_dependency(%q<activerecord>, [">= 3.0.0"])
|
49
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
50
|
-
s.add_dependency(%q<rdoc>, [">= 0"])
|
51
|
-
s.add_dependency(%q<rails>, [">= 0"])
|
52
|
-
s.add_dependency(%q<sqlite3>, [">= 0"])
|
53
|
-
end
|
42
|
+
if s.respond_to? :add_runtime_dependency then
|
43
|
+
s.add_runtime_dependency(%q<activerecord>.freeze, [">= 3.0.0"])
|
44
|
+
s.add_development_dependency(%q<jeweler>.freeze, [">= 0"])
|
45
|
+
s.add_development_dependency(%q<rdoc>.freeze, [">= 0"])
|
46
|
+
s.add_development_dependency(%q<rails>.freeze, [">= 0"])
|
47
|
+
s.add_development_dependency(%q<sqlite3>.freeze, [">= 0"])
|
54
48
|
else
|
55
|
-
s.add_dependency(%q<activerecord
|
56
|
-
s.add_dependency(%q<jeweler
|
57
|
-
s.add_dependency(%q<rdoc
|
58
|
-
s.add_dependency(%q<rails
|
59
|
-
s.add_dependency(%q<sqlite3
|
49
|
+
s.add_dependency(%q<activerecord>.freeze, [">= 3.0.0"])
|
50
|
+
s.add_dependency(%q<jeweler>.freeze, [">= 0"])
|
51
|
+
s.add_dependency(%q<rdoc>.freeze, [">= 0"])
|
52
|
+
s.add_dependency(%q<rails>.freeze, [">= 0"])
|
53
|
+
s.add_dependency(%q<sqlite3>.freeze, [">= 0"])
|
60
54
|
end
|
61
55
|
end
|
62
56
|
|
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:
|
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,9 +118,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
|
-
|
122
|
-
|
123
|
-
signing_key:
|
121
|
+
rubygems_version: 3.1.4
|
122
|
+
signing_key:
|
124
123
|
specification_version: 4
|
125
124
|
summary: Date field exension for ActiveRecord
|
126
125
|
test_files: []
|