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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ed8f250e16de47101a01c8633fb6587e58626ee0
4
- data.tar.gz: e5dd919d347fb854e5d03f8aac3786f334645a15
3
+ metadata.gz: 48c928ae468d6b194e9e449f10a7cb7dc2e8462c
4
+ data.tar.gz: 2bda0a0de2a3969e8d1b05129209bd4f79200381
5
5
  SHA512:
6
- metadata.gz: 5cce7b2e70c3abf6df76ca6007c3d21e072f38b34a1d281fda28bdb514d2eb30bad2e2e9564833c28e82e8232fe68a8af5389211e4ac28f63b549a2005baf13e
7
- data.tar.gz: 3a6498ef57cd94fcf86120c59ce5f8d40a006c4740e30f90d8b25e8482fa1bcb59ce857e2258e2eb9938e2ec9b2362251f9a3657d1a85e0654d23004008224a0
6
+ metadata.gz: 6e66a694855109d5938364e16699d23139c0a0bcc5f463a88ee415a411a77dbc75c946801d69e044a1f7220c95ab40c7eceac8dcba7c0c0a13c83b3ff492f7a4
7
+ data.tar.gz: 1decb6986f91b5f5628387316b11701e0f8ba742add1679fc556cd2e4d53f72dab3b068104d071d4b42533529732c413923d113502fae1a2418a68e5fb662b60
@@ -6,7 +6,7 @@ rvm:
6
6
  - 2.3.0
7
7
  gemfile:
8
8
  - gemfiles/Gemfile.ar-4.2
9
- - gemfiles/Gemfile.ar-edge
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 RctiveRecord store}
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
 
@@ -1,7 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'activerecord', github: 'rails/rails'
4
- gem 'arel', github: 'rails/arel'
3
+ gem 'activerecord', '~> 5.0.0'
5
4
  gem 'bundler', '~> 1.3'
6
5
  gem 'rake'
7
6
  gem 'rspec'
@@ -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
- attribute(store_attribute, Type.new(typed_klass, dsl.coder))
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(ActiveRecord::Type::Value.new, coder)
5
+ super(subtype, coder)
6
6
  end
7
7
 
8
8
  [:deserialize, :type_cast_from_database, :type_cast_from_user].each do |method|
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module TypedStore
3
- VERSION = '1.0.0'
3
+ VERSION = '1.0.1'
4
4
  end
5
5
  end
@@ -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.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-06-11 00:00:00.000000000 Z
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-edge
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 RctiveRecord store
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