ur-product 0.9.7 → 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/ur/search.rb +15 -11
  2. metadata +4 -4
data/lib/ur/search.rb CHANGED
@@ -35,29 +35,33 @@ module UR
35
35
  def ok?
36
36
  (!@solr.nil? && @solr && @solr.ok?)
37
37
  end
38
-
38
+
39
39
  def per_page
40
40
  (ok?) ? @solr.params['rows'].to_i : 0
41
41
  end
42
42
 
43
- def total_pages
44
- (ok? && !@solr.docs.nil?) ? @solr.docs.total_pages : 0
45
- end
46
-
47
43
  def num_found
48
44
  (ok?) ? @solr.response['numFound'].to_i : 0
49
45
  end
50
46
 
51
- def previous_page
52
- (ok? && !@solr.docs.nil?) ? @solr.docs.previous_page : 0
47
+ ##
48
+ # Pagination
49
+ #
50
+
51
+ def current_page
52
+ (!@solr.docs.nil?) ? @solr.docs.current_page : 0
53
53
  end
54
54
 
55
- def next_page
56
- (ok? && !@solr.docs.nil?) ? @solr.docs.next_page : 0
55
+ def total_pages
56
+ (!@solr.docs.nil?) ? @solr.docs.total_pages : 0
57
57
  end
58
58
 
59
- def current_page
60
- @solr.docs.current_page
59
+ def previous_page
60
+ (current_page > 1) ? @solr.docs.previous_page : false
61
+ end
62
+
63
+ def next_page
64
+ (current_page < total_pages) ? @solr.docs.next_page : false
61
65
  end
62
66
  end
63
67
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ur-product
3
3
  version: !ruby/object:Gem::Version
4
- hash: 53
4
+ hash: 43
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 7
10
- version: 0.9.7
9
+ - 8
10
+ version: 0.9.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Peter Hellberg
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-06-29 00:00:00 +02:00
18
+ date: 2010-06-30 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency