boolean_timestamps 1.0.2 → 1.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 4595d122b80b6688096972fd9e8ac449ce8138cf
4
- data.tar.gz: f85e71f2069c2bbf1263c1bbce30512639dc2cc5
2
+ SHA256:
3
+ metadata.gz: 73a51dce026ddea261e9f6e45820610c5742a09b2471d31e4612063dd66d22d9
4
+ data.tar.gz: a280709bf7c176c1e607a608205a7b573f49a53a65beb8a85bbf80c7da0cc09c
5
5
  SHA512:
6
- metadata.gz: b7222844821b67397da464bc3455a4093d1355c38d0c427e8f4d9537ea2273703999f4e4d6e306d1ab549537e0431e87f6639217b9cd7d1a1bf38fe296970923
7
- data.tar.gz: 1f6d0472a7cda8632635157832c8d54ca68b97026831665a8a75b98879565b4dbbcf25c3273bb4c64e16acc6f5850f526b82851bbb78fb76f7bb5ed43c82aff0
6
+ metadata.gz: f3a56e46453828e0273db7383893e3bd187170f57535a28e0f5fdfd6300059f9fa5cd8bc56f802d49ab017484002692b214152d883ff50cd13ba7da9fc1c43a0
7
+ data.tar.gz: 8833bb8dcb82f62a61e6771b98b063fd53914e98c9755651590c57011573e4cd47b28109ae960fea3788bcc829b35d314c00cbe2a40b0ecb4d15bfec38956a44
data/.gitignore CHANGED
@@ -1,6 +1,5 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
- /Gemfile.lock
4
3
  /_yardoc/
5
4
  /coverage/
6
5
  /doc/
data/Gemfile CHANGED
@@ -2,3 +2,8 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in boolean_timestamps.gemspec
4
4
  gemspec
5
+
6
+ group :test do
7
+ # For CI rspec output
8
+ gem "rspec_junit_formatter"
9
+ end
@@ -0,0 +1,163 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ boolean_timestamps (1.0.2)
5
+ rails (>= 5.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actioncable (6.0.3.2)
11
+ actionpack (= 6.0.3.2)
12
+ nio4r (~> 2.0)
13
+ websocket-driver (>= 0.6.1)
14
+ actionmailbox (6.0.3.2)
15
+ actionpack (= 6.0.3.2)
16
+ activejob (= 6.0.3.2)
17
+ activerecord (= 6.0.3.2)
18
+ activestorage (= 6.0.3.2)
19
+ activesupport (= 6.0.3.2)
20
+ mail (>= 2.7.1)
21
+ actionmailer (6.0.3.2)
22
+ actionpack (= 6.0.3.2)
23
+ actionview (= 6.0.3.2)
24
+ activejob (= 6.0.3.2)
25
+ mail (~> 2.5, >= 2.5.4)
26
+ rails-dom-testing (~> 2.0)
27
+ actionpack (6.0.3.2)
28
+ actionview (= 6.0.3.2)
29
+ activesupport (= 6.0.3.2)
30
+ rack (~> 2.0, >= 2.0.8)
31
+ rack-test (>= 0.6.3)
32
+ rails-dom-testing (~> 2.0)
33
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
34
+ actiontext (6.0.3.2)
35
+ actionpack (= 6.0.3.2)
36
+ activerecord (= 6.0.3.2)
37
+ activestorage (= 6.0.3.2)
38
+ activesupport (= 6.0.3.2)
39
+ nokogiri (>= 1.8.5)
40
+ actionview (6.0.3.2)
41
+ activesupport (= 6.0.3.2)
42
+ builder (~> 3.1)
43
+ erubi (~> 1.4)
44
+ rails-dom-testing (~> 2.0)
45
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
46
+ activejob (6.0.3.2)
47
+ activesupport (= 6.0.3.2)
48
+ globalid (>= 0.3.6)
49
+ activemodel (6.0.3.2)
50
+ activesupport (= 6.0.3.2)
51
+ activerecord (6.0.3.2)
52
+ activemodel (= 6.0.3.2)
53
+ activesupport (= 6.0.3.2)
54
+ activestorage (6.0.3.2)
55
+ actionpack (= 6.0.3.2)
56
+ activejob (= 6.0.3.2)
57
+ activerecord (= 6.0.3.2)
58
+ marcel (~> 0.3.1)
59
+ activesupport (6.0.3.2)
60
+ concurrent-ruby (~> 1.0, >= 1.0.2)
61
+ i18n (>= 0.7, < 2)
62
+ minitest (~> 5.1)
63
+ tzinfo (~> 1.1)
64
+ zeitwerk (~> 2.2, >= 2.2.2)
65
+ builder (3.2.4)
66
+ concurrent-ruby (1.1.7)
67
+ crass (1.0.6)
68
+ diff-lcs (1.4.4)
69
+ erubi (1.9.0)
70
+ globalid (0.4.2)
71
+ activesupport (>= 4.2.0)
72
+ i18n (1.8.5)
73
+ concurrent-ruby (~> 1.0)
74
+ loofah (2.7.0)
75
+ crass (~> 1.0.2)
76
+ nokogiri (>= 1.5.9)
77
+ mail (2.7.1)
78
+ mini_mime (>= 0.1.1)
79
+ marcel (0.3.3)
80
+ mimemagic (~> 0.3.2)
81
+ method_source (1.0.0)
82
+ mimemagic (0.3.5)
83
+ mini_mime (1.0.2)
84
+ mini_portile2 (2.4.0)
85
+ minitest (5.14.2)
86
+ nio4r (2.5.2)
87
+ nokogiri (1.10.10)
88
+ mini_portile2 (~> 2.4.0)
89
+ rack (2.2.3)
90
+ rack-test (1.1.0)
91
+ rack (>= 1.0, < 3)
92
+ rails (6.0.3.2)
93
+ actioncable (= 6.0.3.2)
94
+ actionmailbox (= 6.0.3.2)
95
+ actionmailer (= 6.0.3.2)
96
+ actionpack (= 6.0.3.2)
97
+ actiontext (= 6.0.3.2)
98
+ actionview (= 6.0.3.2)
99
+ activejob (= 6.0.3.2)
100
+ activemodel (= 6.0.3.2)
101
+ activerecord (= 6.0.3.2)
102
+ activestorage (= 6.0.3.2)
103
+ activesupport (= 6.0.3.2)
104
+ bundler (>= 1.3.0)
105
+ railties (= 6.0.3.2)
106
+ sprockets-rails (>= 2.0.0)
107
+ rails-dom-testing (2.0.3)
108
+ activesupport (>= 4.2.0)
109
+ nokogiri (>= 1.6)
110
+ rails-html-sanitizer (1.3.0)
111
+ loofah (~> 2.3)
112
+ railties (6.0.3.2)
113
+ actionpack (= 6.0.3.2)
114
+ activesupport (= 6.0.3.2)
115
+ method_source
116
+ rake (>= 0.8.7)
117
+ thor (>= 0.20.3, < 2.0)
118
+ rake (13.0.1)
119
+ rspec (3.9.0)
120
+ rspec-core (~> 3.9.0)
121
+ rspec-expectations (~> 3.9.0)
122
+ rspec-mocks (~> 3.9.0)
123
+ rspec-core (3.9.2)
124
+ rspec-support (~> 3.9.3)
125
+ rspec-expectations (3.9.2)
126
+ diff-lcs (>= 1.2.0, < 2.0)
127
+ rspec-support (~> 3.9.0)
128
+ rspec-mocks (3.9.1)
129
+ diff-lcs (>= 1.2.0, < 2.0)
130
+ rspec-support (~> 3.9.0)
131
+ rspec-support (3.9.3)
132
+ rspec_junit_formatter (0.4.1)
133
+ rspec-core (>= 2, < 4, != 2.12.0)
134
+ sprockets (4.0.2)
135
+ concurrent-ruby (~> 1.0)
136
+ rack (> 1, < 3)
137
+ sprockets-rails (3.2.1)
138
+ actionpack (>= 4.0)
139
+ activesupport (>= 4.0)
140
+ sprockets (>= 3.0.0)
141
+ sqlite3 (1.4.2)
142
+ thor (1.0.1)
143
+ thread_safe (0.3.6)
144
+ tzinfo (1.2.7)
145
+ thread_safe (~> 0.1)
146
+ websocket-driver (0.7.3)
147
+ websocket-extensions (>= 0.1.0)
148
+ websocket-extensions (0.1.5)
149
+ zeitwerk (2.4.0)
150
+
151
+ PLATFORMS
152
+ ruby
153
+
154
+ DEPENDENCIES
155
+ boolean_timestamps!
156
+ bundler
157
+ rake
158
+ rspec
159
+ rspec_junit_formatter
160
+ sqlite3
161
+
162
+ BUNDLED WITH
163
+ 2.0.2
data/README.md CHANGED
@@ -34,6 +34,17 @@ puts post.published_at
34
34
  #=> nil
35
35
  ```
36
36
 
37
+ This also adds a scope for each timestamps column
38
+
39
+ ```ruby
40
+ Post.published
41
+ #=> [#<Post published_at: Fri, 04 Sep 2020 18:16:38 UTC +00:00>]
42
+
43
+ Post.published(false)
44
+ #=> [#<Post published_at: nil>]
45
+ ```
46
+
47
+
37
48
  ## Development
38
49
 
39
50
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
data/circle.yml CHANGED
@@ -1,5 +1,20 @@
1
- ---
2
- # skip circle ci setting up database since we use in memory
3
- database:
4
- override:
5
- - echo "Using in-memory database..."
1
+ version: 2.1 # Use 2.1 to enable using orbs and other features.
2
+
3
+ # Declare the orbs that we'll use in our config.
4
+ # read more about orbs: https://circleci.com/docs/2.0/using-orbs/
5
+ orbs:
6
+ ruby: circleci/ruby@1.0
7
+
8
+ jobs:
9
+ build: # our first job, named "build"
10
+ docker:
11
+ - image: cimg/ruby:2.7-node # use a tailored CircleCI docker image.
12
+ steps:
13
+ - checkout
14
+ - run: sudo apt update
15
+ - run: sudo apt install -y libsqlite3-dev zlib1g-dev
16
+ - ruby/install-deps # use the ruby orb to install dependencies
17
+ - ruby/rspec-test
18
+ environment:
19
+ BUNDLE_JOBS: "3"
20
+ BUNDLE_RETRY: "3"
@@ -22,6 +22,13 @@ module BooleanTimestamps
22
22
  send("#{timestamp_attribute}=", timestamp)
23
23
  end
24
24
  end
25
+ scope boolean_attribute, lambda { |value = true|
26
+ if value
27
+ where.not(timestamp_attribute => nil)
28
+ else
29
+ where(timestamp_attribute => nil)
30
+ end
31
+ }
25
32
  end
26
33
  end
27
34
  end
@@ -1,3 +1,3 @@
1
1
  module BooleanTimestamps
2
- VERSION = '1.0.2'.freeze
2
+ VERSION = '1.1.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boolean_timestamps
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - BetterUp Developers
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-06 00:00:00.000000000 Z
11
+ date: 2020-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -93,6 +93,7 @@ files:
93
93
  - ".rspec"
94
94
  - ".travis.yml"
95
95
  - Gemfile
96
+ - Gemfile.lock
96
97
  - LICENSE
97
98
  - README.md
98
99
  - Rakefile
@@ -105,7 +106,7 @@ files:
105
106
  homepage: https://www.github.com/betterup/boolean_timestamps
106
107
  licenses: []
107
108
  metadata: {}
108
- post_install_message:
109
+ post_install_message:
109
110
  rdoc_options: []
110
111
  require_paths:
111
112
  - lib
@@ -120,9 +121,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
121
  - !ruby/object:Gem::Version
121
122
  version: '0'
122
123
  requirements: []
123
- rubyforge_project:
124
- rubygems_version: 2.6.6
125
- signing_key:
124
+ rubygems_version: 3.1.4
125
+ signing_key:
126
126
  specification_version: 4
127
127
  summary: Add boolean attributes to models for simple timestamps
128
128
  test_files: []