date_flag 1.0.3 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +97 -79
- data/LICENSE +1 -1
- data/README.md +2 -2
- data/VERSION +1 -1
- data/date_flag.gemspec +11 -17
- data/lib/date_flag.rb +17 -1
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f31e903d2ecd09733b517f1e47b97a5aaac6fa0e7d21e70ba4652acba2131fdf
|
4
|
+
data.tar.gz: a47136edf643814f0d666de06d57a32e7a1ed9f326804827067870b1839e9f1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20cdbc314155641ba7743a20e3c5c01a350c64061b3b38880f1ebcf65b1cd17c194de642e85ed9d0aed40002d5797913675e836960abe95ad94d9e05e55e0cfd
|
7
|
+
data.tar.gz: af251dc91155f2e4b9c087c3e12a19427301cfd920375628614f0465c6ec3b3f2022e647d564b80fc29b63af6eaf4bbe89acb0fd3046f9f03b8d33d6285fa123
|
data/Gemfile.lock
CHANGED
@@ -1,58 +1,72 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
actioncable (
|
5
|
-
actionpack (=
|
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
|
-
|
9
|
-
actionpack (=
|
10
|
-
|
11
|
-
|
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)
|
12
19
|
mail (~> 2.5, >= 2.5.4)
|
13
20
|
rails-dom-testing (~> 2.0)
|
14
|
-
actionpack (
|
15
|
-
actionview (=
|
16
|
-
activesupport (=
|
17
|
-
rack (~> 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)
|
18
25
|
rack-test (>= 0.6.3)
|
19
26
|
rails-dom-testing (~> 2.0)
|
20
|
-
rails-html-sanitizer (~> 1.0, >= 1.0
|
21
|
-
|
22
|
-
|
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)
|
23
36
|
builder (~> 3.1)
|
24
37
|
erubi (~> 1.4)
|
25
38
|
rails-dom-testing (~> 2.0)
|
26
|
-
rails-html-sanitizer (~> 1.
|
27
|
-
activejob (
|
28
|
-
activesupport (=
|
39
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
40
|
+
activejob (6.0.3.4)
|
41
|
+
activesupport (= 6.0.3.4)
|
29
42
|
globalid (>= 0.3.6)
|
30
|
-
activemodel (
|
31
|
-
activesupport (=
|
32
|
-
activerecord (
|
33
|
-
activemodel (=
|
34
|
-
activesupport (=
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
activerecord (=
|
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)
|
39
52
|
marcel (~> 0.3.1)
|
40
|
-
activesupport (
|
53
|
+
activesupport (6.0.3.4)
|
41
54
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
42
55
|
i18n (>= 0.7, < 2)
|
43
56
|
minitest (~> 5.1)
|
44
57
|
tzinfo (~> 1.1)
|
58
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
45
59
|
addressable (2.4.0)
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
crass (1.0.4)
|
60
|
+
builder (3.2.4)
|
61
|
+
concurrent-ruby (1.1.7)
|
62
|
+
crass (1.0.6)
|
50
63
|
descendants_tracker (0.0.4)
|
51
64
|
thread_safe (~> 0.3, >= 0.3.1)
|
52
|
-
erubi (1.
|
65
|
+
erubi (1.10.0)
|
53
66
|
faraday (0.9.2)
|
54
67
|
multipart-post (>= 1.2, < 3)
|
55
|
-
git (1.
|
68
|
+
git (1.7.0)
|
69
|
+
rchardet (~> 1.8)
|
56
70
|
github_api (0.16.0)
|
57
71
|
addressable (~> 2.4.0)
|
58
72
|
descendants_tracker (~> 0.0.4)
|
@@ -60,11 +74,11 @@ GEM
|
|
60
74
|
hashie (>= 3.4)
|
61
75
|
mime-types (>= 1.16, < 3.0)
|
62
76
|
oauth2 (~> 1.0)
|
63
|
-
globalid (0.4.
|
77
|
+
globalid (0.4.2)
|
64
78
|
activesupport (>= 4.2.0)
|
65
|
-
hashie (
|
66
|
-
highline (2.0.
|
67
|
-
i18n (1.
|
79
|
+
hashie (4.1.0)
|
80
|
+
highline (2.0.3)
|
81
|
+
i18n (1.8.5)
|
68
82
|
concurrent-ruby (~> 1.0)
|
69
83
|
jeweler (2.3.9)
|
70
84
|
builder
|
@@ -77,78 +91,82 @@ GEM
|
|
77
91
|
rake
|
78
92
|
rdoc
|
79
93
|
semver2
|
80
|
-
jwt (2.
|
81
|
-
loofah (2.
|
94
|
+
jwt (2.2.2)
|
95
|
+
loofah (2.8.0)
|
82
96
|
crass (~> 1.0.2)
|
83
97
|
nokogiri (>= 1.5.9)
|
84
98
|
mail (2.7.1)
|
85
99
|
mini_mime (>= 0.1.1)
|
86
100
|
marcel (0.3.3)
|
87
101
|
mimemagic (~> 0.3.2)
|
88
|
-
method_source (0.
|
102
|
+
method_source (1.0.0)
|
89
103
|
mime-types (2.99.3)
|
90
|
-
mimemagic (0.3.
|
91
|
-
mini_mime (1.0.
|
92
|
-
mini_portile2 (2.
|
93
|
-
minitest (5.
|
94
|
-
multi_json (1.
|
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)
|
95
109
|
multi_xml (0.6.0)
|
96
|
-
multipart-post (2.
|
97
|
-
nio4r (2.
|
98
|
-
nokogiri (1.
|
99
|
-
mini_portile2 (~> 2.
|
100
|
-
oauth2 (1.4.
|
101
|
-
faraday (>= 0.8, <
|
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)
|
102
116
|
jwt (>= 1.0, < 3.0)
|
103
117
|
multi_json (~> 1.3)
|
104
118
|
multi_xml (~> 0.5)
|
105
119
|
rack (>= 1.2, < 3)
|
106
|
-
psych (3.0
|
107
|
-
rack (2.
|
120
|
+
psych (3.2.0)
|
121
|
+
rack (2.2.3)
|
108
122
|
rack-test (1.1.0)
|
109
123
|
rack (>= 1.0, < 3)
|
110
|
-
rails (
|
111
|
-
actioncable (=
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
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)
|
120
136
|
bundler (>= 1.3.0)
|
121
|
-
railties (=
|
137
|
+
railties (= 6.0.3.4)
|
122
138
|
sprockets-rails (>= 2.0.0)
|
123
139
|
rails-dom-testing (2.0.3)
|
124
140
|
activesupport (>= 4.2.0)
|
125
141
|
nokogiri (>= 1.6)
|
126
|
-
rails-html-sanitizer (1.0
|
127
|
-
loofah (~> 2.
|
128
|
-
railties (
|
129
|
-
actionpack (=
|
130
|
-
activesupport (=
|
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)
|
131
147
|
method_source
|
132
148
|
rake (>= 0.8.7)
|
133
|
-
thor (>= 0.
|
134
|
-
rake (
|
135
|
-
|
149
|
+
thor (>= 0.20.3, < 2.0)
|
150
|
+
rake (13.0.1)
|
151
|
+
rchardet (1.8.0)
|
152
|
+
rdoc (6.2.1)
|
136
153
|
semver2 (3.4.2)
|
137
|
-
sprockets (
|
154
|
+
sprockets (4.0.2)
|
138
155
|
concurrent-ruby (~> 1.0)
|
139
156
|
rack (> 1, < 3)
|
140
|
-
sprockets-rails (3.2.
|
157
|
+
sprockets-rails (3.2.2)
|
141
158
|
actionpack (>= 4.0)
|
142
159
|
activesupport (>= 4.0)
|
143
160
|
sprockets (>= 3.0.0)
|
144
|
-
sqlite3 (1.
|
145
|
-
thor (0.
|
161
|
+
sqlite3 (1.4.2)
|
162
|
+
thor (1.0.1)
|
146
163
|
thread_safe (0.3.6)
|
147
|
-
tzinfo (1.2.
|
164
|
+
tzinfo (1.2.8)
|
148
165
|
thread_safe (~> 0.1)
|
149
|
-
websocket-driver (0.7.
|
166
|
+
websocket-driver (0.7.3)
|
150
167
|
websocket-extensions (>= 0.1.0)
|
151
|
-
websocket-extensions (0.1.
|
168
|
+
websocket-extensions (0.1.5)
|
169
|
+
zeitwerk (2.4.2)
|
152
170
|
|
153
171
|
PLATFORMS
|
154
172
|
ruby
|
@@ -161,4 +179,4 @@ DEPENDENCIES
|
|
161
179
|
sqlite3
|
162
180
|
|
163
181
|
BUNDLED WITH
|
164
|
-
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.
|
1
|
+
1.1.1
|
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.
|
5
|
+
# stub: date_flag 1.1.1 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.1"
|
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 = "
|
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,25 +32,19 @@ 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 = "
|
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
|
39
39
|
s.specification_version = 4
|
40
|
+
end
|
40
41
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
else
|
48
|
-
s.add_dependency(%q<activerecord>.freeze, [">= 3.0.0"])
|
49
|
-
s.add_dependency(%q<jeweler>.freeze, [">= 0"])
|
50
|
-
s.add_dependency(%q<rdoc>.freeze, [">= 0"])
|
51
|
-
s.add_dependency(%q<rails>.freeze, [">= 0"])
|
52
|
-
s.add_dependency(%q<sqlite3>.freeze, [">= 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
49
|
s.add_dependency(%q<activerecord>.freeze, [">= 3.0.0"])
|
56
50
|
s.add_dependency(%q<jeweler>.freeze, [">= 0"])
|
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.1
|
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: []
|