active_sample 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/active_sample.rb +3 -3
- data/lib/active_sample/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d10720d2f67b5c169a79f0f2f1a09832a899187
|
4
|
+
data.tar.gz: 118738a384f454345565d3d148a88173af9a3d82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce11bf7bf2bd151fc850d2d04c646538a6ae2199b80b3a1f82d9f2ddac43f08686d8949b504dc33ca01e170955136ce212527468951e71dfee0e4912816f8904
|
7
|
+
data.tar.gz: 103c0e225d3e17792a63b11eb4d96f7361d0c7f71f192853e2bd0f93b78256bec3d7eef73ae4800e312e5e1222549db1c59ef672e06b371408da8edc76c35dcc
|
data/CHANGELOG.md
CHANGED
data/lib/active_sample.rb
CHANGED
@@ -10,18 +10,18 @@ module ActiveSample
|
|
10
10
|
raise NegativeSampleError.new("negative sample number".freeze)
|
11
11
|
end
|
12
12
|
|
13
|
-
max_id = maximum(
|
13
|
+
max_id = maximum(primary_key)
|
14
14
|
|
15
15
|
return nil if max_id == nil
|
16
16
|
|
17
17
|
if n == 1
|
18
|
-
while !(found = find_by(
|
18
|
+
while !(found = find_by(primary_key => 1 + rand(max_id))); end
|
19
19
|
|
20
20
|
found
|
21
21
|
elsif n == 0
|
22
22
|
none
|
23
23
|
else
|
24
|
-
where(
|
24
|
+
where(primary_key => ids.sample(n))
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_sample
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JuanitoFatas
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -64,9 +64,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
64
|
version: '0'
|
65
65
|
requirements: []
|
66
66
|
rubyforge_project:
|
67
|
-
rubygems_version: 2.6.
|
67
|
+
rubygems_version: 2.6.12
|
68
68
|
signing_key:
|
69
69
|
specification_version: 4
|
70
70
|
summary: Sample functionality for Active Record.
|
71
71
|
test_files: []
|
72
|
-
has_rdoc:
|