mongoid_query_string_interface 0.4.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,52 +1,54 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mongoid_query_string_interface (0.4.2)
4
+ mongoid_query_string_interface (0.5.0)
5
5
  json (>= 1.4.6)
6
- mongoid (~> 2.0.0.rc)
6
+ mongoid (~> 2.0.2)
7
+ will_paginate (~> 3.0.pre2)
7
8
 
8
9
  GEM
9
10
  remote: http://rubygems.org/
10
11
  specs:
11
- activemodel (3.0.5)
12
- activesupport (= 3.0.5)
12
+ activemodel (3.0.9)
13
+ activesupport (= 3.0.9)
13
14
  builder (~> 2.1.2)
14
- i18n (~> 0.4)
15
- activesupport (3.0.5)
15
+ i18n (~> 0.5.0)
16
+ activesupport (3.0.9)
16
17
  archive-tar-minitar (0.5.2)
17
- bson (1.2.4)
18
- bson_ext (1.2.4)
18
+ bson (1.3.1)
19
+ bson_ext (1.3.1)
19
20
  builder (2.1.2)
20
- columnize (0.3.2)
21
- database_cleaner (0.6.6)
21
+ columnize (0.3.4)
22
+ database_cleaner (0.6.7)
22
23
  diff-lcs (1.1.2)
23
24
  i18n (0.5.0)
24
- json (1.5.1)
25
- linecache (0.43)
26
- linecache19 (0.5.11)
25
+ json (1.5.3)
26
+ linecache (0.46)
27
+ rbx-require-relative (> 0.0.4)
28
+ linecache19 (0.5.12)
27
29
  ruby_core_source (>= 0.1.4)
28
- mongo (1.2.4)
29
- bson (>= 1.2.4)
30
- mongoid (2.0.0.rc.8)
30
+ mongo (1.3.1)
31
+ bson (>= 1.3.1)
32
+ mongoid (2.0.2)
31
33
  activemodel (~> 3.0)
32
- mongo (~> 1.2)
34
+ mongo (~> 1.3)
33
35
  tzinfo (~> 0.3.22)
34
- will_paginate (~> 3.0.pre)
35
36
  rake (0.8.7)
36
- rspec (2.5.0)
37
- rspec-core (~> 2.5.0)
38
- rspec-expectations (~> 2.5.0)
39
- rspec-mocks (~> 2.5.0)
40
- rspec-core (2.5.1)
41
- rspec-expectations (2.5.0)
37
+ rbx-require-relative (0.0.5)
38
+ rspec (2.6.0)
39
+ rspec-core (~> 2.6.0)
40
+ rspec-expectations (~> 2.6.0)
41
+ rspec-mocks (~> 2.6.0)
42
+ rspec-core (2.6.4)
43
+ rspec-expectations (2.6.0)
42
44
  diff-lcs (~> 1.1.2)
43
- rspec-mocks (2.5.0)
45
+ rspec-mocks (2.6.0)
44
46
  ruby-debug (0.10.4)
45
47
  columnize (>= 0.1)
46
48
  ruby-debug-base (~> 0.10.4.0)
47
49
  ruby-debug-base (0.10.4)
48
50
  linecache (>= 0.3)
49
- ruby-debug-base19 (0.11.24)
51
+ ruby-debug-base19 (0.11.25)
50
52
  columnize (>= 0.3.1)
51
53
  linecache19 (>= 0.5.11)
52
54
  ruby_core_source (>= 0.1.4)
@@ -54,12 +56,12 @@ GEM
54
56
  columnize (>= 0.3.1)
55
57
  linecache19 (>= 0.5.11)
56
58
  ruby-debug-base19 (>= 0.11.19)
57
- ruby_core_source (0.1.4)
59
+ ruby_core_source (0.1.5)
58
60
  archive-tar-minitar (>= 0.5.2)
59
- simplecov (0.4.1)
60
- simplecov-html (~> 0.4.3)
61
- simplecov-html (0.4.3)
62
- tzinfo (0.3.25)
61
+ simplecov (0.4.2)
62
+ simplecov-html (~> 0.4.4)
63
+ simplecov-html (0.4.5)
64
+ tzinfo (0.3.29)
63
65
  will_paginate (3.0.pre2)
64
66
 
65
67
  PLATFORMS
@@ -69,8 +71,6 @@ DEPENDENCIES
69
71
  bson
70
72
  bson_ext
71
73
  database_cleaner (>= 0.5.0)
72
- json (>= 1.4.6)
73
- mongoid (~> 2.0.0.rc)
74
74
  mongoid_query_string_interface!
75
75
  rake (= 0.8.7)
76
76
  rspec (>= 2.3.0)
@@ -0,0 +1,13 @@
1
+ module Mongoid
2
+ module Paginate
3
+ def paginate(options={})
4
+ per_page = (options[:per_page] || 20).to_i
5
+ page = (options[:page] || 1).to_i
6
+ offset = (page - 1) * per_page
7
+
8
+ WillPaginate::Collection.create(page, per_page, count) do |pager|
9
+ pager.replace(skip(offset).limit(per_page).to_a)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,10 +1,12 @@
1
1
  require File.expand_path(File.join('helpers'), File.dirname(__FILE__))
2
+ require File.expand_path(File.join('paginate'), File.dirname(__FILE__))
2
3
  require File.expand_path(File.join('parsers', 'filter_parser'), File.dirname(__FILE__))
3
4
  require File.expand_path(File.join('parsers', 'filters_parser'), File.dirname(__FILE__))
4
5
 
5
6
  module Mongoid
6
7
  module QueryStringInterface
7
8
  include Mongoid::QueryStringInterface::Helpers
9
+ include Mongoid::Paginate unless instance_methods(:false).include?(:paginate)
8
10
 
9
11
  NORMAL_CONDITIONAL_OPERATORS = [:exists, :gte, :gt, :lte, :lt, :ne, :size, :near, :within]
10
12
  ARRAY_CONDITIONAL_OPERATORS = [:all, :in, :nin]
data/lib/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  module Mongoid #:nodoc
3
3
  module QueryStringInterface #:nodoc
4
- VERSION = "0.4.2"
4
+ VERSION = "0.5.0"
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_query_string_interface
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 4
8
- - 2
9
- version: 0.4.2
4
+ prerelease:
5
+ version: 0.5.0
10
6
  platform: ruby
11
7
  authors:
12
8
  - Vicente Mundim
@@ -14,8 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2011-06-17 00:00:00 -03:00
18
- default_executable:
13
+ date: 2011-07-21 00:00:00 Z
19
14
  dependencies:
20
15
  - !ruby/object:Gem::Dependency
21
16
  name: json
@@ -25,59 +20,53 @@ dependencies:
25
20
  requirements:
26
21
  - - ">="
27
22
  - !ruby/object:Gem::Version
28
- segments:
29
- - 1
30
- - 4
31
- - 6
32
23
  version: 1.4.6
33
24
  type: :runtime
34
25
  version_requirements: *id001
35
26
  - !ruby/object:Gem::Dependency
36
- name: mongoid
27
+ name: will_paginate
37
28
  prerelease: false
38
29
  requirement: &id002 !ruby/object:Gem::Requirement
39
30
  none: false
40
31
  requirements:
41
32
  - - ~>
42
33
  - !ruby/object:Gem::Version
43
- segments:
44
- - 2
45
- - 0
46
- - 0
47
- - rc
48
- version: 2.0.0.rc
34
+ version: 3.0.pre2
49
35
  type: :runtime
50
36
  version_requirements: *id002
51
37
  - !ruby/object:Gem::Dependency
52
- name: rspec
38
+ name: mongoid
53
39
  prerelease: false
54
40
  requirement: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 2.0.2
46
+ type: :runtime
47
+ version_requirements: *id003
48
+ - !ruby/object:Gem::Dependency
49
+ name: rspec
50
+ prerelease: false
51
+ requirement: &id004 !ruby/object:Gem::Requirement
55
52
  none: false
56
53
  requirements:
57
54
  - - ">="
58
55
  - !ruby/object:Gem::Version
59
- segments:
60
- - 2
61
- - 3
62
- - 0
63
56
  version: 2.3.0
64
57
  type: :development
65
- version_requirements: *id003
58
+ version_requirements: *id004
66
59
  - !ruby/object:Gem::Dependency
67
60
  name: database_cleaner
68
61
  prerelease: false
69
- requirement: &id004 !ruby/object:Gem::Requirement
62
+ requirement: &id005 !ruby/object:Gem::Requirement
70
63
  none: false
71
64
  requirements:
72
65
  - - ">="
73
66
  - !ruby/object:Gem::Version
74
- segments:
75
- - 0
76
- - 5
77
- - 0
78
67
  version: 0.5.0
79
68
  type: :development
80
- version_requirements: *id004
69
+ version_requirements: *id005
81
70
  description: Gives a method that can parse query string parameters into a set of criterias that Mongoid can use to perform actual queries in MongoDB databases for a given model.
82
71
  email:
83
72
  - vicente.mundim@gmail.com
@@ -88,22 +77,22 @@ extensions: []
88
77
  extra_rdoc_files: []
89
78
 
90
79
  files:
91
- - lib/version.rb
92
- - lib/mongoid_query_string_interface.rb
80
+ - lib/mongoid/helpers.rb
81
+ - lib/mongoid/paginate.rb
93
82
  - lib/mongoid/parsers/array_parser.rb
83
+ - lib/mongoid/parsers/boolean_and_nil_parser.rb
94
84
  - lib/mongoid/parsers/date_time_parser.rb
85
+ - lib/mongoid/parsers/filter_parser.rb
95
86
  - lib/mongoid/parsers/filters_parser.rb
96
87
  - lib/mongoid/parsers/number_parser.rb
97
- - lib/mongoid/parsers/filter_parser.rb
98
- - lib/mongoid/parsers/boolean_and_nil_parser.rb
99
88
  - lib/mongoid/parsers/regex_parser.rb
100
89
  - lib/mongoid/query_string_interface.rb
101
- - lib/mongoid/helpers.rb
90
+ - lib/mongoid_query_string_interface.rb
91
+ - lib/version.rb
102
92
  - MIT_LICENSE
103
93
  - README.rdoc
104
94
  - Gemfile
105
95
  - Gemfile.lock
106
- has_rdoc: true
107
96
  homepage: http://github.com/vicentemundim/mongoid_query_string_interface
108
97
  licenses: []
109
98
 
@@ -117,23 +106,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
117
106
  requirements:
118
107
  - - ">="
119
108
  - !ruby/object:Gem::Version
120
- segments:
121
- - 0
122
109
  version: "0"
123
110
  required_rubygems_version: !ruby/object:Gem::Requirement
124
111
  none: false
125
112
  requirements:
126
113
  - - ">="
127
114
  - !ruby/object:Gem::Version
128
- segments:
129
- - 1
130
- - 3
131
- - 6
132
115
  version: 1.3.6
133
116
  requirements: []
134
117
 
135
118
  rubyforge_project: mongoid_query_string_interface
136
- rubygems_version: 1.3.7
119
+ rubygems_version: 1.8.5
137
120
  signing_key:
138
121
  specification_version: 3
139
122
  summary: An interface for performing queries in MongoDB using query string parameters.