mongoid-preferences 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.idea
2
+ *.gem
3
+ *.rbc
4
+ .bundle
5
+ .config
6
+ .yardoc
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - "1.9.3"
4
+ services:
5
+ - mongodb
6
+
7
+ # uncomment this line if your project needs to run something other than `rake`:
8
+ # script: bundle exec rspec spec
data/CHANGELOG.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ ## v0.0.1
2
+
3
+ * Initial release
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in mongoid-preferences.gemspec
4
+ gemspec
5
+
6
+ gem 'coveralls', require: false
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Mattia Toso
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ [![Build Status](https://travis-ci.org/matito/mongoid-preferences.png?branch=master)](https://travis-ci.org/matito/mongoid-preferences)
2
+ [![Code Climate](https://codeclimate.com/github/matito/mongoid-preferences.png)](https://codeclimate.com/github/matito/mongoid-preferences)
3
+ [![Coverage Status](https://coveralls.io/repos/matito/mongoid-preferences/badge.png)](https://coveralls.io/r/matito/mongoid-preferences)
4
+
5
+ # Mongoid::Preferences
6
+
7
+ Add preferences hash to Mongoid model.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ gem 'mongoid-preferences'
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install mongoid-preferences
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Contributing
28
+
29
+ 1. Fork it
30
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
31
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
32
+ 4. Push to the branch (`git push origin my-new-feature`)
33
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env rake
2
+ require 'bundler/gem_tasks'
3
+ require 'rspec/core/rake_task'
4
+ require 'yard'
5
+
6
+ YARD::Rake::YardocTask.new
7
+ RSpec::Core::RakeTask.new(:spec)
8
+
9
+ task :default => :spec
@@ -0,0 +1,98 @@
1
+ module Mongoid
2
+ module Preferences
3
+ module Preferenceable
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+
8
+ field :preferences, :type => Hash, :default => Proc.new { HashWithIndifferentAccess.new() }
9
+
10
+ after_initialize :load_preferences
11
+
12
+ # Returns all the preferences
13
+ def preferences
14
+ @_hash ||= merged_preferences
15
+ end
16
+
17
+ # Returns the value of preference or nil if the preference is not found
18
+ def pref(name)
19
+ self.preferences[name]
20
+ end
21
+
22
+ # Retruns true if the model has the preference, else returns false
23
+ def has_pref?(name)
24
+ return false unless self.preferences.has_key?(name)
25
+ true
26
+ end
27
+
28
+ # Set the value of specified preference or add a new preference, and returns the value
29
+ def write_pref(name, value)
30
+ #override the preference value or add new preference if not exist
31
+ preferences[name] = value
32
+ write_attribute(:preferences, preferences)
33
+ value
34
+ end
35
+
36
+ # Returns an array of hash of preferences
37
+ def displayable_preferences(group)
38
+ default_preferences_hash = default_preferences
39
+ if default_preferences_hash.has_key?(group)
40
+ default_preferences_hash[group][:preferences].each do |preference|
41
+ name = preference[:name]
42
+ if self.preferences.has_key?(name)
43
+ # overwrite default preference value with the model preference value
44
+ preference[:value] = self.preferences[name]
45
+ end
46
+ end
47
+ default_preferences_hash[group][:preferences]
48
+ else
49
+ nil
50
+ end
51
+ end
52
+
53
+ private
54
+
55
+ def load_preferences
56
+ if read_attribute(:preferences).empty?
57
+ write_attribute(:preferences, preferences)
58
+ end
59
+ end
60
+
61
+ # Returns a hash of default preferences loaded from file
62
+ def default_preferences
63
+ return self.class.class_variable_get :@@default_preferences if self.class.class_variable_defined? :@@default_preferences
64
+
65
+ default_preferences_path = File.join(Preferences.model_preferences_path, "#{self.class.name.downcase}", 'default_preferences.yml')
66
+ if File.exist?(default_preferences_path)
67
+ self.class.class_variable_set :@@default_preferences, HashWithIndifferentAccess.new(YAML.load_file(default_preferences_path)) # for access with symbols
68
+ else
69
+ logger.error "PreferencesModelError##{self.class.name}: File not found"
70
+ self.class.class_variable_set :@@default_preferences, {}
71
+ end
72
+ end
73
+
74
+ # Returns a hash of preferences merged from file and model
75
+ def merged_preferences
76
+ # get the preferences from model
77
+ model_preferences_hash = self.read_attribute(:preferences)
78
+ # get the default preferences form file
79
+ default_preferences_hash = default_preferences
80
+ # merge the preferences
81
+ default_preferences_hash.each_key do |key|
82
+ default_preferences_hash[key][:preferences].each do |preference|
83
+ name = preference[:name]
84
+ default_value = preference[:value]
85
+ # if the preference on model does not exist
86
+ unless model_preferences_hash.has_key? name
87
+ # add the new preference(read from file) to the model preferences hash
88
+ model_preferences_hash[name] = default_value
89
+ end
90
+ end
91
+ end
92
+ model_preferences_hash
93
+ end
94
+
95
+ end
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,5 @@
1
+ module Mongoid
2
+ module Preferences
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,21 @@
1
+ module Mongoid
2
+ module Preferences
3
+
4
+ require 'mongoid/preferences/preferenceable'
5
+ require 'mongoid/preferences/version'
6
+
7
+ include ActiveSupport::Configurable
8
+
9
+ config_accessor :model_preferences_path do
10
+ # default model preferences path
11
+ Rails.root.join('app','models_preferences')
12
+ end
13
+
14
+
15
+ #Mongoid::Preferences.configure do |config|
16
+ # # set default preferences path
17
+ # config.model_preferences_path = Rails.root.join('app','models_preferences')
18
+ #end
19
+
20
+ end
21
+ end
@@ -0,0 +1 @@
1
+ require 'mongoid/preferences'
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/mongoid/preferences/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Mattia Toso"]
6
+ gem.email = ["mattia@kunerango.com"]
7
+ gem.description = %q{Preferences with Mongoid}
8
+ gem.summary = %q{Add preferences hash to Mongoid model}
9
+ gem.homepage = "https://github.com/matito/mongoid-preferences.git"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "mongoid-preferences"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Mongoid::Preferences::VERSION
17
+
18
+ gem.add_dependency('mongoid', '~> 3')
19
+
20
+ gem.add_development_dependency('rake', '~> 10.0')
21
+ gem.add_development_dependency('rspec', '~> 2.12')
22
+ gem.add_development_dependency('yard', '~> 0.8')
23
+ gem.add_development_dependency('mongoid-rspec', '~> 1.5')
24
+ gem.add_development_dependency('database_cleaner', '~> 1.0')
25
+ gem.add_development_dependency('redcarpet', '~> 2.2')
26
+ gem.add_development_dependency('json', '~> 1.7.7')
27
+ end
@@ -0,0 +1,4 @@
1
+ class Dummy
2
+ include Mongoid::Document
3
+ include Mongoid::Preferences::Preferenceable
4
+ end
@@ -0,0 +1,15 @@
1
+ view:
2
+ name: 'view_preferences'
3
+ preferences:
4
+ -
5
+ name: 'show_tabs_control'
6
+ type: 'boolean'
7
+ value: true
8
+ -
9
+ name: 'show_wall_page'
10
+ type: 'boolean'
11
+ value: true
12
+ -
13
+ name: 'show_materials_page'
14
+ type: 'boolean'
15
+ value: true
@@ -0,0 +1,293 @@
1
+ require 'spec_helper'
2
+
3
+ describe Mongoid::Preferences::Preferenceable do
4
+
5
+ let(:file_default_preferences_hash) {
6
+ HashWithIndifferentAccess.new( YAML.load_file(File.join(File.dirname(__FILE__),
7
+ 'models_preferences',
8
+ 'dummy',
9
+ 'default_preferences.yml')))
10
+ }
11
+
12
+ let(:view_preferences_hash) { file_default_preferences_hash[:view][:preferences] }
13
+
14
+ let(:default_preferences_hash) {
15
+ # remove the type key form preferences
16
+ preferences_hash = HashWithIndifferentAccess.new()
17
+ file_default_preferences_hash[:view][:preferences].each { |p|
18
+ preferences_hash[p[:name]] = p[:value]
19
+ }
20
+ preferences_hash
21
+ }
22
+
23
+ let(:custom_preferences_hash) { HashWithIndifferentAccess.new ({'pref1' => false, 'pref2' => false, 'pref3' => false})}
24
+
25
+ let(:merged_preferences_hash) {
26
+ # returns an hash of preferences (merge between custom and default) with format {key => value, ecc..}
27
+ default_preferences_hash.merge(custom_preferences_hash)
28
+ }
29
+
30
+ # Instance that has saved preferences
31
+ let(:model_with_preferences) {
32
+ Dummy.new(:preferences => merged_preferences_hash)
33
+ }
34
+
35
+ # Instance with empty preferences hash
36
+ let(:model_with_empty_preferences) { Dummy.new }
37
+
38
+ before :each do
39
+ # Clear cached preferences
40
+ Dummy.remove_class_variable(:@@default_preferences) if Dummy.class_variable_defined? :@@default_preferences
41
+ end
42
+
43
+ describe '#default_preferences' do
44
+
45
+ context 'when default preferences file found' do
46
+ before { set_right_preferences_path }
47
+ it 'returns a hash with the default preferences' do
48
+ # Use send method for testing private method
49
+ expect(model_with_empty_preferences.send(:default_preferences)).to eq(file_default_preferences_hash)
50
+ end
51
+ end
52
+
53
+ context 'when default preferences file not found' do
54
+ before { set_wrong_preferences_path }
55
+ it 'returns an empty hash' do
56
+ # Use send method for testing private method
57
+ expect(model_with_empty_preferences.send(:default_preferences)).to be_empty
58
+ end
59
+ end
60
+
61
+ end
62
+
63
+ describe '#write_pref' do
64
+
65
+
66
+ it 'returns the value of preference' do
67
+ expect(model_with_preferences.write_pref(:custom_pref, false)).to be_false
68
+ end
69
+
70
+ context 'when default preferences file found' do
71
+
72
+ before { set_right_preferences_path }
73
+
74
+ context 'when add a new custom preference' do
75
+ it 'has a hash of preferences which include the new preference' do
76
+ new_pref_key = 'custom_pref'
77
+ new_pref_value = false
78
+ model_with_preferences.write_pref(new_pref_key, new_pref_value)
79
+ model_with_preferences.save
80
+ expect(model_with_preferences.preferences).to include(new_pref_key)
81
+ end
82
+ end
83
+
84
+ context 'when change the value of a default preference' do
85
+ it 'has a hash of preferences with default preference changed in value' do
86
+ default_pref_key = 'show_tabs_control'
87
+ # Change the default value from true to false
88
+ new_default_pref_value = false
89
+ model_with_preferences.write_pref(default_pref_key, new_default_pref_value)
90
+ model_with_preferences.save
91
+ expect(model_with_preferences.preferences[default_pref_key]).to eq(new_default_pref_value)
92
+ end
93
+ end
94
+ context 'when add a new preference for another instance' do
95
+ before {
96
+ @new_pref_key = 'new_pref'
97
+ @new_pref_value = true
98
+ @new_instance = Dummy.new
99
+ @new_instance.write_pref(@new_pref_key, @new_pref_value)
100
+ @new_instance.save
101
+ }
102
+ it 'new instance include the new preference' do
103
+ expect(@new_instance.preferences).to include(@new_pref_key)
104
+ end
105
+ it 'existing instance does not include the new preference' do
106
+ expect(model_with_preferences.preferences).to_not include(@new_pref_key)
107
+ end
108
+ end
109
+ context 'when change the value of a default preference for another instance' do
110
+ before {
111
+ @default_pref_key = 'show_tabs_control'
112
+ # Change the default value from true to false
113
+ @new_default_pref_value = false
114
+ @new_instance = Dummy.new
115
+ @new_instance.write_pref(@default_pref_key, @new_default_pref_value)
116
+ @new_instance.save
117
+ }
118
+ it 'new instance has a default preference changed in value' do
119
+ expect(@new_instance.preferences[@default_pref_key]).to eq(@new_default_pref_value)
120
+ end
121
+ it 'existing instance has a default preference not changed in value' do
122
+ expect(model_with_preferences.preferences[@default_pref_key]).to_not eq(@new_default_pref_value)
123
+ end
124
+
125
+ end
126
+
127
+ end
128
+
129
+ context 'when default preferences file not found' do
130
+
131
+ before { set_wrong_preferences_path }
132
+
133
+ context 'when add a new custom preference' do
134
+ it 'has a hash of preferences which include the new preference' do
135
+ new_pref_key = 'custom_pref'
136
+ new_pref_value = false
137
+ model_with_empty_preferences.write_pref(new_pref_key, new_pref_value)
138
+ model_with_empty_preferences.save
139
+ expect(model_with_empty_preferences.preferences).to include(new_pref_key)
140
+ end
141
+ end
142
+
143
+ context 'when add a new preference for another instance' do
144
+ before {
145
+ @new_pref_key = 'new_pref'
146
+ @new_pref_value = true
147
+ @new_instance = Dummy.new
148
+ @new_instance.write_pref(@new_pref_key, @new_pref_value)
149
+ @new_instance.save
150
+ }
151
+ it 'new instance include the new preference' do
152
+ expect(@new_instance.preferences).to include(@new_pref_key)
153
+ end
154
+ it 'existing instance does not include the new preference' do
155
+ expect(model_with_empty_preferences.preferences).to_not include(@new_pref_key)
156
+ end
157
+ end
158
+
159
+ end
160
+
161
+ end
162
+
163
+
164
+ describe '#preferences' do
165
+
166
+ context 'when default preferences file not found' do
167
+
168
+ before { set_wrong_preferences_path }
169
+
170
+ context 'when model has empty preferences' do
171
+ it 'returns an empty hash' do
172
+ expect(model_with_empty_preferences.preferences).to be_empty
173
+ end
174
+ end
175
+
176
+ context 'when model has preferences' do
177
+ it 'returns a hash with merged preferences' do
178
+ expect(model_with_preferences.preferences).to eq(merged_preferences_hash)
179
+ end
180
+ end
181
+
182
+ end
183
+
184
+ context 'when default preferences file found' do
185
+
186
+ before { set_right_preferences_path }
187
+
188
+ context 'when model has empty preferences' do
189
+ it 'returns a hash with default preferences' do
190
+ expect(model_with_empty_preferences.preferences).to eq(default_preferences_hash)
191
+ end
192
+ end
193
+
194
+ context 'when model has preferences' do
195
+ it 'returns a hash with merged preferences' do
196
+ expect(model_with_preferences.preferences).to eq(merged_preferences_hash)
197
+ end
198
+ end
199
+
200
+ end
201
+ end
202
+
203
+ describe '#pref' do
204
+
205
+ context 'when preference exist' do
206
+ it 'returns the preference value' do
207
+ expect(model_with_preferences.pref(:show_tabs_control)).to eq(true)
208
+ end
209
+ end
210
+
211
+ context 'when preference not exist' do
212
+ it 'returns nil' do
213
+ expect(model_with_preferences.pref(:wrong_pref)).to be_nil
214
+ end
215
+ end
216
+
217
+ end
218
+
219
+ describe '#displayable_preferences' do
220
+
221
+ context 'when default preferences file found' do
222
+
223
+ before { set_right_preferences_path }
224
+
225
+ context 'when preferences group exist' do
226
+ it 'returns a hash of preferences for the group' do
227
+ expect(model_with_empty_preferences.displayable_preferences(:view)).to eq(view_preferences_hash)
228
+ end
229
+
230
+ context 'when change the value of preference' do
231
+
232
+ before {
233
+ @default_pref_key = 'show_wall_page'
234
+ @new_pref_value = false
235
+ # change the value from true to false
236
+ model_with_empty_preferences.write_pref(:show_wall_page, false)
237
+ model_with_empty_preferences.save
238
+ }
239
+
240
+ it 'returns a hash which include the preference changed in value' do
241
+ #expect(model_with_empty_preferences.displayable_preferences(:view_preferences)[@default_pref_key]).
242
+
243
+ end
244
+
245
+ end
246
+ end
247
+
248
+ context 'when preferences group not exist' do
249
+ it 'returns nil' do
250
+ expect(model_with_empty_preferences.displayable_preferences(:wrong_group)).to be_nil
251
+ end
252
+ end
253
+
254
+ end
255
+
256
+ context 'when default preferences file not found' do
257
+
258
+ before { set_wrong_preferences_path }
259
+
260
+ context 'when preferences group exist' do
261
+ it 'returns nil' do
262
+ expect(model_with_empty_preferences.displayable_preferences(:view)).to be_nil
263
+ end
264
+ end
265
+
266
+ context 'when preferences group not exist' do
267
+ it 'returns nil' do
268
+ expect(model_with_empty_preferences.displayable_preferences(:wrong_group)).to be_nil
269
+ end
270
+ end
271
+
272
+ end
273
+
274
+ end
275
+
276
+ describe '#has_pref?' do
277
+
278
+ context 'when preference exist' do
279
+ before { set_right_preferences_path }
280
+ it 'returns true' do
281
+ expect(model_with_empty_preferences.has_pref? :show_wall_page).to be_true
282
+ end
283
+ end
284
+
285
+ context 'when preference not exist' do
286
+ before { set_right_preferences_path }
287
+ it 'returns false' do
288
+ expect(model_with_empty_preferences.has_pref? :wrong_pref).to be_false
289
+ end
290
+ end
291
+ end
292
+
293
+ end
@@ -0,0 +1,58 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
3
+ MODELS = File.join(File.dirname(__FILE__), "models")
4
+
5
+ require 'coveralls'
6
+ Coveralls.wear!
7
+
8
+ require 'rubygems'
9
+ require 'bundler/setup'
10
+
11
+ require 'rspec'
12
+ require 'mongoid'
13
+ require 'mongoid-preferences'
14
+ require 'database_cleaner'
15
+ require 'mongoid-rspec'
16
+ require 'pathname'
17
+
18
+ Dir["#{MODELS}/*.rb"].each { |f| require f }
19
+
20
+ Mongoid.configure do |config|
21
+ config.connect_to "mongoid_preferences"
22
+ end
23
+
24
+ Mongoid.logger = Logger.new($stdout)
25
+
26
+ DatabaseCleaner.orm = "mongoid"
27
+
28
+ RSpec.configure do |config|
29
+ config.include Mongoid::Matchers
30
+
31
+ config.before(:all) do
32
+ DatabaseCleaner.strategy = :truncation
33
+ end
34
+
35
+ config.before(:each) do
36
+ DatabaseCleaner.start
37
+ end
38
+
39
+ config.after(:each) do
40
+ DatabaseCleaner.clean
41
+ end
42
+ end
43
+
44
+ #Helper method for setting the RIGHT path for the preferences file
45
+ def set_right_preferences_path
46
+ Mongoid::Preferences.configure do |config|
47
+ # model preferences path to dummy model
48
+ config.model_preferences_path = File.join(File.dirname(__FILE__), "models_preferences")
49
+ end
50
+ end
51
+
52
+ #Helper method for setting the WRONG path for the preferences file
53
+ def set_wrong_preferences_path
54
+ Mongoid::Preferences.configure do |config|
55
+ # model preferences path to dummy model
56
+ config.model_preferences_path = 'wrong/path/to/preferences/file'
57
+ end
58
+ end
metadata ADDED
@@ -0,0 +1,195 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mongoid-preferences
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Mattia Toso
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-06-06 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: mongoid
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '3'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '10.0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '10.0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '2.12'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '2.12'
62
+ - !ruby/object:Gem::Dependency
63
+ name: yard
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '0.8'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '0.8'
78
+ - !ruby/object:Gem::Dependency
79
+ name: mongoid-rspec
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: '1.5'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: '1.5'
94
+ - !ruby/object:Gem::Dependency
95
+ name: database_cleaner
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: '1.0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '1.0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: redcarpet
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: '2.2'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: '2.2'
126
+ - !ruby/object:Gem::Dependency
127
+ name: json
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ~>
132
+ - !ruby/object:Gem::Version
133
+ version: 1.7.7
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ version: 1.7.7
142
+ description: Preferences with Mongoid
143
+ email:
144
+ - mattia@kunerango.com
145
+ executables: []
146
+ extensions: []
147
+ extra_rdoc_files: []
148
+ files:
149
+ - .gitignore
150
+ - .rspec
151
+ - .travis.yml
152
+ - CHANGELOG.rdoc
153
+ - Gemfile
154
+ - LICENSE
155
+ - README.md
156
+ - Rakefile
157
+ - lib/mongoid-preferences.rb
158
+ - lib/mongoid/preferences.rb
159
+ - lib/mongoid/preferences/preferenceable.rb
160
+ - lib/mongoid/preferences/version.rb
161
+ - mongoid-preferences.gemspec
162
+ - spec/models/dummy.rb
163
+ - spec/models_preferences/dummy/default_preferences.yml
164
+ - spec/mongoid-preferences_spec.rb
165
+ - spec/spec_helper.rb
166
+ homepage: https://github.com/matito/mongoid-preferences.git
167
+ licenses: []
168
+ post_install_message:
169
+ rdoc_options: []
170
+ require_paths:
171
+ - lib
172
+ required_ruby_version: !ruby/object:Gem::Requirement
173
+ none: false
174
+ requirements:
175
+ - - ! '>='
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
178
+ required_rubygems_version: !ruby/object:Gem::Requirement
179
+ none: false
180
+ requirements:
181
+ - - ! '>='
182
+ - !ruby/object:Gem::Version
183
+ version: '0'
184
+ requirements: []
185
+ rubyforge_project:
186
+ rubygems_version: 1.8.24
187
+ signing_key:
188
+ specification_version: 3
189
+ summary: Add preferences hash to Mongoid model
190
+ test_files:
191
+ - spec/models/dummy.rb
192
+ - spec/models_preferences/dummy/default_preferences.yml
193
+ - spec/mongoid-preferences_spec.rb
194
+ - spec/spec_helper.rb
195
+ has_rdoc: