truthy_date 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/truthy_date.rb +2 -2
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4acd79eb13e2dd83372bd5e84c9c108d1e875190
4
- data.tar.gz: 520c0d9be14115df4e9b6171b2ce46c99204726a
3
+ metadata.gz: 740737d9fe2e84ce680e5bca951f75370d4bd1f8
4
+ data.tar.gz: 1de9754ce3e7cd5b48f7233ab2924968364e89dd
5
5
  SHA512:
6
- metadata.gz: f2abb0560b92e69544baac75fc2f9544b0bec0377ea7074a6cd422abbb1c6bf588a86563f5d6a0f02ac75f0829bdf5fb33016b3140ca8d8ca0568137b5d3995c
7
- data.tar.gz: 047b7f9a00ff7f8f36ea3d097c5f297c6d7342e802a92fa4c30c6a39f61b5a0c1e383f35502023a6d225974376e29733a56451424266a3511c3068038019c956
6
+ metadata.gz: 805b8c71457ebeba9201143439e2c2e8c5abf3ff5082eab18fae1359b8a54b74c7587f2487b57c493e4f645b114133c2e10c86fd4705ac428e5531d4c2a9a065
7
+ data.tar.gz: 39644f2fd920ada6941ae3e7c14fd59d3c61394a0748f8b6c45170ad662ee9dd1a4c38d5e3c51f72bed83534457881786b855a85bf5ac9e03dcef22bb1f42c12
data/lib/truthy_date.rb CHANGED
@@ -3,11 +3,11 @@ module TruthyDate
3
3
  raise ArgumentError, "missing :as for truthy_date" unless options[:as]
4
4
 
5
5
  define_method("#{options[:as]}=") do |value|
6
- self.send("#{attribute}=", ActiveRecord::ConnectionAdapters::Column.value_to_boolean(value) ? Time.now : nil)
6
+ self.send("#{attribute}=", ActiveRecord::Type::Boolean.new.type_cast_from_database(value) ? Time.now : nil)
7
7
  end
8
8
 
9
9
  define_method("#{options[:as]}?") do
10
- self.send(attribute).present?
10
+ !!self.send(attribute)
11
11
  end
12
12
 
13
13
  define_method("#{options[:as]}") do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: truthy_date
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Connor
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-05 00:00:00.000000000 Z
11
+ date: 2015-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -51,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
51
51
  version: '0'
52
52
  requirements: []
53
53
  rubyforge_project:
54
- rubygems_version: 2.2.0
54
+ rubygems_version: 2.4.5
55
55
  signing_key:
56
56
  specification_version: 4
57
57
  summary: Provides getters/setters for when datetimes should also act like booleans