periscope-mongo_mapper 1.0.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/{LICENSE → LICENSE.md} +0 -0
- data/README.md +17 -12
- data/lib/periscope-mongo_mapper.rb +1 -1
- data/lib/periscope/adapters/mongo_mapper.rb +2 -2
- data/periscope-mongo_mapper.gemspec +10 -15
- metadata +11 -93
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZWI2MTc3NDFlOTFhMDJiZDA5ZmQ5N2EwYWY4MWJmNjYyZGU4ZWRlNA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MjFkYmMzNTQyY2FlNTM0Mjg3M2E3MDY2OGE1ZTM3NDBmMTA3MGYwOA==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NGI4MmRmNmQxZTg5MjIyZDQ1ZTMwNmY2MDFlZTFmYThmMWU0MDk3MjFiZmZh
|
10
|
+
ODA4NDMyNWU2MmI3NzIxM2VkMDc3N2NhMDAwODMzYmZiY2JlM2EyYjcxZTc2
|
11
|
+
YTNiZmJhOWE1N2YyMDI2MjY1ZGZlNDY5OGNiM2U2NGQyZDBiZmI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZjBhZGMwODIyMWQwM2I4MjJkOWI5Y2JlN2Q4MWI1NjkxMzE1YWM0Y2RhY2E3
|
14
|
+
OTU0YzExYzZkOTdjMmFmZGU4ZWY4NzBiYzQ1OWY2YTExNzhlNDU0NTRkYmQz
|
15
|
+
ZDljMGQ5Y2UxMDJlM2JmODgyMTY5YzRkMjAxYTg1NjgyOWE4MjI=
|
data/{LICENSE → LICENSE.md}
RENAMED
File without changes
|
data/README.md
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
-
# Periscope
|
1
|
+
# Periscope
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/periscope.png)](http://badge.fury.io/rb/periscope)
|
3
|
+
[![Build Status](https://travis-ci.org/laserlemon/periscope.png?branch=master)](https://travis-ci.org/laserlemon/periscope)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/laserlemon/periscope.png)](https://codeclimate.com/github/laserlemon/periscope)
|
5
|
+
[![Coverage Status](https://coveralls.io/repos/laserlemon/periscope/badge.png?branch=master)](https://coveralls.io/r/laserlemon/periscope)
|
6
|
+
[![Dependency Status](https://gemnasium.com/laserlemon/periscope.png)](https://gemnasium.com/laserlemon/periscope)
|
2
7
|
|
3
8
|
Periscope provides a simple way to chain scopes on your models and to open those scopes up to your users.
|
4
9
|
|
@@ -51,8 +56,8 @@ Within your model you can use the `scope_accessible` method to specify which sco
|
|
51
56
|
|
52
57
|
```ruby
|
53
58
|
class User < ActiveRecord::Base
|
54
|
-
scope :gender,
|
55
|
-
scope :makes,
|
59
|
+
scope :gender, proc { |g| where(gender: g) }
|
60
|
+
scope :makes, proc { |s| where("salary >= ?", s) }
|
56
61
|
|
57
62
|
scope_accessible :gender
|
58
63
|
end
|
@@ -82,9 +87,9 @@ Parsers must respond to the `call` method, receiving the raw query parameter and
|
|
82
87
|
|
83
88
|
```ruby
|
84
89
|
class User < ActiveRecord::Base
|
85
|
-
scope :gender,
|
90
|
+
scope :gender, proc { |g| where(gender: g) }
|
86
91
|
|
87
|
-
scope_accessible :gender, parser:
|
92
|
+
scope_accessible :gender, parser: proc { |g| [g.downcase] }
|
88
93
|
end
|
89
94
|
```
|
90
95
|
|
@@ -94,8 +99,8 @@ But not all scopes accept arguments. For scopes that you want to toggle on or of
|
|
94
99
|
|
95
100
|
```ruby
|
96
101
|
class User < ActiveRecord::Base
|
97
|
-
scope :male, where(gender:
|
98
|
-
scope :female, where(gender:
|
102
|
+
scope :male, proc { where(gender: "male") }
|
103
|
+
scope :female, proc { where(gender: "female") }
|
99
104
|
|
100
105
|
scope_accessible :male, :female, boolean: true
|
101
106
|
end
|
@@ -111,11 +116,11 @@ class Project < ActiveRecord::Base
|
|
111
116
|
scope_accessible :end, method: :ends_before
|
112
117
|
|
113
118
|
def self.begins_after(date)
|
114
|
-
where(
|
119
|
+
where("begins_at >= ?", date)
|
115
120
|
end
|
116
121
|
|
117
122
|
def self.ends_before(date)
|
118
|
-
where(
|
123
|
+
where("ends_at <= ?", date)
|
119
124
|
end
|
120
125
|
end
|
121
126
|
```
|
@@ -124,14 +129,14 @@ Alternatively, you can set `:prefix` and/or `:suffix` options, which will be app
|
|
124
129
|
|
125
130
|
```ruby
|
126
131
|
class Project < ActiveRecord::Base
|
127
|
-
scope_accessible :begin, :end, suffix:
|
132
|
+
scope_accessible :begin, :end, suffix: "_date"
|
128
133
|
|
129
134
|
def self.begin_date(date)
|
130
|
-
where(
|
135
|
+
where("begins_at >= ?", date)
|
131
136
|
end
|
132
137
|
|
133
138
|
def self.end_date(date)
|
134
|
-
where(
|
139
|
+
where("ends_at <= ?", date)
|
135
140
|
end
|
136
141
|
end
|
137
142
|
```
|
@@ -1 +1 @@
|
|
1
|
-
require
|
1
|
+
require "periscope/adapters/mongo_mapper"
|
@@ -1,27 +1,22 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
|
-
gem.name =
|
5
|
-
gem.version =
|
4
|
+
gem.name = "periscope-mongo_mapper"
|
5
|
+
gem.version = "2.0.0"
|
6
6
|
|
7
|
-
gem.
|
8
|
-
gem.email
|
9
|
-
gem.
|
10
|
-
gem.
|
11
|
-
gem.
|
7
|
+
gem.author = "Steve Richert"
|
8
|
+
gem.email = "steve.richert@gmail.com"
|
9
|
+
gem.summary = "Push your MongoMapper models' scopes up to the surface"
|
10
|
+
gem.homepage = "https://github.com/laserlemon/periscope"
|
11
|
+
gem.license = "MIT"
|
12
12
|
|
13
|
-
gem.add_dependency
|
14
|
-
gem.add_dependency
|
15
|
-
|
16
|
-
gem.add_development_dependency 'bson_ext', '~> 1.4'
|
17
|
-
gem.add_development_dependency 'database_cleaner', '~> 0.8'
|
18
|
-
gem.add_development_dependency 'factory_girl', '>= 2', '< 5'
|
19
|
-
gem.add_development_dependency 'rspec', '~> 2.0'
|
13
|
+
gem.add_dependency "mongo_mapper", "~> 0.9"
|
14
|
+
gem.add_dependency "periscope", "~> 2.0"
|
20
15
|
|
21
16
|
gem.files = %w(
|
22
|
-
LICENSE
|
23
17
|
lib/periscope-mongo_mapper.rb
|
24
18
|
lib/periscope/adapters/mongo_mapper.rb
|
19
|
+
LICENSE.md
|
25
20
|
periscope-mongo_mapper.gemspec
|
26
21
|
README.md
|
27
22
|
)
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: periscope-mongo_mapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 2.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Steve Richert
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-03-06 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: mongo_mapper
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,129 +27,50 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: periscope
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ~>
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '1.0'
|
38
|
-
type: :runtime
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '1.0'
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: bson_ext
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ~>
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '1.4'
|
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: '1.4'
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: database_cleaner
|
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: factory_girl
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ! '>='
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: '2'
|
86
|
-
- - <
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: '5'
|
89
|
-
type: :development
|
90
|
-
prerelease: false
|
91
|
-
version_requirements: !ruby/object:Gem::Requirement
|
92
|
-
none: false
|
93
|
-
requirements:
|
94
|
-
- - ! '>='
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '2'
|
97
|
-
- - <
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
version: '5'
|
100
|
-
- !ruby/object:Gem::Dependency
|
101
|
-
name: rspec
|
102
|
-
requirement: !ruby/object:Gem::Requirement
|
103
|
-
none: false
|
104
30
|
requirements:
|
105
31
|
- - ~>
|
106
32
|
- !ruby/object:Gem::Version
|
107
33
|
version: '2.0'
|
108
|
-
type: :
|
34
|
+
type: :runtime
|
109
35
|
prerelease: false
|
110
36
|
version_requirements: !ruby/object:Gem::Requirement
|
111
|
-
none: false
|
112
37
|
requirements:
|
113
38
|
- - ~>
|
114
39
|
- !ruby/object:Gem::Version
|
115
40
|
version: '2.0'
|
116
|
-
description:
|
117
|
-
email:
|
118
|
-
- steve.richert@gmail.com
|
41
|
+
description:
|
42
|
+
email: steve.richert@gmail.com
|
119
43
|
executables: []
|
120
44
|
extensions: []
|
121
45
|
extra_rdoc_files: []
|
122
46
|
files:
|
123
|
-
- LICENSE
|
124
47
|
- lib/periscope-mongo_mapper.rb
|
125
48
|
- lib/periscope/adapters/mongo_mapper.rb
|
49
|
+
- LICENSE.md
|
126
50
|
- periscope-mongo_mapper.gemspec
|
127
51
|
- README.md
|
128
52
|
homepage: https://github.com/laserlemon/periscope
|
129
|
-
licenses:
|
53
|
+
licenses:
|
54
|
+
- MIT
|
55
|
+
metadata: {}
|
130
56
|
post_install_message:
|
131
57
|
rdoc_options: []
|
132
58
|
require_paths:
|
133
59
|
- lib
|
134
60
|
required_ruby_version: !ruby/object:Gem::Requirement
|
135
|
-
none: false
|
136
61
|
requirements:
|
137
62
|
- - ! '>='
|
138
63
|
- !ruby/object:Gem::Version
|
139
64
|
version: '0'
|
140
|
-
segments:
|
141
|
-
- 0
|
142
|
-
hash: -2146125029444385012
|
143
65
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
|
-
none: false
|
145
66
|
requirements:
|
146
67
|
- - ! '>='
|
147
68
|
- !ruby/object:Gem::Version
|
148
69
|
version: '0'
|
149
|
-
segments:
|
150
|
-
- 0
|
151
|
-
hash: -2146125029444385012
|
152
70
|
requirements: []
|
153
71
|
rubyforge_project:
|
154
|
-
rubygems_version:
|
72
|
+
rubygems_version: 2.0.0
|
155
73
|
signing_key:
|
156
|
-
specification_version:
|
74
|
+
specification_version: 4
|
157
75
|
summary: Push your MongoMapper models' scopes up to the surface
|
158
76
|
test_files: []
|