dm-chunked_query 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +5 -0
- data/gemspec.yml +1 -1
- data/lib/dm-chunked_query/chunks.rb +17 -4
- metadata +2 -2
data/ChangeLog.md
CHANGED
data/gemspec.yml
CHANGED
@@ -27,11 +27,12 @@ module DataMapper
|
|
27
27
|
#
|
28
28
|
# Provides random access to chunks.
|
29
29
|
#
|
30
|
-
# @param [
|
30
|
+
# @param [Range<Integer>, Integer] key
|
31
31
|
# The index or range of indices to access.
|
32
32
|
#
|
33
|
-
# @return [DataMapper::Collection,
|
33
|
+
# @return [DataMapper::Collection, nil]
|
34
34
|
# A collection of resources at the given index or indices.
|
35
|
+
# If the index is out of bounds, `nil` will be returned.
|
35
36
|
#
|
36
37
|
def [](key)
|
37
38
|
case key
|
@@ -41,11 +42,23 @@ module DataMapper
|
|
41
42
|
|
42
43
|
chunk_at(index,span)
|
43
44
|
when Integer
|
44
|
-
chunk_at(
|
45
|
+
chunk_at(index)
|
45
46
|
end
|
46
47
|
end
|
47
48
|
|
48
|
-
|
49
|
+
#
|
50
|
+
# Accesses a chunk at a specific index.
|
51
|
+
#
|
52
|
+
# @param [#to_i] index
|
53
|
+
# The index to access.
|
54
|
+
#
|
55
|
+
# @return [DataMapper::Collection, nil]
|
56
|
+
# The chunk of resources at the given index. If the index is out of
|
57
|
+
# bounds, `nil` will be returned.
|
58
|
+
#
|
59
|
+
def at(index)
|
60
|
+
chunk_at(key.to_i)
|
61
|
+
end
|
49
62
|
|
50
63
|
#
|
51
64
|
# Enumerates over each chunk in the collection of Chunks.
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: dm-chunked_query
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Postmodern
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-03-
|
13
|
+
date: 2011-03-03 00:00:00 -08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|