picky-client 3.3.3 → 3.4.0

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.
@@ -41,6 +41,9 @@ module Picky
41
41
  #
42
42
  # If you don't pass it a block, it will just use the AR results.
43
43
  #
44
+ # Note: Usually, after this the ids are not needed anymore.
45
+ # Use #clear_ids to remove them.
46
+ #
44
47
  # === Parameters
45
48
  # * model_class: The model to use for the results. Will call #find on the given class.
46
49
  #
@@ -49,7 +52,7 @@ module Picky
49
52
  # * The rest of the options are directly passed through to the ModelClass.find(ids, options) method. Default is {}.
50
53
  #
51
54
  def populate_with model_class, options = {}, &block
52
- the_ids = ids options.delete(:up_to)
55
+ the_ids = ids options.delete(:up_to)
53
56
 
54
57
  objects = model_class.find the_ids, options
55
58
 
@@ -67,7 +70,6 @@ module Picky
67
70
  objects.collect! &block if block_given?
68
71
 
69
72
  amend_ids_with objects
70
- clear_ids
71
73
 
72
74
  objects
73
75
  end
@@ -12,7 +12,7 @@ describe Picky::Convenience do
12
12
  :duration => 0.12345
13
13
  }.extend Picky::Convenience
14
14
  end
15
-
15
+
16
16
  describe "entries" do
17
17
  context "default" do
18
18
  context "without block" do
@@ -75,7 +75,7 @@ describe Picky::Convenience do
75
75
  end
76
76
  end
77
77
  end
78
-
78
+
79
79
  describe "populate_with" do
80
80
  before(:each) do
81
81
  @results = {
@@ -87,7 +87,7 @@ describe Picky::Convenience do
87
87
  :duration => 0.123,
88
88
  :count => 1234
89
89
  }.extend Picky::Convenience
90
-
90
+
91
91
  class ARClass
92
92
  attr_reader :id
93
93
  def initialize id
@@ -109,8 +109,12 @@ describe Picky::Convenience do
109
109
  @results.populate_with(ARClass) { |ar_instance| ar_instance.id.to_s }
110
110
  @results.entries.should == (1..20).map { |id| id.to_s } # "rendering" using to_s
111
111
  end
112
+ it "keeps the ids by default" do
113
+ @results.populate_with(ARClass) { |ar_instance| ar_instance.id.to_s }
114
+ @results.ids.should_not be_empty
115
+ end
112
116
  end
113
-
117
+
114
118
  describe 'replace_ids_with' do
115
119
  before(:each) do
116
120
  @results = {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: picky-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.3
4
+ version: 3.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-03 00:00:00.000000000 Z
12
+ date: 2011-11-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: yajl-ruby
16
- requirement: &70131322216900 !ruby/object:Gem::Requirement
16
+ requirement: &70210313757500 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.7.8
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70131322216900
24
+ version_requirements: *70210313757500
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activesupport
27
- requirement: &70131322216400 !ruby/object:Gem::Requirement
27
+ requirement: &70210313757000 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: 3.0.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70131322216400
35
+ version_requirements: *70210313757000
36
36
  description: Picky Client
37
37
  email: florian.hanke+picky-client@gmail.com
38
38
  executables: []