napa_pagination 0.0.2 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2040765e2211cb26d06203d4b11e2059265e9b69
4
- data.tar.gz: f529ae41244fa40bcfe7887747a7b9b320f5e9dd
3
+ metadata.gz: 07d5307088369425a0b17541a94234c47451b619
4
+ data.tar.gz: 7c2069fcf395bbc9c4261abca4bc633b8a32af6c
5
5
  SHA512:
6
- metadata.gz: a1be748695c4ec52d741a09acaf12c2a64c963f8fa7e9b1e45d649df459462d19f3db89fd10ad6db5be1c7f9d479b0c2ff08faa3b5c570431a9419abb0a58ed9
7
- data.tar.gz: b85247ea1831d700d56edd6b317a56277219c488748455bc7ea1e129f0d58e84f3ecc9a6c26122a45c9522583076839fedbdfef9ab6e5b64d01a53d400421d45
6
+ metadata.gz: 6f03cb1064bf82e50b2460f23abeecd936e1c06fe344f38d13f9be5e6583d5e9941efc646e0ac1f9545b6a2180cf52fd400ea3d17364737266d8a3b35ad74199
7
+ data.tar.gz: df5563f6d04fa1849087082d4966bbae1408a7adf87721005b202de0870408218a554e1e756be24f6c64066c9152fe136f4a2f6213ec7879f1ddbb4010ca1780
@@ -5,8 +5,9 @@ module NapaPagination
5
5
 
6
6
  if data.respond_to?(:to_a)
7
7
  return {}.tap do |r|
8
+ data = NapaPagination::Pagination.new(represent_pagination(data))
8
9
  r[:data] = data.map{ |item| with.new(item).to_hash(args) }
9
- r[:pagination] = NapaPagination::Pagination.new(represent_pagination(data)).to_h
10
+ r[:pagination] = data.to_h
10
11
  end
11
12
  else
12
13
  return { data: with.new(data).to_hash(args)}
@@ -1,5 +1,6 @@
1
1
  module NapaPagination
2
2
  class Pagination
3
+ include Enumerable
3
4
  def initialize(object)
4
5
  @object = object
5
6
  end
@@ -16,5 +17,11 @@ module NapaPagination
16
17
  p[:total_count] = @object.total_count if @object.respond_to?(:total_count)
17
18
  end
18
19
  end
20
+
21
+ def each(&block)
22
+ @object.each do |member|
23
+ block.call(member)
24
+ end
25
+ end
19
26
  end
20
- end
27
+ end
@@ -1,3 +1,3 @@
1
1
  module NapaPagination
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: napa_pagination
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darby Frey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-04 00:00:00.000000000 Z
11
+ date: 2014-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grape