time_for_a_boolean 0.1.0 → 0.2.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: a74e795120301e9c8003f321b892fafc18bf4375
4
- data.tar.gz: 910088087ca59037a96fce7271090a3a21c8eecb
2
+ SHA256:
3
+ metadata.gz: 5acc839630f48b9206cd7dd07d15f4563e3d43eefc039a4fd069df0e2cc0aa21
4
+ data.tar.gz: 0aaf6fa56776b9b934c7a317f9eea6eada121dd24da494b3a1a0294b97d30771
5
5
  SHA512:
6
- metadata.gz: 8637e3a73d58bb6e98b0d5204a10ae0ae02b7881b1b430444fd61330710ef10a9024f39a59496cc64dbfb2fc7a8f5e657b329a2a125996bdc99be579afa3d940
7
- data.tar.gz: 1c459534ccb24b5f005788920d23ac18d088998faac2a20d528bf9ff745515e877e4f847cf5cc0a3b4dcc9c0746e06b52dffa0decbae9c3762934e714f098685
6
+ metadata.gz: 2bd9a2ed4952d33d5a85f47b146f90d1d646078f36cc94052e8fbd76fa20ebcb6ea182351ca9f11436146996fd292d8f9feeeb3b3ce7a9418948e614dfe442be
7
+ data.tar.gz: 48d4a07e21aa180fe8117115bb23f1a6bb21e1e94376926f36872ac4d3e52ea0df53c16e427ea49e69bfb2c52be2fc0cc0d2d9bc9a9ae7b5261fb1477c5e5aa9
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  Time for A Boolean
2
2
  ==================
3
3
 
4
- [![Build Status](https://api.travis-ci.org/calebthompson/time_for_a_boolean.png?branch=master)](https://travis-ci.org/calebthompson/time_for_a_boolean)
5
- [![Code Climate](https://codeclimate.com/github/calebthompson/time_for_a_boolean.png)](https://codeclimate.com/github/calebthompson/time_for_a_boolean)
6
- [![Coverage Status](https://coveralls.io/repos/calebthompson/time_for_a_boolean/badge.png)](https://coveralls.io/r/calebthompson/time_for_a_boolean)
4
+ [![Build Status](https://api.travis-ci.org/calebthompson/time_for_a_boolean.svg?branch=master)](https://travis-ci.org/calebthompson/time_for_a_boolean)
5
+ [![Code Climate](https://codeclimate.com/github/calebthompson/time_for_a_boolean.svg)](https://codeclimate.com/github/calebthompson/time_for_a_boolean)
6
+ [![Coverage Status](https://coveralls.io/repos/calebthompson/time_for_a_boolean/badge.svg)](https://coveralls.io/r/calebthompson/time_for_a_boolean)
7
7
 
8
8
 
9
9
  > Sally: Hey, we need to add a flag to Post
@@ -63,7 +63,7 @@ methods are defined:
63
63
 
64
64
  | Method | Description
65
65
  | --------------- | -----------
66
- | `Post#deleted` | `true` if `Post#deleted_at` is set to a value greater than `Time.current`, `false` otherwise
66
+ | `Post#deleted` | `true` if `Post#deleted_at` is set to a time before `Time.current`, `false` otherwise
67
67
  | `Post#deleted?` | Alias for `Post#deleted`
68
68
  | `Post#deleted=` | Sets the timestamp to `Time.current` if the new value is true, and `nil` otherwise
69
69
 
data/Rakefile CHANGED
@@ -1,6 +1 @@
1
1
  require 'bundler/gem_tasks'
2
- require 'rspec/core/rake_task'
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task default: :spec
@@ -1,5 +1,6 @@
1
1
  require "active_support/core_ext/module/delegation"
2
- require "active_record/connection_adapters/column"
2
+ require "active_support/core_ext/time/calculations"
3
+ require "active_model/type"
3
4
  require "time_for_a_boolean/version"
4
5
  require "time_for_a_boolean/railtie"
5
6
 
@@ -13,10 +14,10 @@ module TimeForABoolean
13
14
 
14
15
  setter_attribute = "#{field}="
15
16
  define_method("#{attribute}=") do |value|
16
- if ActiveRecord::ConnectionAdapters::Column::TRUE_VALUES.include?(value)
17
- send(setter_attribute, -> { Time.current }.())
18
- else
17
+ if ActiveModel::Type::Boolean::FALSE_VALUES.include?(value)
19
18
  send(setter_attribute, nil)
19
+ else
20
+ send(setter_attribute, -> { Time.current }.())
20
21
  end
21
22
  end
22
23
  end
@@ -1,3 +1,3 @@
1
1
  module TimeForABoolean
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: time_for_a_boolean
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Caleb Thompson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-23 00:00:00.000000000 Z
11
+ date: 2017-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  version: '0'
136
136
  requirements: []
137
137
  rubyforge_project:
138
- rubygems_version: 2.5.1
138
+ rubygems_version: 2.6.14
139
139
  signing_key:
140
140
  specification_version: 4
141
141
  summary: Back boolean values with timestamps