waistband 0.16.5 → 0.16.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -2
- data/lib/waistband/search_results.rb +1 -1
- data/lib/waistband/version.rb +1 -1
- data/spec/lib/search_results_spec.rb +3 -1
- metadata +2 -2
data/.travis.yml
CHANGED
@@ -10,7 +10,7 @@ module Waistband
|
|
10
10
|
def initialize(arr, options)
|
11
11
|
@current_page = (options[:current_page] || 1).to_i
|
12
12
|
@total_count = (options[:total_count] || arr.length).to_i
|
13
|
-
@per_page = (options[:per_page] || ::Waistband::SearchResults::DEFAULT_PAGE_SIZE).to_i
|
13
|
+
@per_page = (options[:page_size] || options[:per_page] || ::Waistband::SearchResults::DEFAULT_PAGE_SIZE).to_i
|
14
14
|
@num_pages = @total_pages = (options[:num_pages] || (@total_count.to_f / @per_page).ceil)
|
15
15
|
@limit_value = options[:limit]
|
16
16
|
super(arr)
|
data/lib/waistband/version.rb
CHANGED
@@ -30,7 +30,7 @@ describe ::Waistband::SearchResults do
|
|
30
30
|
}
|
31
31
|
end
|
32
32
|
|
33
|
-
let(:results) { ::Waistband::SearchResults.new(search_hash) }
|
33
|
+
let(:results) { ::Waistband::SearchResults.new(search_hash, page_size: 10) }
|
34
34
|
|
35
35
|
it "provides a method interface for the results hash array" do
|
36
36
|
expect(results.took).to eql 1
|
@@ -83,6 +83,7 @@ describe ::Waistband::SearchResults do
|
|
83
83
|
expect(results.paginated_hits).to be_a ::Waistband::SearchResults::PaginatedArray
|
84
84
|
expect(results.paginated_hits.total_pages).to eql 1
|
85
85
|
expect(results.paginated_hits.current_page).to eql 1
|
86
|
+
expect(results.paginated_hits.instance_variable_get('@per_page')).to eql 10
|
86
87
|
end
|
87
88
|
|
88
89
|
end
|
@@ -95,6 +96,7 @@ describe ::Waistband::SearchResults do
|
|
95
96
|
expect(results.paginated_results).to be_a ::Waistband::SearchResults::PaginatedArray
|
96
97
|
expect(results.paginated_results.total_pages).to eql 1
|
97
98
|
expect(results.paginated_results.current_page).to eql 1
|
99
|
+
expect(results.paginated_hits.instance_variable_get('@per_page')).to eql 10
|
98
100
|
end
|
99
101
|
|
100
102
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: waistband
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.16.
|
4
|
+
version: 0.16.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-06-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|