mongo_mapper-strict_keys 0.0.3 → 0.0.4

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.
data/README.md CHANGED
@@ -2,10 +2,19 @@
2
2
 
3
3
  ## Usage:
4
4
 
5
- In your Gemfile:
5
+ ### In your Gemfile:
6
6
 
7
- gem 'mongo_mapper-strict_keys', '~>0.0.2'
7
+ gem 'mongo_mapper-strict_keys', '~>0.0.4'
8
8
 
9
9
  To force strict keys for all models, from the outset:
10
10
 
11
- gem 'mongo_mapper-strict_keys', '~>0.0.2', :require => 'mongo_mapper/strict_keys/force_plugin'
11
+ gem 'mongo_mapper-strict_keys', '~>0.0.4', :require => 'mongo_mapper/strict_keys/force_plugin'
12
+
13
+ ### In your Source Code / Model:
14
+
15
+ require 'mongo_mapper/strict_keys'
16
+
17
+ class StrictModel
18
+ include MongoMapper::Document
19
+ include MongoMapper::Plugins::StrictKeys
20
+ end
@@ -0,0 +1,22 @@
1
+ require 'mongo_mapper/strict_keys'
2
+
3
+ module MongoMapper
4
+ module Plugins
5
+ module StrictKeys
6
+ module Bang
7
+ extend ActiveSupport::Concern
8
+
9
+ module ClassMethods
10
+ # Includes the MongoMapper::Plugins::StrictKeys MongoMapper Plugin
11
+ # @see MongoMapper::Plugins::StrictKeys
12
+ def strict_keys!
13
+ self.send(:include, ::MongoMapper::Plugins::StrictKeys)
14
+ end
15
+ end
16
+
17
+ module InstanceMethods; end
18
+
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,7 +1,7 @@
1
1
  module MongoMapper
2
2
  module Plugins
3
3
  module StrictKeys
4
- VERSION = '0.0.3'
4
+ VERSION = '0.0.4'
5
5
  end
6
6
  end
7
7
  end
@@ -1,6 +1,7 @@
1
1
  require 'mongo_mapper'
2
2
  require 'mongo_mapper/plugins'
3
3
  require 'mongo_mapper/strict_keys/version'
4
+ require 'mongo_mapper/strict_keys/bang'
4
5
 
5
6
  module MongoMapper
6
7
  module Plugins
@@ -20,3 +21,6 @@ module MongoMapper
20
21
  end
21
22
  end
22
23
  end
24
+
25
+ MongoMapper::Document.plugin(MongoMapper::Plugins::StrictKeys::Bang)
26
+ MongoMapper::EmbeddedDocument.plugin(MongoMapper::Plugins::StrictKeys::Bang)
@@ -0,0 +1,14 @@
1
+ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
2
+
3
+ describe MongoMapper::Plugins::StrictKeys::Bang do
4
+ class ForcedBySugar
5
+ include MongoMapper::Document
6
+ strict_keys!
7
+ end
8
+
9
+ context 'MongoMapper::Plugins::StrictKeys Mixin' do
10
+ it 'should be present in the ancestors' do
11
+ ForcedBySugar.ancestors.should include(MongoMapper::Plugins::StrictKeys::InstanceMethods)
12
+ end
13
+ end
14
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: mongo_mapper-strict_keys
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.3
5
+ version: 0.0.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Scott Gonyea
@@ -84,9 +84,11 @@ files:
84
84
  - Rakefile
85
85
  - lib/mongo_mapper-strict_keys.rb
86
86
  - lib/mongo_mapper/strict_keys.rb
87
+ - lib/mongo_mapper/strict_keys/bang.rb
87
88
  - lib/mongo_mapper/strict_keys/force_plugin.rb
88
89
  - lib/mongo_mapper/strict_keys/version.rb
89
90
  - mongo_mapper-strict_keys.gemspec
91
+ - spec/mongo_mapper/strict_keys/bang_spec.rb
90
92
  - spec/mongo_mapper/strict_keys/force_plugin_spec.rb
91
93
  - spec/mongo_mapper/strict_keys_spec.rb
92
94
  - spec/spec_helper.rb
@@ -118,6 +120,7 @@ signing_key:
118
120
  specification_version: 3
119
121
  summary: Mongo Mapper Strict Keys Plugin
120
122
  test_files:
123
+ - spec/mongo_mapper/strict_keys/bang_spec.rb
121
124
  - spec/mongo_mapper/strict_keys/force_plugin_spec.rb
122
125
  - spec/mongo_mapper/strict_keys_spec.rb
123
126
  - spec/spec_helper.rb