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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd2643cf4b1909497a0de3f0d15ed6ca51ba599e
4
- data.tar.gz: 607171026ea9b9638e20a920b732bd7258db246a
3
+ metadata.gz: 191063cf9091064962abf3548153b75656a55665
4
+ data.tar.gz: cbc5f2bfc1b33f186296fd9b6c0cc1b8d08fb1df
5
5
  SHA512:
6
- metadata.gz: 79e570bd455ecf0f2f7c500725e4a243f4e0d5133c5bdfd45100e10963bbe16623c37396d4a87b7018c74472813efbcfd212cc9d7ebe83c697ca00ad053d338c
7
- data.tar.gz: 0c4458f32f0a658d276218894912e3c1c53833dd0cb4e506885bcff00a824beeadda620c89a4d6c09376edd1a262b9396ad317eb275c981d4d08194eb48968da
6
+ metadata.gz: ae7b28363deb33a59141481eba79eecebd530c7810e9b29a79e9b2a618ca4e5dd8fa6e0211d5ae3d167fe29bff286a175aac0094a8b353e8ae59f484e1caadeb
7
+ data.tar.gz: bd3858caaa4d37e67bc586a18e1607a2d5c88f2385d9760fc59c9b15ad8fb403694f7a354248299928644acd4cec19bfbc4771f091fbdfd8c75348c6930b9ac0
data/.travis.yml CHANGED
@@ -10,5 +10,10 @@ before_script:
10
10
 
11
11
  matrix:
12
12
  include:
13
- - rvm: 2.3.1
13
+ - rvm: 2.4.1
14
14
  gemfile: gemfiles/rails5.gemfile
15
+ - rvm: ruby-head
16
+ gemfile: gemfiles/railsmaster.gemfile
17
+ allow_failures:
18
+ - rvm: ruby-head
19
+ gemfile: gemfiles/railsmaster.gemfile
data/Gemfile CHANGED
@@ -7,5 +7,5 @@ local_gemfile = 'Gemfile.local'
7
7
  if File.exist?(local_gemfile)
8
8
  eval(File.read(local_gemfile)) # rubocop:disable Lint/Eval
9
9
  else
10
- gem 'activerecord', '5.0.0'
10
+ gem 'activerecord', '5.1.0'
11
11
  end
@@ -1,5 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rails', '~>5.0.0'
3
+ gem 'rails', '~> 5.1.0'
4
4
 
5
5
  gemspec path: '..'
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'arel', github: 'rails/arel'
4
+ gem 'rails', github: 'rails/rails'
5
+
6
+ gemspec path: '..'
@@ -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
- serialize store_name, IndifferentCoder.new(options[:coder])
25
- store_accessor(store_name, *options[:accessors]) if options.key?(:accessors)
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
  #
@@ -1,3 +1,3 @@
1
1
  module StoreAttribute # :nodoc:
2
- VERSION = "0.5.1".freeze
2
+ VERSION = "0.5.2".freeze
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -13,6 +13,8 @@ require 'active_record'
13
13
  require 'pg'
14
14
  require 'store_attribute'
15
15
 
16
+ RAILS_5_1 = ActiveRecord.version.release >= Gem::Version.new("5.1.0")
17
+
16
18
  ActiveRecord::Base.establish_connection(
17
19
  adapter: 'postgresql',
18
20
  database: 'store_attribute_test'
@@ -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
@@ -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.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.1
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: 2016-07-08 00:00:00.000000000 Z
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.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.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.4
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