groupify 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -85,7 +85,7 @@ module Groupify
85
85
  when self.metadata.klass
86
86
  super
87
87
  else
88
- (self.base.named_groups ||= []) << group.to_s
88
+ (self.base.named_groups ||= []) << group
89
89
  self.base.save if self.metadata.autosave
90
90
  end
91
91
  end
@@ -97,7 +97,7 @@ module Groupify
97
97
  when groups.metadata.klass
98
98
  self.groups.include?(group)
99
99
  else
100
- self.named_groups ? self.named_groups.include?(group.to_s) : false
100
+ self.named_groups ? self.named_groups.include?(group) : false
101
101
  end
102
102
  end
103
103
 
@@ -136,7 +136,7 @@ module Groupify
136
136
  end
137
137
 
138
138
  def in_named_group(named_group)
139
- named_group.present? ? where(:named_groups.in => [named_group.to_s]) : none
139
+ named_group.present? ? where(:named_groups.in => [named_group]) : none
140
140
  end
141
141
 
142
142
  def in_any_group(*groups)
@@ -144,7 +144,7 @@ module Groupify
144
144
  end
145
145
 
146
146
  def in_any_named_group(*named_groups)
147
- named_groups.present? ? where(:named_groups.in => named_groups.flatten.map{|g|g.to_s}) : none
147
+ named_groups.present? ? where(:named_groups.in => named_groups.flatten) : none
148
148
  end
149
149
 
150
150
  def in_all_groups(*groups)
@@ -152,7 +152,7 @@ module Groupify
152
152
  end
153
153
 
154
154
  def in_all_named_groups(*named_groups)
155
- named_groups.present? ? where(:named_groups => named_groups.flatten.map{|g|g.to_s}) : none
155
+ named_groups.present? ? where(:named_groups => named_groups.flatten) : none
156
156
  end
157
157
 
158
158
  def shares_any_group(other)
@@ -1,3 +1,3 @@
1
1
  module Groupify
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -91,12 +91,12 @@ describe "MongoidUser" do
91
91
  it "can have named groups" do
92
92
  user.groups << :admin
93
93
  user.groups << :user
94
- user.named_groups.should include('admin')
94
+ user.named_groups.should include(:admin)
95
95
 
96
96
  user.in_group?(:admin).should be_true
97
97
  user.in_any_group?(:admin, :user, :test).should be_true
98
98
  user.in_all_groups?(:admin, :user).should be_true
99
- user.in_all_groups?(:admin, 'user', :test).should be_false
99
+ user.in_all_groups?(:admin, :user, :test).should be_false
100
100
 
101
101
  MongoidUser.in_group(:admin).first.should eql(user)
102
102
  MongoidUser.in_named_group(:admin).first.should eql(user)
metadata CHANGED
@@ -1,107 +1,103 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: groupify
3
- version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 2
9
- - 0
10
- version: 0.2.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - dwbutler
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-09-05 00:00:00 -07:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2012-09-05 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: rails
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
18
+ requirements:
27
19
  - - ~>
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 3
32
- - 2
33
- version: "3.2"
20
+ - !ruby/object:Gem::Version
21
+ version: '3.2'
34
22
  type: :development
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: rspec
38
23
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '3.2'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rspec
32
+ requirement: !ruby/object:Gem::Requirement
40
33
  none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- hash: 3
45
- segments:
46
- - 0
47
- version: "0"
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
48
38
  type: :development
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- name: mongoid
52
39
  prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
54
41
  none: false
55
- requirements:
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: mongoid
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
56
51
  - - ~>
57
- - !ruby/object:Gem::Version
58
- hash: 3
59
- segments:
60
- - 2
61
- - 0
62
- version: "2.0"
52
+ - !ruby/object:Gem::Version
53
+ version: '3.0'
63
54
  type: :development
64
- version_requirements: *id003
65
- - !ruby/object:Gem::Dependency
66
- name: mongoid-rspec
67
55
  prerelease: false
68
- requirement: &id004 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
69
57
  none: false
70
- requirements:
71
- - - "="
72
- - !ruby/object:Gem::Version
73
- hash: 13
74
- segments:
75
- - 1
76
- - 4
77
- - 5
78
- version: 1.4.5
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: mongoid-rspec
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 1.5.1
79
70
  type: :development
80
- version_requirements: *id004
81
- - !ruby/object:Gem::Dependency
82
- name: database_cleaner
83
71
  prerelease: false
84
- requirement: &id005 !ruby/object:Gem::Requirement
72
+ version_requirements: !ruby/object:Gem::Requirement
85
73
  none: false
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- hash: 3
90
- segments:
91
- - 0
92
- version: "0"
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.5.1
78
+ - !ruby/object:Gem::Dependency
79
+ name: database_cleaner
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
93
86
  type: :development
94
- version_requirements: *id005
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
95
94
  description: Adds group and membership functionality to Rails models
96
- email:
95
+ email:
97
96
  - dwbutler@ucla.edu
98
97
  executables: []
99
-
100
98
  extensions: []
101
-
102
99
  extra_rdoc_files: []
103
-
104
- files:
100
+ files:
105
101
  - .gitignore
106
102
  - .travis.yml
107
103
  - Gemfile
@@ -115,42 +111,33 @@ files:
115
111
  - spec/mongoid2.yml
116
112
  - spec/mongoid3.yml
117
113
  - spec/spec_helper.rb
118
- has_rdoc: true
119
114
  homepage: https://github.com/dwbutler/groupify
120
115
  licenses: []
121
-
122
116
  post_install_message:
123
117
  rdoc_options: []
124
-
125
- require_paths:
118
+ require_paths:
126
119
  - lib
127
- required_ruby_version: !ruby/object:Gem::Requirement
120
+ required_ruby_version: !ruby/object:Gem::Requirement
128
121
  none: false
129
- requirements:
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- hash: 3
133
- segments:
134
- - 0
135
- version: "0"
136
- required_rubygems_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
127
  none: false
138
- requirements:
139
- - - ">="
140
- - !ruby/object:Gem::Version
141
- hash: 3
142
- segments:
143
- - 0
144
- version: "0"
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
145
132
  requirements: []
146
-
147
133
  rubyforge_project:
148
- rubygems_version: 1.3.7
134
+ rubygems_version: 1.8.24
149
135
  signing_key:
150
136
  specification_version: 3
151
137
  summary: Group functionality for Rails
152
- test_files:
138
+ test_files:
153
139
  - spec/groupify/mongoid_spec.rb
154
140
  - spec/mongoid2.yml
155
141
  - spec/mongoid3.yml
156
142
  - spec/spec_helper.rb
143
+ has_rdoc: