setting_accessors 1.0.0 → 1.1.0

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
  SHA256:
3
- metadata.gz: ccf27bd36edbc82a68d4f3030c58e3582f71c63dafd2289c5fb483bfd8a81263
4
- data.tar.gz: 153d794f0323bb0f8518a8331145766df1ca8fc935c88a4419f9b5772c2226db
3
+ metadata.gz: 3fcd820da4c83ab5b7b6d428304289e115ac09a35570be868f53091d441dbfa5
4
+ data.tar.gz: cdcb83249a2196a0878200171edc82a51780a82b3d081cf480c2fc161d38b192
5
5
  SHA512:
6
- metadata.gz: ff2f5b55fb799e97f14272962f832de8121ee549aa53a7c988a205e7028b4d9b9ad1f5cd5f141a5ce8c8d5d29b494b7ffff2e1ead3929dae4e5df3406f64d285
7
- data.tar.gz: 1c7819afb12ef5cfd4de81ca05e6c3c5605eb1c9e2173a977bcd806b64b229443733e13b1c31b18dc3579a1fc17ca1b4677ee6f7d7c47bc701caa2a61e1b32e0
6
+ metadata.gz: 5b6e63ac875a54ea5280fb1c8e605c27dcaf6d9c3f7964c4cfaf2dfca5ba04539c00a14f341047d2e696832c35947b06325132e28b9e92e097e9251f65d35d32
7
+ data.tar.gz: 1ecf896390e1b251b08d2458677613a50a510c3bf764ad088ee0c43d06d1a3882127b11d6cbe57e4f60dae06516fa3f6845be1da4caa77048cf59cdddae34514
data/.travis.yml CHANGED
@@ -1,6 +1,10 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
 
4
+ env:
5
+ global:
6
+ - CC_TEST_REPORTER_ID=6dc7db591131b55839297349c4a843ee7d7d9b28731c6bb4f1db9d42fa86c7b6
7
+
4
8
  rvm:
5
9
  - 2.3.0
6
10
  - 2.3.3
@@ -16,8 +20,17 @@ gemfile:
16
20
  - gemfiles/rails_5.2.gemfile
17
21
 
18
22
  before_install: 'gem install bundler'
23
+
24
+ before_script:
25
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
26
+ - chmod +x ./cc-test-reporter
27
+ - ./cc-test-reporter before-build
28
+
19
29
  script: 'bundle exec rake'
20
30
 
31
+ after_script:
32
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
33
+
21
34
  notifications:
22
35
  email:
23
36
  on_failure: change
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.0
4
+
5
+ A bugfix and slight refactoring release which takes care of several issues regarding
6
+ changing setting-values in-place without actually setting them before. (#13)
7
+
8
+ * More and better specs
9
+ * Better handling of non-existent settings through exception handling rather than multiple error prone tests
10
+
3
11
  ## 1.0.0
4
12
 
5
13
  This is almost a complete refactoring of the gem which also removes some not really needed functionality.
data/README.md CHANGED
@@ -4,6 +4,7 @@ SettingAccessors
4
4
  [![Gem Version](https://badge.fury.io/rb/setting_accessors.svg)](http://badge.fury.io/rb/setting_accessors)
5
5
  [![Build Status](https://travis-ci.org/Stex/setting_accessors.svg?branch=master)](https://travis-ci.org/Stex/setting_accessors)
6
6
  [![Maintainability](https://api.codeclimate.com/v1/badges/78becd1d005aab2d1409/maintainability)](https://codeclimate.com/github/Stex/setting_accessors/maintainability)
7
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/a99a88d28ad37a79dbf6/test_coverage)](https://codeclimate.com/github/codeclimate/codeclimate/test_coverage)
7
8
 
8
9
  Sometimes it's handy to keep track of various settings or attributes in ActiveRecord instances and persist them through various requests (and sessions). An example would be to store a items-per-page value for multiple tables in the application per user or probably also set default sorting directions.
9
10
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- setting_accessors (1.0.0)
4
+ setting_accessors (1.1.0)
5
5
  activemodel (>= 4.2, <= 5.2)
6
6
  activerecord (>= 4.2, <= 5.2)
7
7
  activesupport (>= 4.2, <= 5.2)
@@ -50,9 +50,12 @@ GEM
50
50
  arel (6.0.4)
51
51
  ast (2.4.0)
52
52
  builder (3.2.3)
53
+ byebug (10.0.2)
54
+ coderay (1.1.2)
53
55
  concurrent-ruby (1.1.3)
54
56
  crass (1.0.4)
55
57
  diff-lcs (1.3)
58
+ docile (1.1.5)
56
59
  erubis (2.7.0)
57
60
  generator_spec (0.9.4)
58
61
  activesupport (>= 3.0.0)
@@ -62,11 +65,13 @@ GEM
62
65
  i18n (0.9.5)
63
66
  concurrent-ruby (~> 1.0)
64
67
  jaro_winkler (1.5.1-x86_64-darwin-17)
68
+ json (2.1.0)
65
69
  loofah (2.2.3)
66
70
  crass (~> 1.0.2)
67
71
  nokogiri (>= 1.5.9)
68
72
  mail (2.7.1)
69
73
  mini_mime (>= 0.1.1)
74
+ method_source (0.9.2)
70
75
  mini_mime (1.0.1)
71
76
  mini_portile2 (2.3.0)
72
77
  minitest (5.11.3)
@@ -76,6 +81,12 @@ GEM
76
81
  parser (2.5.3.0)
77
82
  ast (~> 2.4.0)
78
83
  powerpack (0.1.2)
84
+ pry (0.12.2)
85
+ coderay (~> 1.1.0)
86
+ method_source (~> 0.9.0)
87
+ pry-byebug (3.6.0)
88
+ byebug (~> 10.0)
89
+ pry (~> 0.10)
79
90
  rack (1.6.11)
80
91
  rack-test (0.6.3)
81
92
  rack (>= 1.0)
@@ -127,6 +138,11 @@ GEM
127
138
  ruby-progressbar (~> 1.7)
128
139
  unicode-display_width (~> 1.4.0)
129
140
  ruby-progressbar (1.10.0)
141
+ simplecov (0.16.1)
142
+ docile (~> 1.1)
143
+ json (>= 1.8, < 3)
144
+ simplecov-html (~> 0.10.0)
145
+ simplecov-html (0.10.2)
130
146
  sprockets (3.7.2)
131
147
  concurrent-ruby (~> 1.0)
132
148
  rack (> 1, < 3)
@@ -150,11 +166,14 @@ DEPENDENCIES
150
166
  appraisal (~> 2.2)
151
167
  bundler (~> 1.6)
152
168
  generator_spec (~> 0.9)
169
+ pry (~> 0.12)
170
+ pry-byebug (~> 3.6)
153
171
  rails (~> 4.2.0)
154
172
  rake (~> 10.4)
155
173
  rspec (~> 3.8)
156
174
  rubocop (~> 0.60)
157
175
  setting_accessors!
176
+ simplecov (~> 0.16)
158
177
  sqlite3 (~> 1.3)
159
178
  with_model (~> 2.1)
160
179
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- setting_accessors (1.0.0)
4
+ setting_accessors (1.1.0)
5
5
  activemodel (>= 4.2, <= 5.2)
6
6
  activerecord (>= 4.2, <= 5.2)
7
7
  activesupport (>= 4.2, <= 5.2)
@@ -53,9 +53,12 @@ GEM
53
53
  arel (7.1.4)
54
54
  ast (2.4.0)
55
55
  builder (3.2.3)
56
+ byebug (10.0.2)
57
+ coderay (1.1.2)
56
58
  concurrent-ruby (1.1.3)
57
59
  crass (1.0.4)
58
60
  diff-lcs (1.3)
61
+ docile (1.1.5)
59
62
  erubis (2.7.0)
60
63
  generator_spec (0.9.4)
61
64
  activesupport (>= 3.0.0)
@@ -65,6 +68,7 @@ GEM
65
68
  i18n (1.0.1)
66
69
  concurrent-ruby (~> 1.0)
67
70
  jaro_winkler (1.5.1-x86_64-darwin-17)
71
+ json (2.1.0)
68
72
  loofah (2.2.3)
69
73
  crass (~> 1.0.2)
70
74
  nokogiri (>= 1.5.9)
@@ -81,6 +85,12 @@ GEM
81
85
  parser (2.5.3.0)
82
86
  ast (~> 2.4.0)
83
87
  powerpack (0.1.2)
88
+ pry (0.12.2)
89
+ coderay (~> 1.1.0)
90
+ method_source (~> 0.9.0)
91
+ pry-byebug (3.6.0)
92
+ byebug (~> 10.0)
93
+ pry (~> 0.10)
84
94
  rack (2.0.6)
85
95
  rack-test (0.6.3)
86
96
  rack (>= 1.0)
@@ -131,6 +141,11 @@ GEM
131
141
  ruby-progressbar (~> 1.7)
132
142
  unicode-display_width (~> 1.4.0)
133
143
  ruby-progressbar (1.10.0)
144
+ simplecov (0.16.1)
145
+ docile (~> 1.1)
146
+ json (>= 1.8, < 3)
147
+ simplecov-html (~> 0.10.0)
148
+ simplecov-html (0.10.2)
134
149
  sprockets (3.7.2)
135
150
  concurrent-ruby (~> 1.0)
136
151
  rack (> 1, < 3)
@@ -157,11 +172,14 @@ DEPENDENCIES
157
172
  appraisal (~> 2.2)
158
173
  bundler (~> 1.6)
159
174
  generator_spec (~> 0.9)
175
+ pry (~> 0.12)
176
+ pry-byebug (~> 3.6)
160
177
  rails (~> 5.0.0)
161
178
  rake (~> 10.4)
162
179
  rspec (~> 3.8)
163
180
  rubocop (~> 0.60)
164
181
  setting_accessors!
182
+ simplecov (~> 0.16)
165
183
  sqlite3 (~> 1.3)
166
184
  with_model (~> 2.1)
167
185
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- setting_accessors (1.0.0)
4
+ setting_accessors (1.1.0)
5
5
  activemodel (>= 4.2, <= 5.2)
6
6
  activerecord (>= 4.2, <= 5.2)
7
7
  activesupport (>= 4.2, <= 5.2)
@@ -53,9 +53,12 @@ GEM
53
53
  arel (8.0.0)
54
54
  ast (2.4.0)
55
55
  builder (3.2.3)
56
+ byebug (10.0.2)
57
+ coderay (1.1.2)
56
58
  concurrent-ruby (1.1.3)
57
59
  crass (1.0.4)
58
60
  diff-lcs (1.3)
61
+ docile (1.1.5)
59
62
  erubi (1.7.1)
60
63
  generator_spec (0.9.4)
61
64
  activesupport (>= 3.0.0)
@@ -65,6 +68,7 @@ GEM
65
68
  i18n (1.1.1)
66
69
  concurrent-ruby (~> 1.0)
67
70
  jaro_winkler (1.5.1)
71
+ json (2.1.0)
68
72
  loofah (2.2.3)
69
73
  crass (~> 1.0.2)
70
74
  nokogiri (>= 1.5.9)
@@ -81,6 +85,12 @@ GEM
81
85
  parser (2.5.3.0)
82
86
  ast (~> 2.4.0)
83
87
  powerpack (0.1.2)
88
+ pry (0.12.2)
89
+ coderay (~> 1.1.0)
90
+ method_source (~> 0.9.0)
91
+ pry-byebug (3.6.0)
92
+ byebug (~> 10.0)
93
+ pry (~> 0.10)
84
94
  rack (2.0.6)
85
95
  rack-test (1.1.0)
86
96
  rack (>= 1.0, < 3)
@@ -131,6 +141,11 @@ GEM
131
141
  ruby-progressbar (~> 1.7)
132
142
  unicode-display_width (~> 1.4.0)
133
143
  ruby-progressbar (1.10.0)
144
+ simplecov (0.16.1)
145
+ docile (~> 1.1)
146
+ json (>= 1.8, < 3)
147
+ simplecov-html (~> 0.10.0)
148
+ simplecov-html (0.10.2)
134
149
  sprockets (3.7.2)
135
150
  concurrent-ruby (~> 1.0)
136
151
  rack (> 1, < 3)
@@ -157,11 +172,14 @@ DEPENDENCIES
157
172
  appraisal (~> 2.2)
158
173
  bundler (~> 1.6)
159
174
  generator_spec (~> 0.9)
175
+ pry (~> 0.12)
176
+ pry-byebug (~> 3.6)
160
177
  rails (~> 5.1.0)
161
178
  rake (~> 10.4)
162
179
  rspec (~> 3.8)
163
180
  rubocop (~> 0.60)
164
181
  setting_accessors!
182
+ simplecov (~> 0.16)
165
183
  sqlite3 (~> 1.3)
166
184
  with_model (~> 2.1)
167
185
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- setting_accessors (1.0.0)
4
+ setting_accessors (1.1.0)
5
5
  activemodel (>= 4.2, <= 5.2)
6
6
  activerecord (>= 4.2, <= 5.2)
7
7
  activesupport (>= 4.2, <= 5.2)
@@ -57,9 +57,12 @@ GEM
57
57
  arel (9.0.0)
58
58
  ast (2.4.0)
59
59
  builder (3.2.3)
60
+ byebug (10.0.2)
61
+ coderay (1.1.2)
60
62
  concurrent-ruby (1.1.3)
61
63
  crass (1.0.4)
62
64
  diff-lcs (1.3)
65
+ docile (1.1.5)
63
66
  erubi (1.7.1)
64
67
  generator_spec (0.9.4)
65
68
  activesupport (>= 3.0.0)
@@ -69,6 +72,7 @@ GEM
69
72
  i18n (1.1.1)
70
73
  concurrent-ruby (~> 1.0)
71
74
  jaro_winkler (1.5.1)
75
+ json (2.1.0)
72
76
  loofah (2.2.3)
73
77
  crass (~> 1.0.2)
74
78
  nokogiri (>= 1.5.9)
@@ -88,6 +92,12 @@ GEM
88
92
  parser (2.5.3.0)
89
93
  ast (~> 2.4.0)
90
94
  powerpack (0.1.2)
95
+ pry (0.12.2)
96
+ coderay (~> 1.1.0)
97
+ method_source (~> 0.9.0)
98
+ pry-byebug (3.6.0)
99
+ byebug (~> 10.0)
100
+ pry (~> 0.10)
91
101
  rack (2.0.6)
92
102
  rack-test (1.1.0)
93
103
  rack (>= 1.0, < 3)
@@ -139,6 +149,11 @@ GEM
139
149
  ruby-progressbar (~> 1.7)
140
150
  unicode-display_width (~> 1.4.0)
141
151
  ruby-progressbar (1.10.0)
152
+ simplecov (0.16.1)
153
+ docile (~> 1.1)
154
+ json (>= 1.8, < 3)
155
+ simplecov-html (~> 0.10.0)
156
+ simplecov-html (0.10.2)
142
157
  sprockets (3.7.2)
143
158
  concurrent-ruby (~> 1.0)
144
159
  rack (> 1, < 3)
@@ -165,11 +180,14 @@ DEPENDENCIES
165
180
  appraisal (~> 2.2)
166
181
  bundler (~> 1.6)
167
182
  generator_spec (~> 0.9)
183
+ pry (~> 0.12)
184
+ pry-byebug (~> 3.6)
168
185
  rails (~> 5.2.0)
169
186
  rake (~> 10.4)
170
187
  rspec (~> 3.8)
171
188
  rubocop (~> 0.60)
172
189
  setting_accessors!
190
+ simplecov (~> 0.16)
173
191
  sqlite3 (~> 1.3)
174
192
  with_model (~> 2.1)
175
193
 
@@ -21,6 +21,10 @@ ActiveRecord::Base.class_eval do
21
21
  end
22
22
 
23
23
  module SettingAccessors
24
+ class Error < StandardError; end
25
+ class NestedHashKeyNotFoundError < Error; end
26
+ class SettingNotFoundError < Error; end
27
+
24
28
  def self.setting_class
25
29
  setting_class_name.constantize
26
30
  end
@@ -2,9 +2,6 @@
2
2
 
3
3
  module SettingAccessors
4
4
  module Helpers
5
- class Error < StandardError; end
6
- class NestedHashKeyNotFoundException < Error; end
7
-
8
5
  def ensure_nested_hash!(hash, *keys)
9
6
  h = hash
10
7
  keys.each do |key|
@@ -14,11 +11,11 @@ module SettingAccessors
14
11
  end
15
12
 
16
13
  def lookup_nested_hash(hash, *keys)
17
- fail NestedHashKeyNotFoundException if hash.nil?
14
+ fail NestedHashKeyNotFoundError if hash.nil?
18
15
 
19
16
  h = hash
20
17
  keys.each do |key|
21
- fail NestedHashKeyNotFoundException unless h.key?(key)
18
+ fail NestedHashKeyNotFoundError unless h.key?(key)
22
19
 
23
20
  h = h[key]
24
21
  end
@@ -62,7 +62,7 @@ module SettingAccessors
62
62
  #
63
63
  def self.get_class_setting(klass, setting_name)
64
64
  lookup_nested_hash(class_settings, klass.to_s, setting_name.to_s)
65
- rescue ::SettingAccessors::Helpers::NestedHashKeyNotFoundException
65
+ rescue NestedHashKeyNotFoundError
66
66
  nil
67
67
  end
68
68
 
@@ -37,6 +37,15 @@ module SettingAccessors
37
37
  setting_record(name, assignable).try(:value)
38
38
  end
39
39
 
40
+ #
41
+ # Like #get, but will raise an exception if the requested setting doesn't exist in the database
42
+ #
43
+ def get!(name, assignable = nil)
44
+ setting_record!(name, assignable).value
45
+ rescue ActiveRecord::RecordNotFound
46
+ raise ::SettingAccessors::SettingNotFoundError
47
+ end
48
+
40
49
  alias [] get
41
50
 
42
51
  #
@@ -46,11 +55,9 @@ module SettingAccessors
46
55
  # This only works for class-wise settings, meaning that an assignable has to be present.
47
56
  #
48
57
  def get_or_default(name, assignable)
49
- if (val = get(name, assignable)).nil?
50
- new(name: name, assignable: assignable).default_value
51
- else
52
- val
53
- end
58
+ get!(name, assignable)
59
+ rescue ::SettingAccessors::SettingNotFoundError
60
+ get_default_value(name, assignable)
54
61
  end
55
62
 
56
63
  #
@@ -108,6 +115,14 @@ module SettingAccessors
108
115
  find_by(name: name.to_s, assignable: assignable)
109
116
  end
110
117
 
118
+ #
119
+ # Like #setting_record, but will raise an ActiveRecord::RecordNotFound exception
120
+ # if the record doesn't exist yet
121
+ #
122
+ def setting_record!(name, assignable = nil)
123
+ setting_record(name, assignable) || raise(ActiveRecord::RecordNotFound)
124
+ end
125
+
111
126
  #
112
127
  # Makes accessing settings a little easier.
113
128
  # Examples:
@@ -22,22 +22,12 @@ module SettingAccessors
22
22
  # If a setting hasn't been read by this record (instance) before, its value
23
23
  # is stored in the local read set.
24
24
  #
25
- # TODO: See if this causes problems with read settings not being updated by external changes.
26
- # User1: Read Setting X
27
- # User2: Update Setting X
28
- # User1: Read Setting X -> Gets old value from temp settings.
29
- # This shouldn't be too dangerous as the system state will be refreshed with every request though.
30
- #
31
- # @param [Boolean] skip_cached
32
- # If set to +true+, the setting value is freshly loaded from the database,
33
- # even if a value that's not yet persisted exists.
34
- #
35
- def get(key, skip_cached: false)
36
- return @temp_settings[key.to_sym] if !skip_cached && key?(key)
25
+ def get(key)
26
+ return @temp_settings[key.to_sym] if key?(key)
37
27
 
38
- value = SettingAccessors.setting_class.get(key, record)
39
- @temp_settings[key.to_sym] = value unless value.nil?
40
- value
28
+ @temp_settings[key.to_sym] = current_database_value!(key)
29
+ rescue SettingNotFoundError
30
+ nil
41
31
  end
42
32
 
43
33
  alias [] get
@@ -66,15 +56,11 @@ module SettingAccessors
66
56
  # If set to +true+, the setting's default value is written to the temporary settings
67
57
  # for faster access. Otherwise, a database lookup is performed every time.
68
58
  #
69
- # @param [Boolean] skip_cached
70
- # If set to +true+, a possible temporary setting is skipped when looking up the value.
71
- # This means, the default value is returned even if there is a not yet persisted change to the setting.
72
- #
73
- def get_or_default(key, store_default: true, skip_cached: false)
74
- result = get(key, skip_cached: skip_cached)
75
- return result if result || (key?(key) && !skip_cached)
59
+ def get_or_default(key, store_default: true)
60
+ result = get(key)
61
+ return result if key?(key) # If no key is found here, we didn't have a setting in the database
76
62
 
77
- try_dup(SettingAccessors.setting_class.get_or_default(key, record)).tap do |value|
63
+ try_dup(default_value(key)).tap do |value|
78
64
  set(key, value) if store_default
79
65
  end
80
66
  end
@@ -95,26 +81,57 @@ module SettingAccessors
95
81
  #
96
82
  def value_was(key)
97
83
  lookup_nested_hash(@old_values, key.to_s)
98
- rescue NestedHashKeyNotFoundException
99
- get(key)
84
+ rescue NestedHashKeyNotFoundError
85
+ current_database_value(key)
100
86
  end
101
87
 
88
+ #
89
+ # @return [Boolean] +true+ if the value for the given setting differs from the database or default value
90
+ #
102
91
  def value_changed?(key)
103
92
  get(key) != value_was(key)
104
93
  end
105
94
 
95
+ #
96
+ # @return [Object] The raw value passed to this setting before it was casted to the correct type
97
+ #
106
98
  def value_before_type_cast(key)
107
99
  lookup_nested_hash(@values_before_type_casts, key.to_s)
108
- rescue NestedHashKeyNotFoundException
100
+ rescue NestedHashKeyNotFoundError
109
101
  get(key)
110
102
  end
111
103
 
104
+ #
105
+ # @return [Hash] the settings which were actually changed since the last persist!
106
+ #
112
107
  def changed_settings
113
108
  @temp_settings.select { |k, _| value_changed?(k) }
114
109
  end
115
110
 
116
111
  protected
117
112
 
113
+ #
114
+ # @return [Object] the current setting value from the database or +nil+ if the setting does not exist yet.
115
+ #
116
+ def current_database_value(key)
117
+ SettingAccessors.setting_class.get(key, record)
118
+ end
119
+
120
+ #
121
+ # Like #current_database_value, but will raise a SettingNotFound exception
122
+ # if there is no current database value
123
+ #
124
+ def current_database_value!(key)
125
+ SettingAccessors.setting_class.get!(key, record)
126
+ end
127
+
128
+ #
129
+ # @return [Object] the default value for the given setting
130
+ #
131
+ def default_value(key)
132
+ SettingAccessors.setting_class.get_default_value(key, record)
133
+ end
134
+
118
135
  #
119
136
  # Keeps a record of the originally set value for a setting before it was
120
137
  # automatically converted.
@@ -132,7 +149,11 @@ module SettingAccessors
132
149
  @old_values ||= {}
133
150
 
134
151
  unless @old_values.key?(key.to_s)
135
- @old_values[key.to_s] = get_or_default(key, skip_cached: true, store_default: false)
152
+ @old_values[key.to_s] = begin
153
+ current_database_value!(key)
154
+ rescue SettingNotFoundError
155
+ default_value(key)
156
+ end
136
157
  end
137
158
  end
138
159
 
@@ -153,7 +174,7 @@ module SettingAccessors
153
174
  # validations itself.
154
175
  #
155
176
  def persist!
156
- @temp_settings.each do |key, value|
177
+ changed_settings.each do |key, value|
157
178
  Setting.set(key, value, assignable: record)
158
179
  end
159
180
  flush!
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SettingAccessors
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
5
5
  end
@@ -28,9 +28,12 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency 'appraisal', '~> 2.2'
29
29
  spec.add_development_dependency 'bundler', '~> 1.6'
30
30
  spec.add_development_dependency 'generator_spec', '~> 0.9'
31
+ spec.add_development_dependency 'pry', '~> 0.12'
32
+ spec.add_development_dependency 'pry-byebug', '~> 3.6'
31
33
  spec.add_development_dependency 'rake', '~> 10.4'
32
34
  spec.add_development_dependency 'rspec', '~> 3.8'
33
35
  spec.add_development_dependency 'rubocop', '~> 0.60'
36
+ spec.add_development_dependency 'simplecov', '~> 0.16'
34
37
  spec.add_development_dependency 'sqlite3', '~> 1.3'
35
38
  spec.add_development_dependency 'with_model', '~> 2.1'
36
39
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: setting_accessors
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Exner
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-26 00:00:00.000000000 Z
11
+ date: 2018-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal
@@ -52,6 +52,34 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.9'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.12'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.12'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry-byebug
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.6'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.6'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: rake
57
85
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +122,20 @@ dependencies:
94
122
  - - "~>"
95
123
  - !ruby/object:Gem::Version
96
124
  version: '0.60'
125
+ - !ruby/object:Gem::Dependency
126
+ name: simplecov
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '0.16'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '0.16'
97
139
  - !ruby/object:Gem::Dependency
98
140
  name: sqlite3
99
141
  requirement: !ruby/object:Gem::Requirement