pixiedust 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +3 -0
- data/Manifest.txt +1 -0
- data/lib/pixiedust.rb +19 -1
- data/test/activerecord_dust.rb +10 -0
- metadata +6 -4
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/lib/pixiedust.rb
CHANGED
@@ -8,7 +8,7 @@ rescue LoadError
|
|
8
8
|
end
|
9
9
|
|
10
10
|
class PixieDust
|
11
|
-
VERSION = '0.0.
|
11
|
+
VERSION = '0.0.9'
|
12
12
|
end
|
13
13
|
|
14
14
|
class Object
|
@@ -138,3 +138,21 @@ class Integer
|
|
138
138
|
NumberDust.nearest(self)
|
139
139
|
end
|
140
140
|
end
|
141
|
+
|
142
|
+
unless defined?(ActiveRecord)
|
143
|
+
require 'activerecord'
|
144
|
+
end
|
145
|
+
class << ActiveRecord::Base
|
146
|
+
def each(limit=1000, first=0)
|
147
|
+
if first == 0
|
148
|
+
rows = [find(:first, :limit => limit)]
|
149
|
+
else
|
150
|
+
rows = find(:all, :conditions => ["id > ?", first], :limit => limit)
|
151
|
+
end
|
152
|
+
while rows.any?
|
153
|
+
rows.each { |record| yield record }
|
154
|
+
rows = find(:all, :conditions => ["id > ?", rows.last.id], :limit => limit)
|
155
|
+
end
|
156
|
+
self
|
157
|
+
end
|
158
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pixiedust
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Wilkins
|
@@ -9,17 +9,18 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-09-07 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: hoe
|
17
|
+
type: :development
|
17
18
|
version_requirement:
|
18
19
|
version_requirements: !ruby/object:Gem::Requirement
|
19
20
|
requirements:
|
20
21
|
- - ">="
|
21
22
|
- !ruby/object:Gem::Version
|
22
|
-
version: 1.
|
23
|
+
version: 1.7.0
|
23
24
|
version:
|
24
25
|
description: "Where applicable, they come with a standard version and a class mix in. Ex: NumberDust.nearest(value) is also available as Integer.pd_nearest == FEATURES/PROBLEMS: Features: * Get random numbers in arbitrary ranges from OpenSSL (without skew due to modulo) Problems: * Need a good way to make sure that the OpenSSL library isn't using a broken PRNG == SYNOPSIS: require 'pixiedust' x = RandomDust.between(10,20)"
|
25
26
|
email: jwilkins[at]bitland[dot]net
|
@@ -40,6 +41,7 @@ files:
|
|
40
41
|
- test/number_dust.rb
|
41
42
|
- test/random_dust.rb
|
42
43
|
- test/hash_dust.rb
|
44
|
+
- test/activerecord_dust.rb
|
43
45
|
has_rdoc: true
|
44
46
|
homepage: " by Jonathan Wilkins"
|
45
47
|
post_install_message:
|
@@ -63,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
65
|
requirements: []
|
64
66
|
|
65
67
|
rubyforge_project: pixiedust
|
66
|
-
rubygems_version: 1.0
|
68
|
+
rubygems_version: 1.2.0
|
67
69
|
signing_key:
|
68
70
|
specification_version: 2
|
69
71
|
summary: A collection of little routines and functions
|