feature_setting 1.5.3 → 1.5.4

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: e997e0e5c3e97cd8965b4184fbdb9c588c3957a6
4
- data.tar.gz: 80c3b200ef96a4a4f0dbb268793d4ab2e575e7da
3
+ metadata.gz: ee3d92b918ce890829a5ecf064a20f39444a6482
4
+ data.tar.gz: 3431c83ef4bd43e641f8bfd7e577d7322e40c97a
5
5
  SHA512:
6
- metadata.gz: b36221bdde762164bbb4d1cc33d725078666d03faec3429743ed6d6c7d611c43aef7fbc1ce5149a508bc832c517e4b33b232e720046e94bb038e6a52cff97bfa
7
- data.tar.gz: 95a2902ff97f5dbda4d4251225c2bcb9b6f93d819b7f87fd9c8b536e8ccd3f788962c1dbba8c83ad535c904522c37bfc4416fb98fb105427faa2de5c04a3714a
6
+ metadata.gz: 82608414414a113c07e7f3be8aad19c8a96855c05280de162c5c54003d0d77babe116daafa6c047c34fb0f5021accfb8ed9f1f3783fbee58a755240f100d0cb8
7
+ data.tar.gz: 5b02277fbc40074d8bed18c46b3eef7212d7347a723563bdbd1dad783a42b8d9cade07ee582b7c09dd6e936be1af3c01a44a201cd7fc8c89ff4408864a87e8dd
data/README.md CHANGED
@@ -63,6 +63,7 @@ class Features < FeatureSetting::Feature
63
63
  init_features!
64
64
  end
65
65
  ```
66
+ **Note:** You can call `init_features!(true)` to remove any existing features that are not defined anymore
66
67
 
67
68
  For each key you have defined, a class method `keyname_enabled?` is generated. You can now do the following:
68
69
 
@@ -103,6 +104,8 @@ class Settings < FeatureSetting::Setting
103
104
  end
104
105
  ```
105
106
 
107
+ **Note:** You can call `init_settings!(true)` to remove any existing settings that are not defined anymore
108
+
106
109
  You can now do the following:
107
110
 
108
111
  ```ruby
@@ -31,7 +31,7 @@ module FeatureSetting
31
31
  self.new.klass.to_s
32
32
  end
33
33
 
34
- def init_features!
34
+ def init_features!(remove_old_features = false)
35
35
  features.each do |key, value|
36
36
  self.create_with(key: key, enabled: value, klass: klass).find_or_create_by(klass: klass, key: key)
37
37
  define_singleton_method("#{key}_enabled?") do
@@ -45,7 +45,7 @@ module FeatureSetting
45
45
  disable!(key)
46
46
  end
47
47
  end
48
- remove_old_features!
48
+ remove_old_features! if remove_old_features
49
49
  end
50
50
 
51
51
  def remove_old_features!
@@ -24,13 +24,13 @@ module FeatureSetting
24
24
  self.new.klass.to_s
25
25
  end
26
26
 
27
- def init_settings!
27
+ def init_settings!(remove_old_settings = false)
28
28
  settings.each do |key, value|
29
29
  self.create_with(key: key, value: convert_to_string(value, value.class.to_s), value_type: value.class.to_s, klass: klass).find_or_create_by(klass: klass, key: key)
30
30
  define_getter_method(key)
31
31
  define_setter_method(key)
32
32
  end
33
- remove_old_settings!
33
+ remove_old_settings! if remove_old_settings
34
34
  end
35
35
 
36
36
  def define_getter_method(key)
@@ -1,3 +1,3 @@
1
1
  module FeatureSetting
2
- VERSION = "1.5.3"
2
+ VERSION = "1.5.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: feature_setting
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.3
4
+ version: 1.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Indro De
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-14 00:00:00.000000000 Z
11
+ date: 2016-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
182
  version: '0'
183
183
  requirements: []
184
184
  rubyforge_project:
185
- rubygems_version: 2.4.5
185
+ rubygems_version: 2.6.4
186
186
  signing_key:
187
187
  specification_version: 4
188
188
  summary: A lightweight feature/setting DSL for Rails applications.