groupify 0.5.0 → 0.5.1

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: 14495b01edcc63635a6d0b077f5fb0227d7d6022
4
- data.tar.gz: 4adb33988bdc07fbe2d4a64d4d59c806b51274a9
3
+ metadata.gz: e6c1b6a28b9ffcb7a8fd8cdd22c7882e68b7fc33
4
+ data.tar.gz: 1b828c4275ba593ff14e4813117047faf668082b
5
5
  SHA512:
6
- metadata.gz: df8017bb4f1e2b123b1bcad6c209f744c03b06161d70fa1a7153f89d34f36bdc4ec79a4cfbda27b665263aecf03bad850fc0ada10fb67570b8b73bda03aedb2b
7
- data.tar.gz: 010dd7484806af265d6e869dd98de25ff07e51c527dc80231ebde7928913ee73c77df5b7607c580a5fa6fb3afe7311f224f28145ab9eb2eef8def37d175099a7
6
+ metadata.gz: abffefbf67162095c5943df53b394b1adb4bcf846e78909b37fec2e3b26db2d21e7c0bab6ae1f5888a6d280e1061590fb5968556d5d1b05255fce7bd37531226
7
+ data.tar.gz: c9db57ffa507fb16e2606fa2fd1bdb245d120e18cf66148d37a014a88b578b36ee4e1d679e35e21d9da6015c633c7e50cc778b346f4e1fd086e67e40d97eb1ea
@@ -4,44 +4,46 @@ require 'set'
4
4
  # Groups and members
5
5
  module Groupify
6
6
  module ActiveRecord
7
- extend ActiveSupport::Concern
8
-
9
- included do
10
- # Define a scope that returns nothing.
11
- # This is built into ActiveRecord 4, but not 3
12
- unless self.class.respond_to? :none
13
- def self.none
14
- where(arel_table[:id].eq(nil).and(arel_table[:id].not_eq(nil)))
7
+ module Adapter
8
+ extend ActiveSupport::Concern
9
+
10
+ included do
11
+ # Define a scope that returns nothing.
12
+ # This is built into ActiveRecord 4, but not 3
13
+ unless self.class.respond_to? :none
14
+ def self.none
15
+ where(arel_table[:id].eq(nil).and(arel_table[:id].not_eq(nil)))
16
+ end
15
17
  end
16
18
  end
17
- end
18
-
19
- module ClassMethods
20
- def acts_as_group(opts = {})
21
- include Groupify::ActiveRecord::Group
19
+
20
+ module ClassMethods
21
+ def acts_as_group(opts = {})
22
+ include Groupify::ActiveRecord::Group
22
23
 
23
- if (member_klass = opts.delete :default_members)
24
- self.default_member_class = member_klass.to_s.classify.constantize
24
+ if (member_klass = opts.delete :default_members)
25
+ self.default_member_class = member_klass.to_s.classify.constantize
26
+ end
27
+
28
+ if (member_klasses = opts.delete :members)
29
+ member_klasses.each do |member_klass|
30
+ has_members(member_klass)
31
+ end
32
+ end
25
33
  end
26
34
 
27
- if (member_klasses = opts.delete :members)
28
- member_klasses.each do |member_klass|
29
- has_members(member_klass)
30
- end
35
+ def acts_as_group_member(opts = {})
36
+ @group_class_name = opts[:class_name] || 'Group'
37
+ include Groupify::ActiveRecord::GroupMember
38
+ end
39
+
40
+ def acts_as_named_group_member(opts = {})
41
+ include Groupify::ActiveRecord::NamedGroupMember
31
42
  end
32
- end
33
-
34
- def acts_as_group_member(opts = {})
35
- @group_class_name = opts[:class_name] || 'Group'
36
- include Groupify::ActiveRecord::GroupMember
37
- end
38
-
39
- def acts_as_named_group_member(opts = {})
40
- include Groupify::ActiveRecord::NamedGroupMember
41
- end
42
43
 
43
- def acts_as_group_membership(opts = {})
44
- include Groupify::ActiveRecord::GroupMembership
44
+ def acts_as_group_membership(opts = {})
45
+ include Groupify::ActiveRecord::GroupMembership
46
+ end
45
47
  end
46
48
  end
47
49
 
@@ -325,4 +327,4 @@ module Groupify
325
327
  end
326
328
  end
327
329
 
328
- ActiveRecord::Base.send :include, Groupify::ActiveRecord
330
+ ActiveRecord::Base.send :include, Groupify::ActiveRecord::Adapter
@@ -4,35 +4,37 @@ require 'set'
4
4
  # Groups and members
5
5
  module Groupify
6
6
  module Mongoid
7
- extend ActiveSupport::Concern
8
-
9
- included do
10
- def none; where(:id => nil); end
11
- end
12
-
13
- module ClassMethods
14
- def acts_as_group(opts = {})
15
- include Groupify::Mongoid::Group
7
+ module Adapter
8
+ extend ActiveSupport::Concern
9
+
10
+ included do
11
+ def none; where(:id => nil); end
12
+ end
13
+
14
+ module ClassMethods
15
+ def acts_as_group(opts = {})
16
+ include Groupify::Mongoid::Group
17
+
18
+ if (member_klass = opts.delete :default_members)
19
+ self.default_member_class = member_klass.to_s.classify.constantize
20
+ end
21
+
22
+ if (member_klasses = opts.delete :members)
23
+ member_klasses.each do |member_klass|
24
+ has_members(member_klass)
25
+ end
26
+ end
27
+ end
16
28
 
17
- if (member_klass = opts.delete :default_members)
18
- self.default_member_class = member_klass.to_s.classify.constantize
29
+ def acts_as_group_member(opts = {})
30
+ @group_class_name = opts[:class_name] || 'Group'
31
+ include Groupify::Mongoid::GroupMember
19
32
  end
20
33
 
21
- if (member_klasses = opts.delete :members)
22
- member_klasses.each do |member_klass|
23
- has_members(member_klass)
24
- end
34
+ def acts_as_named_group_member(opts = {})
35
+ include Groupify::Mongoid::NamedGroupMember
25
36
  end
26
37
  end
27
-
28
- def acts_as_group_member(opts = {})
29
- @group_class_name = opts[:class_name] || 'Group'
30
- include Groupify::Mongoid::GroupMember
31
- end
32
-
33
- def acts_as_named_group_member(opts = {})
34
- include Groupify::Mongoid::NamedGroupMember
35
- end
36
38
  end
37
39
 
38
40
  # Usage:
@@ -249,4 +251,4 @@ module Groupify
249
251
  end
250
252
  end
251
253
 
252
- Mongoid::Document.send :include, Groupify::Mongoid
254
+ Mongoid::Document.send :include, Groupify::Mongoid::Adapter
@@ -1,3 +1,3 @@
1
1
  module Groupify
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: groupify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - dwbutler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-24 00:00:00.000000000 Z
11
+ date: 2014-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
153
  version: '0'
154
154
  requirements: []
155
155
  rubyforge_project:
156
- rubygems_version: 2.2.1
156
+ rubygems_version: 2.2.0.rc.1
157
157
  signing_key:
158
158
  specification_version: 4
159
159
  summary: Group functionality for Rails