buscar 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +7 -7
- data/VERSION +1 -1
- data/buscar.gemspec +2 -2
- data/lib/buscar/index.rb +5 -5
- metadata +4 -4
data/Gemfile.lock
CHANGED
@@ -42,14 +42,14 @@ GEM
|
|
42
42
|
rack (>= 1.0)
|
43
43
|
rake (0.8.7)
|
44
44
|
rcov (0.9.9)
|
45
|
-
rspec (2.
|
46
|
-
rspec-core (~> 2.
|
47
|
-
rspec-expectations (~> 2.
|
48
|
-
rspec-mocks (~> 2.
|
49
|
-
rspec-core (2.
|
50
|
-
rspec-expectations (2.
|
45
|
+
rspec (2.3.0)
|
46
|
+
rspec-core (~> 2.3.0)
|
47
|
+
rspec-expectations (~> 2.3.0)
|
48
|
+
rspec-mocks (~> 2.3.0)
|
49
|
+
rspec-core (2.3.0)
|
50
|
+
rspec-expectations (2.3.0)
|
51
51
|
diff-lcs (~> 1.1.2)
|
52
|
-
rspec-mocks (2.
|
52
|
+
rspec-mocks (2.3.0)
|
53
53
|
tzinfo (0.3.23)
|
54
54
|
|
55
55
|
PLATFORMS
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.1
|
data/buscar.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{buscar}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["jarrett"]
|
12
|
-
s.date = %q{2010-12-
|
12
|
+
s.date = %q{2010-12-12}
|
13
13
|
s.description = %q{Simplifies searching, sorting, and pagination of ActiveRecord models. Includes a model class and a view helper.}
|
14
14
|
s.email = %q{jarrettcolby@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/buscar/index.rb
CHANGED
@@ -11,7 +11,7 @@ module Buscar
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def empty?
|
14
|
-
|
14
|
+
records.empty?
|
15
15
|
end
|
16
16
|
|
17
17
|
# Returns one of the following in descending order of preference:
|
@@ -73,7 +73,7 @@ module Buscar
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def length
|
76
|
-
|
76
|
+
records.length
|
77
77
|
end
|
78
78
|
|
79
79
|
def optional_params(*keys)
|
@@ -94,7 +94,7 @@ module Buscar
|
|
94
94
|
end
|
95
95
|
|
96
96
|
def page_count
|
97
|
-
(
|
97
|
+
(records.length.to_f / records_per_page).ceil
|
98
98
|
end
|
99
99
|
|
100
100
|
attr_reader :params
|
@@ -102,9 +102,9 @@ module Buscar
|
|
102
102
|
# page_num is zero-based for this method.
|
103
103
|
def records_on_page(page_num)
|
104
104
|
if paginate?
|
105
|
-
|
105
|
+
records.slice((page_num) * records_per_page, records_per_page)
|
106
106
|
else
|
107
|
-
|
107
|
+
records
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buscar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 1
|
10
|
+
version: 1.0.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- jarrett
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-12-
|
18
|
+
date: 2010-12-12 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|