typed-store 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/VERSION +1 -1
- data/lib/typed-store.rb +2 -0
- data/test/test_typed-store.rb +6 -5
- data/typed-store.gemspec +3 -3
- metadata +21 -21
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
N2ZlMjkxN2NhNTE0MGNkOTE2YTI4Y2M3Y2M3MmIzN2RhOGNiYWVlYg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b517c73943a34efbeed8e1472675dee50ce376c0
|
4
|
+
data.tar.gz: c775b63ac7dc917cb7b4eb83cb79e7b9f41d1d4c
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
ZjEzZGM1YjI3MmFiNjAwN2JkODM4MWM0N2E5Yzg2ZjQ3NjAzZDc0ZWU3NmQy
|
11
|
-
NDQzNzNlODBmNDc0OTk0MzYxYjBhMzA4MzA4MDlkOGE2OWIxMDI=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
YjdhYWJlYmE0MjRjNDMyYTQxYjJjNDkyNGRiYWQ5N2QxMGJhZjhlMTcxMDkx
|
14
|
-
NWM5ZGNkNTZiZmY4YmFhZjc2ZDUxODkxYjViYjc2NTMxZmM4MTg4MGY4ZTI4
|
15
|
-
MzA4YzMyN2QwODgxODY0ZGE1MGJhZTk3YTEwODcwZGQ0ZTgzZDY=
|
6
|
+
metadata.gz: 371752cf22ab0a21efc619b9aaf7929e58bba13f9c102a2519684c150afd03aa53aec0355830f2073a6c57e62a70555a7bc4de2382cb431f820386da61c6ce8c
|
7
|
+
data.tar.gz: e73a5abfb386138b0279f4e3747ccd2979ed04f406e2067c870d132b9659eecdcbe5cd5dc8d4fb5f19421e796ad36bb1a809caf381950974dfad0d444d5382b9
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/lib/typed-store.rb
CHANGED
@@ -7,12 +7,14 @@ module TypedStore
|
|
7
7
|
def typed_store_accessor(store_attribute, *mappings)
|
8
8
|
keys = mappings.map(&:first).map(&:first)
|
9
9
|
|
10
|
+
|
10
11
|
store_accessor store_attribute, keys
|
11
12
|
|
12
13
|
mappings.each do |mapping|
|
13
14
|
key, type = *mapping.first
|
14
15
|
|
15
16
|
define_method "#{key}=" do |value|
|
17
|
+
value = value.utc if [DateTime, Time].include?(type) && value
|
16
18
|
write_store_attribute(store_attribute, key, value != nil ? value.to_s : nil)
|
17
19
|
end
|
18
20
|
|
data/test/test_typed-store.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'helper'
|
2
|
+
require 'tzinfo'
|
2
3
|
|
3
4
|
class StoreAllAsStrings
|
4
5
|
def self.dump(obj)
|
@@ -34,7 +35,7 @@ class TestTypedStore < Test::Unit::TestCase
|
|
34
35
|
|
35
36
|
time = Time.now
|
36
37
|
date = Date.today
|
37
|
-
datetime = DateTime.now
|
38
|
+
datetime = DateTime.now.change(offset: "+1000")
|
38
39
|
|
39
40
|
subject.a_str = "this is a test"
|
40
41
|
subject.a_int = 12452
|
@@ -50,9 +51,9 @@ class TestTypedStore < Test::Unit::TestCase
|
|
50
51
|
assert_equal("this is a test", subject.a_str)
|
51
52
|
assert_equal(12452, subject.a_int)
|
52
53
|
assert_equal(3.33333335, subject.a_dbl)
|
53
|
-
assert_equal(time.to_s, subject.a_time.to_s)
|
54
|
+
assert_equal(time.utc.to_s, subject.a_time.to_s)
|
54
55
|
assert_equal(date.to_s, subject.a_date.to_s)
|
55
|
-
assert_equal(datetime.to_s, subject.a_datetime.to_s)
|
56
|
+
assert_equal(datetime.utc.to_s, subject.a_datetime.to_s)
|
56
57
|
assert_equal(false, subject.a_boolean)
|
57
58
|
end
|
58
59
|
|
@@ -74,9 +75,9 @@ class TestTypedStore < Test::Unit::TestCase
|
|
74
75
|
assert_equal("this is a test", subject.a_str)
|
75
76
|
assert_equal(12452, subject.a_int)
|
76
77
|
assert_equal(3.33333335, subject.a_dbl)
|
77
|
-
assert_equal(time.to_s, subject.a_time.to_s)
|
78
|
+
assert_equal(time.utc.to_s, subject.a_time.to_s)
|
78
79
|
assert_equal(date.to_s, subject.a_date.to_s)
|
79
|
-
assert_equal(datetime.to_s, subject.a_datetime.to_s)
|
80
|
+
assert_equal(datetime.utc.to_s, subject.a_datetime.to_s)
|
80
81
|
assert_equal(true, subject.a_boolean)
|
81
82
|
end
|
82
83
|
|
data/typed-store.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: typed-store 0.
|
5
|
+
# stub: typed-store 0.4.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "typed-store"
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.4.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Michael Baldry"]
|
14
|
-
s.date = "2014-
|
14
|
+
s.date = "2014-05-08"
|
15
15
|
s.description = "As Postgres HStore column doesn't store types, when you use this in conjuection with store_accessor, it always returns things as strings. This tidies that up."
|
16
16
|
s.email = "michael@brightbits.co.uk"
|
17
17
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,125 +1,125 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typed-store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Baldry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 3.2.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 3.2.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: shoulda
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rdoc
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '3.12'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.12'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: jeweler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 2.0.1
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 2.0.1
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: simplecov
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: pry
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: sqlite3
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
description: As Postgres HStore column doesn't store types, when you use this in conjuection
|
@@ -131,7 +131,7 @@ extra_rdoc_files:
|
|
131
131
|
- LICENSE.txt
|
132
132
|
- README.md
|
133
133
|
files:
|
134
|
-
- .document
|
134
|
+
- ".document"
|
135
135
|
- Gemfile
|
136
136
|
- Gemfile.lock
|
137
137
|
- LICENSE.txt
|
@@ -152,12 +152,12 @@ require_paths:
|
|
152
152
|
- lib
|
153
153
|
required_ruby_version: !ruby/object:Gem::Requirement
|
154
154
|
requirements:
|
155
|
-
- -
|
155
|
+
- - ">="
|
156
156
|
- !ruby/object:Gem::Version
|
157
157
|
version: '0'
|
158
158
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
159
|
requirements:
|
160
|
-
- -
|
160
|
+
- - ">="
|
161
161
|
- !ruby/object:Gem::Version
|
162
162
|
version: '0'
|
163
163
|
requirements: []
|