activerecord-typedstore 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -1
- data/activerecord-typedstore.gemspec +1 -1
- data/gemfiles/{Gemfile.ar-edge → Gemfile.ar-5.0} +1 -2
- data/lib/active_record/typed_store/extension.rb +3 -1
- data/lib/active_record/typed_store/type.rb +2 -2
- data/lib/active_record/typed_store/version.rb +1 -1
- data/spec/active_record/typed_store_spec.rb +4 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48c928ae468d6b194e9e449f10a7cb7dc2e8462c
|
4
|
+
data.tar.gz: 2bda0a0de2a3969e8d1b05129209bd4f79200381
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e66a694855109d5938364e16699d23139c0a0bcc5f463a88ee415a411a77dbc75c946801d69e044a1f7220c95ab40c7eceac8dcba7c0c0a13c83b3ff492f7a4
|
7
|
+
data.tar.gz: 1decb6986f91b5f5628387316b11701e0f8ba742add1679fc556cd2e4d53f72dab3b068104d071d4b42533529732c413923d113502fae1a2418a68e5fb662b60
|
data/.travis.yml
CHANGED
@@ -6,7 +6,7 @@ rvm:
|
|
6
6
|
- 2.3.0
|
7
7
|
gemfile:
|
8
8
|
- gemfiles/Gemfile.ar-4.2
|
9
|
-
- gemfiles/Gemfile.ar-
|
9
|
+
- gemfiles/Gemfile.ar-5.0
|
10
10
|
|
11
11
|
env:
|
12
12
|
- TIMEZONE_AWARE=1 POSTGRES=1 MYSQL=1
|
@@ -21,3 +21,8 @@ cache: bundler
|
|
21
21
|
before_script:
|
22
22
|
- mysql -e 'create database typed_store_test;'
|
23
23
|
- psql -c 'create database typed_store_test;' -U postgres
|
24
|
+
|
25
|
+
matrix:
|
26
|
+
exclude:
|
27
|
+
- rvm: 2.1
|
28
|
+
gemfile: gemfiles/Gemfile.ar-5.0
|
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ['Jean Boussier']
|
10
10
|
spec.email = ['jean.boussier@gmail.com']
|
11
11
|
spec.description = %q{ActiveRecord::Store but with type definition}
|
12
|
-
spec.summary = %q{Add type casting and full method attributes support to
|
12
|
+
spec.summary = %q{Add type casting and full method attributes support to АctiveRecord store}
|
13
13
|
spec.homepage = 'https://github.com/byroot/activerecord-typedstore'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
@@ -24,7 +24,9 @@ module ActiveRecord::TypedStore
|
|
24
24
|
typed_klass = TypedHash.create(dsl.fields.values)
|
25
25
|
const_set("#{store_attribute}_hash".camelize, typed_klass)
|
26
26
|
|
27
|
-
|
27
|
+
decorate_attribute_type(store_attribute, :typed_store) do |subtype|
|
28
|
+
Type.new(typed_klass, dsl.coder, subtype)
|
29
|
+
end
|
28
30
|
store_accessor(store_attribute, dsl.accessors)
|
29
31
|
end
|
30
32
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module ActiveRecord::TypedStore
|
2
2
|
class Type < ActiveRecord::Type::Serialized
|
3
|
-
def initialize(typed_hash_klass, coder)
|
3
|
+
def initialize(typed_hash_klass, coder, subtype)
|
4
4
|
@typed_hash_klass = typed_hash_klass
|
5
|
-
super(
|
5
|
+
super(subtype, coder)
|
6
6
|
end
|
7
7
|
|
8
8
|
[:deserialize, :type_cast_from_database, :type_cast_from_user].each do |method|
|
@@ -602,6 +602,10 @@ shared_examples 'a store' do |retain_type=true|
|
|
602
602
|
model.reload
|
603
603
|
expect(model.settings[:not_existing_key]).to eq 42
|
604
604
|
end
|
605
|
+
|
606
|
+
it 'delegates internal methods to the underlying type' do
|
607
|
+
expect(model.class.type_for_attribute("settings").type).to eq :text
|
608
|
+
end
|
605
609
|
end
|
606
610
|
|
607
611
|
describe 'attributes' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-typedstore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Boussier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -161,7 +161,7 @@ files:
|
|
161
161
|
- gemfiles/Gemfile.ar-4.0
|
162
162
|
- gemfiles/Gemfile.ar-4.1
|
163
163
|
- gemfiles/Gemfile.ar-4.2
|
164
|
-
- gemfiles/Gemfile.ar-
|
164
|
+
- gemfiles/Gemfile.ar-5.0
|
165
165
|
- lib/active_record/typed_store.rb
|
166
166
|
- lib/active_record/typed_store/dsl.rb
|
167
167
|
- lib/active_record/typed_store/extension.rb
|
@@ -198,7 +198,7 @@ rubyforge_project:
|
|
198
198
|
rubygems_version: 2.5.1
|
199
199
|
signing_key:
|
200
200
|
specification_version: 4
|
201
|
-
summary: Add type casting and full method attributes support to
|
201
|
+
summary: Add type casting and full method attributes support to АctiveRecord store
|
202
202
|
test_files:
|
203
203
|
- spec/active_record/typed_store/typed_hash_spec.rb
|
204
204
|
- spec/active_record/typed_store_spec.rb
|