truthy_date 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/truthy_date.rb +13 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: cc0bfcf5969cb80fc12544259867e5ce6755134a
|
4
|
+
data.tar.gz: 98ed155be6534d2773d4712585ada6f964326d8d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 499ea6599b2c657a325e8c12890a0308843ea8232f99a603f4adb84ffe2da3853652497601cb519dc45ea26327c311832bf3f908b35da59ae9f53ca7c2b175a4
|
7
|
+
data.tar.gz: 99f623f33fc65e3782f7163d0a71db1a7fd2246fce51a8fc55bfc67dd12140d7b697ed7ac7dc6dfc60d719ad26d04c50ac069a17b70cab8a795874f5eb33a344
|
data/lib/truthy_date.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
module TruthyDate
|
2
|
+
def truthy_date(attribute, options)
|
3
|
+
raise ArgumentError, "missing :as for datetime_booleanify" unless options[:as]
|
4
|
+
|
5
|
+
define_method("#{options[:as]}=") do |value|
|
6
|
+
self.send("#{attribute}=", ActiveRecord::ConnectionAdapters::Column.value_to_boolean(value) ? Time.now : nil)
|
7
|
+
end
|
8
|
+
|
9
|
+
define_method("#{options[:as]}?") do
|
10
|
+
self.send(attribute).present?
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: truthy_date
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dan Connor
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-02-05 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Provides getters/setters for when datetimes should also act like booleans
|
14
|
+
email: danconn@danconnor.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/truthy_date.rb
|
20
|
+
homepage: https://github.com/onyxrev/truthy_date
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.2.0
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Provides getters/setters for when datetimes should also act like booleans
|
44
|
+
test_files: []
|