kaminari-mongoid 0.1.0 → 0.1.2

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: 8d6e0336e0ae78e0d015cf9d314cf6770ecc70b2
4
- data.tar.gz: f357e3919e5782e9dd4dbd925105cfbe9154fa97
3
+ metadata.gz: 1f9fcf5388c2b1acb0a2f1c83f5a64e9cc524453
4
+ data.tar.gz: a8a5b33ea8798ec9d9ffd17eb65ca2b86a7f91b1
5
5
  SHA512:
6
- metadata.gz: fa369378bf7fe3592725bd5d754122748b0140f5d18a48af1f6536a0e720e789a42364d332cbd02c2f66e2129b569f991dcd1bc3789b9e6daf609a097c0da49b
7
- data.tar.gz: 0b929d6851275d8a1c976931a8d3d7363d13fa16a6fe13416e9b8c097063e47d94fb91b3953dadab0ddf8722577d11013d09da616162fe1af7b61548acd23d7e
6
+ metadata.gz: 90abc7adfe4514b010941787c0d86add43168704ddd50a8f7eaa3aaeebdc059966ceaf2ec40bebc62f646aea7e6665d4c1ad560c386388f1db6deae5c216fcfb
7
+ data.tar.gz: 1f639e7601dad7b83f1616b4f3fbe3985498f1ae82c86a21ec2d593e76ae3c925b23ec93f667719888a342b3f7c31a7fb34aa00d1305d3637dda197d61e864dc
@@ -4,9 +4,9 @@ before_install: gem install bundler -v 1.11.2
4
4
 
5
5
  rvm:
6
6
  - 2.0.0
7
- - 2.1.8
7
+ - 2.1.10
8
8
  - 2.2.4
9
- - 2.3.0
9
+ - 2.3.1
10
10
  - ruby-head
11
11
  - jruby
12
12
  - jruby-head
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # Kaminari::Mongoid
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/kaminari/mongoid`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Kaminari Mongoid adapter.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
6
5
 
7
6
  ## Installation
8
7
 
@@ -12,28 +11,19 @@ Add this line to your application's Gemfile:
12
11
  gem 'kaminari-mongoid'
13
12
  ```
14
13
 
15
- And then execute:
14
+ And bundle.
16
15
 
17
- $ bundle
18
16
 
19
- Or install it yourself as:
17
+ ## Supported versions
20
18
 
21
- $ gem install kaminari-mongoid
19
+ * Mongoid 3+
22
20
 
23
- ## Usage
24
-
25
- TODO: Write usage instructions here
26
21
 
27
- ## Development
22
+ ## Usage
28
23
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
24
+ See [Kaminari README](https://github.com/amatsuda/kaminari/blob/master/README.rdoc).
30
25
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
26
 
33
27
  ## Contributing
34
28
 
35
- 1. Fork it ( https://github.com/[my-github-username]/kaminari-mongoid/fork )
36
- 2. Create your feature branch (`git checkout -b my-new-feature`)
37
- 3. Commit your changes (`git commit -am 'Add some feature'`)
38
- 4. Push to the branch (`git push origin my-new-feature`)
39
- 5. Create a new Pull Request
29
+ Pull requests are welcome on GitHub at https://github.com/kaminari/kaminari-mongoid
data/Rakefile CHANGED
@@ -3,7 +3,6 @@ require 'rspec/core'
3
3
  require 'rspec/core/rake_task'
4
4
 
5
5
  RSpec::Core::RakeTask.new(:spec) do |spec|
6
- spec.pattern = FileList['spec/**/*_spec.rb']
7
6
  spec.pattern = [FileList['spec/**/*_spec.rb'], FileList["#{File.join(Gem.loaded_specs['kaminari'].gem_dir, 'spec')}/**/*_spec.rb"]].flatten
8
7
  end
9
8
 
@@ -19,9 +19,9 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
+ spec.add_dependency 'kaminari'
22
23
  spec.add_development_dependency "bundler", "~> 1.9"
23
24
  spec.add_development_dependency "rake", "~> 10.0"
24
- spec.add_development_dependency 'kaminari'
25
25
  spec.add_development_dependency 'mongoid'
26
26
  spec.add_development_dependency 'rails'
27
27
  spec.add_development_dependency 'rspec-rails', '~> 2.14.1'
@@ -1,4 +1,4 @@
1
1
  require 'kaminari'
2
2
  require 'mongoid'
3
3
  require 'kaminari/mongoid/mongoid_extension'
4
- ::Mongoid::Document.send :include, Kaminari::MongoidExtension::Document
4
+ ::Mongoid::Document.send :include, Kaminari::Mongoid::MongoidExtension::Document
@@ -1,39 +1,41 @@
1
1
  module Kaminari
2
- module MongoidCriteriaMethods
3
- def initialize_copy(other) #:nodoc:
4
- @total_count = nil
5
- super
6
- end
2
+ module Mongoid
3
+ module MongoidCriteriaMethods
4
+ def initialize_copy(other) #:nodoc:
5
+ @total_count = nil
6
+ super
7
+ end
7
8
 
8
- def entry_name
9
- model_name.human.downcase
10
- end
9
+ def entry_name
10
+ model_name.human.downcase
11
+ end
11
12
 
12
- def limit_value #:nodoc:
13
- options[:limit]
14
- end
13
+ def limit_value #:nodoc:
14
+ options[:limit]
15
+ end
15
16
 
16
- def offset_value #:nodoc:
17
- options[:skip]
18
- end
17
+ def offset_value #:nodoc:
18
+ options[:skip]
19
+ end
19
20
 
20
- def total_count #:nodoc:
21
- @total_count ||= if embedded?
22
- unpage.size
23
- else
24
- if options[:max_scan] && options[:max_scan] < size
25
- options[:max_scan]
21
+ def total_count #:nodoc:
22
+ @total_count ||= if embedded?
23
+ unpage.size
26
24
  else
27
- size
25
+ if options[:max_scan] && options[:max_scan] < size
26
+ options[:max_scan]
27
+ else
28
+ size
29
+ end
28
30
  end
29
31
  end
30
- end
31
32
 
32
- private
33
- def unpage
34
- clone.tap do |crit|
35
- crit.options.delete :limit
36
- crit.options.delete :skip
33
+ private
34
+ def unpage
35
+ clone.tap do |crit|
36
+ crit.options.delete :limit
37
+ crit.options.delete :skip
38
+ end
37
39
  end
38
40
  end
39
41
  end
@@ -1,26 +1,28 @@
1
1
  require 'kaminari/mongoid/mongoid_criteria_methods'
2
2
 
3
3
  module Kaminari
4
- module MongoidExtension
5
- module Document
6
- extend ActiveSupport::Concern
7
- include Kaminari::ConfigurationMethods
4
+ module Mongoid
5
+ module MongoidExtension
6
+ module Document
7
+ extend ActiveSupport::Concern
8
+ include Kaminari::ConfigurationMethods
8
9
 
9
- included do
10
- scope Kaminari.config.page_method_name, Proc.new {|num|
11
- limit(default_per_page).offset(default_per_page * ((num = num.to_i - 1) < 0 ? 0 : num))
12
- } do
13
- include Kaminari::MongoidCriteriaMethods
14
- include Kaminari::PageScopeMethods
10
+ included do
11
+ scope Kaminari.config.page_method_name, Proc.new {|num|
12
+ limit(default_per_page).offset(default_per_page * ((num = num.to_i - 1) < 0 ? 0 : num))
13
+ } do
14
+ include Kaminari::Mongoid::MongoidCriteriaMethods
15
+ include Kaminari::PageScopeMethods
16
+ end
15
17
  end
16
- end
17
18
 
18
- module ClassMethods
19
- def inherited(kls)
20
- super
21
- kls.send(:include, Kaminari::MongoidExtension::Document.dup)
22
- end
23
- end if Mongoid::VERSION < '5.0.0'
19
+ module ClassMethods
20
+ def inherited(kls)
21
+ super
22
+ kls.send(:include, Kaminari::Mongoid::MongoidExtension::Document.dup)
23
+ end
24
+ end if ::Mongoid::VERSION < '5.0.0'
25
+ end
24
26
  end
25
27
  end
26
28
  end
@@ -1,5 +1,5 @@
1
1
  module Kaminari
2
2
  module Mongoid
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kaminari-mongoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akira Matsuda
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-13 00:00:00.000000000 Z
11
+ date: 2016-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: kaminari
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.9'
20
- type: :development
19
+ version: '0'
20
+ type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.9'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '1.9'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '1.9'
41
41
  - !ruby/object:Gem::Dependency
42
- name: kaminari
42
+ name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '10.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '10.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: mongoid
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -196,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
196
  version: '0'
197
197
  requirements: []
198
198
  rubyforge_project:
199
- rubygems_version: 2.5.1
199
+ rubygems_version: 2.6.4
200
200
  signing_key:
201
201
  specification_version: 4
202
202
  summary: Kaminari Mongoid adapter