mongoid-app_settings 1.2.0 → 1.3.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
  SHA1:
3
- metadata.gz: 315a7376a278c286444b41667a84940a42b432cc
4
- data.tar.gz: 262877f8414e0dbd9ba6879505251bbd896496b9
3
+ metadata.gz: c53279684a84d048c29d74f1d96a88f92dc8bfec
4
+ data.tar.gz: 10c7cc8e07ab3c732ea5c159a297cb8c04a5127d
5
5
  SHA512:
6
- metadata.gz: f089ef829eb8ddd85ff999ebe32380a6bded3ee1d9670a05ee872a4832d27091388a355d4e5eb97a67f165bd0f1eeeca08da8a908ffd9bba80fd0bc8ec6d9df0
7
- data.tar.gz: 56d4fb5c55abf8d26bb7b456c3e5e4f2ac5c55dee8e0cc75469a7c59470cdb2c6d9e9caebb12713a77a3f25ec8aa1631988ca0745fce7424aa2c672874e46142
6
+ metadata.gz: eebba72ac6b4cfc290e62eadd97b5a84cbd41139c6f22b25b745c02092e683566666f5a936eb9f4e5a19387ea8725fd3387c1d8f3e96d31a2a9f203a018dd5a1
7
+ data.tar.gz: 1238fd33afb7905dd455b1eb0ff7d032bc4c492c8a835ba9edfc5ff47cc4e88e1f9699cb175492cd055619a3e4fab4477359f014c399dac030ed1125b06a270e
@@ -1,36 +1,46 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mongoid-app_settings (1.2.0)
4
+ mongoid-app_settings (1.3.0)
5
5
  activesupport
6
6
  mongoid (>= 2.0)
7
7
 
8
8
  GEM
9
9
  remote: http://rubygems.org/
10
10
  specs:
11
- activemodel (3.2.17)
12
- activesupport (= 3.2.17)
13
- builder (~> 3.0.0)
14
- activesupport (3.2.17)
15
- i18n (~> 0.6, >= 0.6.4)
16
- multi_json (~> 1.0)
11
+ activemodel (4.2.2)
12
+ activesupport (= 4.2.2)
13
+ builder (~> 3.1)
14
+ activesupport (4.2.2)
15
+ i18n (~> 0.7)
16
+ json (~> 1.7, >= 1.7.7)
17
+ minitest (~> 5.1)
18
+ thread_safe (~> 0.3, >= 0.3.4)
19
+ tzinfo (~> 1.1)
17
20
  appraisal (0.5.1)
18
21
  bundler
19
22
  rake
20
- builder (3.0.4)
23
+ bson (3.1.0)
24
+ builder (3.2.2)
21
25
  coderay (1.0.9)
26
+ connection_pool (2.2.0)
22
27
  database_cleaner (0.9.1)
23
28
  diff-lcs (1.1.3)
24
29
  i18n (0.7.0)
30
+ json (1.8.3)
25
31
  method_source (0.8.1)
26
- mongoid (3.0.16)
27
- activemodel (~> 3.1)
28
- moped (~> 1.1)
29
- origin (~> 1.0)
30
- tzinfo (~> 0.3.22)
31
- moped (1.5.0)
32
- multi_json (1.11.0)
33
- origin (1.1.0)
32
+ minitest (5.7.0)
33
+ mongoid (4.0.2)
34
+ activemodel (~> 4.0)
35
+ moped (~> 2.0.0)
36
+ origin (~> 2.1)
37
+ tzinfo (>= 0.3.37)
38
+ moped (2.0.6)
39
+ bson (~> 3.0)
40
+ connection_pool (~> 2.0)
41
+ optionable (~> 0.2.0)
42
+ optionable (0.2.0)
43
+ origin (2.1.1)
34
44
  pry (0.9.12.2)
35
45
  coderay (~> 1.0.5)
36
46
  method_source (~> 0.8)
@@ -45,7 +55,9 @@ GEM
45
55
  diff-lcs (~> 1.1.3)
46
56
  rspec-mocks (2.11.3)
47
57
  slop (3.4.5)
48
- tzinfo (0.3.42)
58
+ thread_safe (0.3.5)
59
+ tzinfo (1.2.2)
60
+ thread_safe (~> 0.1)
49
61
 
50
62
  PLATFORMS
51
63
  ruby
@@ -56,3 +68,6 @@ DEPENDENCIES
56
68
  mongoid-app_settings!
57
69
  pry
58
70
  rspec (~> 2.11)
71
+
72
+ BUNDLED WITH
73
+ 1.10.4
@@ -18,7 +18,7 @@ Simply create some class and include `Mongoid::AppSettings`.
18
18
  include Mongoid::AppSettings
19
19
 
20
20
  setting :enable_my_feature, default: true
21
- setting :something_else
21
+ setting :something_else, type: Integer
22
22
  end
23
23
 
24
24
  Then you can do things like:
@@ -30,9 +30,9 @@ Then you can do things like:
30
30
  MySettings.enable_my_feature
31
31
  => false
32
32
 
33
- MySettings.something_else = "FooBar"
33
+ MySettings.something_else = "42"
34
34
  MySettings.something_else
35
- => "FooBar"
35
+ => "42"
36
36
 
37
37
  You can unset a value (reverting it to the default if given):
38
38
 
@@ -43,7 +43,7 @@ You can unset a value (reverting it to the default if given):
43
43
  You can get a list of all values:
44
44
 
45
45
  MySettings.all
46
- => {:enable_my_feature => true, :something_else => "FooBar"}
46
+ => {:enable_my_feature => true, :something_else => "42"}
47
47
 
48
48
  You can get a list of defaults:
49
49
 
@@ -63,6 +63,7 @@ might want to do something like
63
63
 
64
64
  # Changelog
65
65
 
66
+ * 1.3.0 - Added support for converting to proper types, using Mongoid's conversion.
66
67
  * 1.2.0 - Added chaining behaviour for reload: `AppSettings.reload.some_setting` is now possible.
67
68
  * 1.1.1 - Add support for Mongoid 4 (available in git). Still supports Mongoid 2 and 3.
68
69
  * 1.1 - Add support for Mongoid 3. Mongoid 2 is still supported.
@@ -1,7 +1,7 @@
1
1
  PATH
2
- remote: /Users/marten/prj/mongoid-app_settings
2
+ remote: ../
3
3
  specs:
4
- mongoid-app_settings (1.1.0)
4
+ mongoid-app_settings (1.2.0)
5
5
  activesupport
6
6
  mongoid (>= 2.0)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
- remote: /Users/marten/prj/mongoid-app_settings
2
+ remote: ../
3
3
  specs:
4
- mongoid-app_settings (1.1.0)
4
+ mongoid-app_settings (1.2.0)
5
5
  activesupport
6
6
  mongoid (>= 2.0)
7
7
 
@@ -9,9 +9,9 @@ GIT
9
9
  tzinfo (~> 0.3.22)
10
10
 
11
11
  PATH
12
- remote: /Users/marten/prj/mongoid-app_settings
12
+ remote: ../
13
13
  specs:
14
- mongoid-app_settings (1.1.0)
14
+ mongoid-app_settings (1.2.0)
15
15
  activesupport
16
16
  mongoid (>= 2.0)
17
17
 
@@ -34,7 +34,7 @@ module Mongoid
34
34
  settings[name.to_s] = options
35
35
 
36
36
  Record.instance_eval do
37
- field name
37
+ field name, options.slice(:type)
38
38
  end
39
39
 
40
40
  @base.class.class_eval do
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module AppSettings
3
- VERSION = '1.2.0'
3
+ VERSION = '1.3.0'
4
4
  end
5
5
  end
@@ -117,6 +117,12 @@ describe "Mongoid::AppSettings" do
117
117
  settings.foo = nil
118
118
  settings.foo.should == nil
119
119
  end
120
+
121
+ it 'converts types' do
122
+ settings.instance_eval { setting :foo, :type => Integer, :default => 42 }
123
+ settings.foo = "37"
124
+ settings.foo.should == 37
125
+ end
120
126
  end
121
127
 
122
128
  describe "reload behaviour" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-app_settings
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marten Veldthuis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-03 00:00:00.000000000 Z
11
+ date: 2015-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid