stringify-time 0.0.4 → 0.0.5
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 +4 -4
- data/init.rb +1 -0
- data/lib/stringify-time.rb +3 -5
- data/lib/stringify-time/version.rb +1 -1
- data/rails/init.rb +3 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a25bfeb7286104cd3f0aca54dbdfbac2e8c179a
|
4
|
+
data.tar.gz: 78c89d1eeb0be3704969a27b5cf7e121bbdc3b89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 184b235e498404d91086e6106995b0d3093b228ec66b8d235e0dfb1423e51f54c79bc744b643fc892c998a91b6748b90562966510409131df53af8119d852219
|
7
|
+
data.tar.gz: e006cdbad5b6eaa04b8e49f525c1cadd9f4d6dbee60a1ece07d272878cef7cd5f57f910bc7af64e34e845343ef9af1e0f078ccc6b3b6efeaf420c2c89afdb592
|
data/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'rails/init'
|
data/lib/stringify-time.rb
CHANGED
@@ -2,12 +2,12 @@ module StringifyTime
|
|
2
2
|
def stringify_time(*names)
|
3
3
|
names.each do |name|
|
4
4
|
define_method "#{name}_string" do
|
5
|
-
read_attribute(name).to_s(:db)
|
5
|
+
read_attribute(name).to_s(:db) unless read_attribute(name).nil?
|
6
6
|
end
|
7
7
|
|
8
8
|
define_method "#{name}_string=" do |time_str|
|
9
9
|
begin
|
10
|
-
write_attribute(name, Time.parse(time_str))
|
10
|
+
write_attribute(name, Time.zone.parse(time_str))
|
11
11
|
rescue ArgumentError
|
12
12
|
instance_variable_set("@#{name}_invalid", true)
|
13
13
|
end
|
@@ -20,6 +20,4 @@ module StringifyTime
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
|
24
|
-
include StringifyTime
|
25
|
-
end
|
23
|
+
ActiveRecord::Base.send(:extend, StringifyTime)
|
data/rails/init.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stringify-time
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Perey
|
@@ -52,8 +52,10 @@ files:
|
|
52
52
|
- LICENSE.txt
|
53
53
|
- README.md
|
54
54
|
- Rakefile
|
55
|
+
- init.rb
|
55
56
|
- lib/stringify-time.rb
|
56
57
|
- lib/stringify-time/version.rb
|
58
|
+
- rails/init.rb
|
57
59
|
- stringify-time.gemspec
|
58
60
|
homepage: http://github.com/the4dpatrick/stringify-time-gem
|
59
61
|
licenses:
|