store_attribute 0.5.1 → 0.5.2
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/.travis.yml +6 -1
- data/Gemfile +1 -1
- data/gemfiles/rails5.gemfile +1 -1
- data/gemfiles/railsmaster.rb +6 -0
- data/lib/store_attribute/active_record/store.rb +4 -2
- data/lib/store_attribute/version.rb +1 -1
- data/spec/spec_helper.rb +2 -0
- data/spec/store_attribute/typed_store_spec.rb +21 -8
- data/store_attribute.gemspec +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 191063cf9091064962abf3548153b75656a55665
|
4
|
+
data.tar.gz: cbc5f2bfc1b33f186296fd9b6c0cc1b8d08fb1df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae7b28363deb33a59141481eba79eecebd530c7810e9b29a79e9b2a618ca4e5dd8fa6e0211d5ae3d167fe29bff286a175aac0094a8b353e8ae59f484e1caadeb
|
7
|
+
data.tar.gz: bd3858caaa4d37e67bc586a18e1607a2d5c88f2385d9760fc59c9b15ad8fb403694f7a354248299928644acd4cec19bfbc4771f091fbdfd8c75348c6930b9ac0
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/gemfiles/rails5.gemfile
CHANGED
@@ -4,6 +4,7 @@ require 'store_attribute/active_record/type/typed_store'
|
|
4
4
|
module ActiveRecord
|
5
5
|
module Store
|
6
6
|
module ClassMethods # :nodoc:
|
7
|
+
alias _orig_store store
|
7
8
|
# Defines store on this model.
|
8
9
|
#
|
9
10
|
# +store_name+ The name of the store.
|
@@ -21,8 +22,9 @@ module ActiveRecord
|
|
21
22
|
# store :settings, accessors: [:color, :homepage, login_at: :datetime], coder: JSON
|
22
23
|
# end
|
23
24
|
def store(store_name, options = {})
|
24
|
-
|
25
|
-
|
25
|
+
accessors = options.delete(:accessors)
|
26
|
+
_orig_store(store_name, options)
|
27
|
+
store_accessor(store_name, *accessors) if accessors
|
26
28
|
end
|
27
29
|
# Adds additional accessors to an existing store on this model.
|
28
30
|
#
|
data/spec/spec_helper.rb
CHANGED
@@ -2,14 +2,6 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe ActiveRecord::Type::TypedStore do
|
4
4
|
let(:json_type) { ActiveRecord::Type::Serialized.new(ActiveRecord::Type::Text.new, ActiveRecord::Coders::JSON) }
|
5
|
-
let(:yaml_type) do
|
6
|
-
ActiveRecord::Type::Serialized.new(
|
7
|
-
ActiveRecord::Type::Text.new,
|
8
|
-
ActiveRecord::Store::IndifferentCoder.new(
|
9
|
-
ActiveRecord::Coders::YAMLColumn.new(Hash)
|
10
|
-
)
|
11
|
-
)
|
12
|
-
end
|
13
5
|
|
14
6
|
context "with json store" do
|
15
7
|
subject { described_class.new(json_type) }
|
@@ -76,6 +68,27 @@ describe ActiveRecord::Type::TypedStore do
|
|
76
68
|
end
|
77
69
|
|
78
70
|
context "with yaml coder" do
|
71
|
+
if RAILS_5_1
|
72
|
+
let(:yaml_type) do
|
73
|
+
ActiveRecord::Type::Serialized.new(
|
74
|
+
ActiveRecord::Type::Text.new,
|
75
|
+
ActiveRecord::Store::IndifferentCoder.new(
|
76
|
+
'test',
|
77
|
+
ActiveRecord::Coders::YAMLColumn.new('test', Hash)
|
78
|
+
)
|
79
|
+
)
|
80
|
+
end
|
81
|
+
else
|
82
|
+
let(:yaml_type) do
|
83
|
+
ActiveRecord::Type::Serialized.new(
|
84
|
+
ActiveRecord::Type::Text.new,
|
85
|
+
ActiveRecord::Store::IndifferentCoder.new(
|
86
|
+
ActiveRecord::Coders::YAMLColumn.new(Hash)
|
87
|
+
)
|
88
|
+
)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
79
92
|
let(:subject) { described_class.new(yaml_type) }
|
80
93
|
|
81
94
|
it "works", :aggregate_failures do
|
data/store_attribute.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.files = `git ls-files`.split($/)
|
18
18
|
s.require_paths = ["lib"]
|
19
19
|
|
20
|
-
s.add_runtime_dependency "activerecord", "~>5.0
|
20
|
+
s.add_runtime_dependency "activerecord", "~>5.0"
|
21
21
|
|
22
22
|
s.add_development_dependency "pg", "~>0.18"
|
23
23
|
s.add_development_dependency "rake", "~> 10.1"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: store_attribute
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- palkan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 5.0
|
19
|
+
version: '5.0'
|
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
|
-
version: 5.0
|
26
|
+
version: '5.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pg
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,6 +114,7 @@ files:
|
|
114
114
|
- bin/console
|
115
115
|
- bin/setup
|
116
116
|
- gemfiles/rails5.gemfile
|
117
|
+
- gemfiles/railsmaster.rb
|
117
118
|
- lib/store_attribute.rb
|
118
119
|
- lib/store_attribute/active_record.rb
|
119
120
|
- lib/store_attribute/active_record/store.rb
|
@@ -145,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
146
|
version: '0'
|
146
147
|
requirements: []
|
147
148
|
rubyforge_project:
|
148
|
-
rubygems_version: 2.6.
|
149
|
+
rubygems_version: 2.6.13
|
149
150
|
signing_key:
|
150
151
|
specification_version: 4
|
151
152
|
summary: ActiveRecord extension which adds typecasting to store accessors
|