bool_at 0.2.1 → 0.2.3

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
2
  SHA256:
3
- metadata.gz: 1bb99bf4bf5e25c2c0d87a856baaa977888ad8290a0bb6fdbb7841acd8226d6c
4
- data.tar.gz: 76939f1b0087d1fc8ee4a061888555a0dc5b4891d9a4e687558749883bfa7be7
3
+ metadata.gz: 378cc41fd1448afcf1b47d09fd5d96aee6e414adf057b218da434e7e3cee4d4a
4
+ data.tar.gz: bb31cdbc37748166d2c0b8a57e7b09bbcecc21b195542e1952ba7112ae829c06
5
5
  SHA512:
6
- metadata.gz: 65f89958d3c8a3ecf3361569b5eda5872fabef82bfce698cf90746c46ce56bb12fbf9730d6362a1a760b529f2ae83162d4f309ccc8da7949f2460aee1aedd81a
7
- data.tar.gz: 0ffdef8c0a29f55d92dfc38f4e634e65b4891f937e8d5094f46b771b57e4da6c2428c7b0c24da4bca5ec0e7a75ae173544c1bae22be9a5842bb8c00978d252e1
6
+ metadata.gz: 18b300a0d8970502875b9029c0b3770f3e429ce05bef914368b0c4a43f4ffc50ac4396fbb1704bbcdeabbad04d50f56dc93f31878226e1108e1909eade7f6a8b
7
+ data.tar.gz: 05ee52f2371b040b63697bd4e78dcf80477541d506e06c4463d4501e2196ec901dbe1b2820cb1d6019df17aa3ac6e3d26f5dcbe88409985fef8b15faeaf7fcf3
@@ -0,0 +1,32 @@
1
+ # Use the latest 2.1 version of CircleCI pipeline process engine.
2
+ # See: https://circleci.com/docs/2.0/configuration-reference
3
+ version: 2.1
4
+
5
+ # Orbs are reusable packages of CircleCI configuration that you may share across projects, enabling you to create encapsulated, parameterized commands, jobs, and executors that can be used across multiple projects.
6
+ # See: https://circleci.com/docs/2.0/orb-intro/
7
+ orbs:
8
+ ruby: circleci/ruby@1.4.0
9
+
10
+ # Define a job to be invoked later in a workflow.
11
+ # See: https://circleci.com/docs/2.0/configuration-reference/#jobs
12
+ jobs:
13
+ build-test:
14
+ docker:
15
+ - image: cimg/ruby:3.1.0
16
+ executor: ruby/default
17
+ steps:
18
+ - checkout
19
+ - run:
20
+ name: Which bundler?
21
+ command: bundle -v
22
+ - run: bundle install
23
+ - run: bundle exec rspec
24
+
25
+ # Invoke jobs via workflows
26
+ # See: https://circleci.com/docs/2.0/configuration-reference/#workflows
27
+ workflows:
28
+ test: # This is the name of the workflow, feel free to change it to better match your workflow.
29
+ # Inside the workflow, you define the jobs you want to run.
30
+ jobs:
31
+ - build-test
32
+
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # 0.2.3 Avoid updating `_at` attr when already set 21 Sept 2023
2
+
3
+ https://github.com/elithecho/bool_at/pull/4
4
+
5
+ - Avoid overwriting the `_at` attribute when it is already set
data/Gemfile.lock CHANGED
@@ -1,31 +1,31 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bool_at (0.2.0)
4
+ bool_at (0.2.1)
5
5
  activerecord (>= 6)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actionpack (6.1.4.4)
11
- actionview (= 6.1.4.4)
12
- activesupport (= 6.1.4.4)
10
+ actionpack (6.1.5)
11
+ actionview (= 6.1.5)
12
+ activesupport (= 6.1.5)
13
13
  rack (~> 2.0, >= 2.0.9)
14
14
  rack-test (>= 0.6.3)
15
15
  rails-dom-testing (~> 2.0)
16
16
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
17
- actionview (6.1.4.4)
18
- activesupport (= 6.1.4.4)
17
+ actionview (6.1.5)
18
+ activesupport (= 6.1.5)
19
19
  builder (~> 3.1)
20
20
  erubi (~> 1.4)
21
21
  rails-dom-testing (~> 2.0)
22
22
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
23
- activemodel (6.1.4.4)
24
- activesupport (= 6.1.4.4)
25
- activerecord (6.1.4.4)
26
- activemodel (= 6.1.4.4)
27
- activesupport (= 6.1.4.4)
28
- activesupport (6.1.4.4)
23
+ activemodel (6.1.5)
24
+ activesupport (= 6.1.5)
25
+ activerecord (6.1.5)
26
+ activemodel (= 6.1.5)
27
+ activesupport (= 6.1.5)
28
+ activesupport (6.1.5)
29
29
  concurrent-ruby (~> 1.0, >= 1.0.2)
30
30
  i18n (>= 1.6, < 2)
31
31
  minitest (>= 5.1)
@@ -38,16 +38,16 @@ GEM
38
38
  crass (1.0.6)
39
39
  diff-lcs (1.5.0)
40
40
  erubi (1.10.0)
41
- i18n (1.9.1)
41
+ i18n (1.10.0)
42
42
  concurrent-ruby (~> 1.0)
43
- loofah (2.13.0)
43
+ loofah (2.15.0)
44
44
  crass (~> 1.0.2)
45
45
  nokogiri (>= 1.5.9)
46
46
  method_source (0.9.2)
47
- mini_portile2 (2.7.1)
47
+ mini_portile2 (2.8.0)
48
48
  minitest (5.15.0)
49
- nokogiri (1.13.1)
50
- mini_portile2 (~> 2.7.0)
49
+ nokogiri (1.13.4)
50
+ mini_portile2 (~> 2.8.0)
51
51
  racc (~> 1.4)
52
52
  parallel (1.21.0)
53
53
  parser (3.1.0.0)
@@ -64,11 +64,11 @@ GEM
64
64
  nokogiri (>= 1.6)
65
65
  rails-html-sanitizer (1.4.2)
66
66
  loofah (~> 2.3)
67
- railties (6.1.4.4)
68
- actionpack (= 6.1.4.4)
69
- activesupport (= 6.1.4.4)
67
+ railties (6.1.5)
68
+ actionpack (= 6.1.5)
69
+ activesupport (= 6.1.5)
70
70
  method_source
71
- rake (>= 0.13)
71
+ rake (>= 12.2)
72
72
  thor (~> 1.0)
73
73
  rainbow (3.1.1)
74
74
  rake (13.0.6)
@@ -123,4 +123,4 @@ DEPENDENCIES
123
123
  standalone_migrations (>= 6)
124
124
 
125
125
  BUNDLED WITH
126
- 2.3.6
126
+ 2.3.9
data/README.md CHANGED
@@ -1,5 +1,4 @@
1
- [![Build Status](https://travis-ci.org/choonggg/bool_at.svg?branch=master)](https://travis-ci.org/choonggg/bool_at)
2
-
1
+ [![CircleCI](https://circleci.com/gh/elithecho/bool_at/tree/master.svg?style=svg)](https://circleci.com/gh/elithecho/bool_at/tree/master)
3
2
 
4
3
  ## Installation
5
4
 
@@ -61,7 +60,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
61
60
 
62
61
  ## Contributing
63
62
 
64
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bool_at. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
63
+ Bug reports and pull requests are welcome on GitHub at https://github.com/elithecho/bool_at. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
65
64
 
66
65
  ## License
67
66
 
@@ -69,4 +68,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
69
68
 
70
69
  ## Code of Conduct
71
70
 
72
- Everyone interacting in the BoolAt project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/bool_at/blob/master/CODE_OF_CONDUCT.md).
71
+ Everyone interacting in the BoolAt project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/elithecho/bool_at/blob/master/CODE_OF_CONDUCT.md).
data/lib/bool_at/macro.rb CHANGED
@@ -19,7 +19,7 @@ module BoolAt
19
19
  # Changes dirty state in virtual attribute
20
20
  define_method setter do |value|
21
21
  super(value)
22
- send(at_setter, self[attr] ? Time.now : nil)
22
+ send(at_setter, self[attr] ? self[at_attribute] || Time.now : nil)
23
23
  end
24
24
 
25
25
  define_method attr do
@@ -1,3 +1,3 @@
1
1
  module BoolAt
2
- VERSION = "0.2.1".freeze
2
+ VERSION = "0.2.3".freeze
3
3
  end
data/lib/bool_at.rb CHANGED
@@ -12,5 +12,5 @@ module BoolAt
12
12
  end
13
13
 
14
14
  ActiveSupport.on_load(:active_record) do
15
- ActiveRecord::Base.send(:include, BoolAt)
15
+ ActiveRecord::Base.include BoolAt
16
16
  end
@@ -36,6 +36,14 @@ RSpec.describe BoolAt::Macro do
36
36
  post.published = false
37
37
  expect(post.published?).to be false
38
38
  end
39
+
40
+ it "keep time if already set" do
41
+ past_date = 2.days.ago.to_time
42
+ post = Post.new(published_at: past_date)
43
+ post.published = true
44
+ expect(post.published?).to be true
45
+ expect(post.published_at).to be past_date
46
+ end
39
47
  end
40
48
  end
41
49
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bool_at
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chong Hui
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-01 00:00:00.000000000 Z
11
+ date: 2023-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -115,10 +115,11 @@ executables: []
115
115
  extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
+ - ".circleci/config.yml"
118
119
  - ".gitignore"
119
120
  - ".rspec"
120
121
  - ".rubocop.yml"
121
- - ".travis.yml"
122
+ - CHANGELOG.md
122
123
  - CODE_OF_CONDUCT.md
123
124
  - Gemfile
124
125
  - Gemfile.lock
@@ -156,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
157
  - !ruby/object:Gem::Version
157
158
  version: '0'
158
159
  requirements: []
159
- rubygems_version: 3.2.22
160
+ rubygems_version: 3.4.10
160
161
  signing_key:
161
162
  specification_version: 4
162
163
  summary: Convert datetime to boolean in ActiveRecord
data/.travis.yml DELETED
@@ -1,16 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.5.1
5
- - 2.4.1
6
- - 2.3.3
7
- before_install:
8
- - gem update --system
9
- - gem --version
10
- - gem install bundler
11
- cache: bundler
12
- script:
13
- - bundle exec rspec
14
- gemfile:
15
- - gemfiles/rails_4.2.gemfile
16
- - gemfiles/rails_5.gemfile