active_force 0.20.0 → 0.20.1

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
  SHA256:
3
- metadata.gz: 1647fdc453090811c384514ae857c83b686dc966e2af5e47af3a6dc67e42059d
4
- data.tar.gz: 515a98a5715c24359739d76730758b728a9cbf1b8c0cbf2b3c1bb5a355a21c9e
3
+ metadata.gz: f1fbcc63ac7ef2ec3ac8efdadd055a61ae8e98fe721473a054d9207d95bc495e
4
+ data.tar.gz: 838eebde842f1edcc4b2b2a879b1697aec7439852af0f563b9f6687760b57434
5
5
  SHA512:
6
- metadata.gz: 48115b7a0df0201a24f477ba2f658e692824337a78c0d288afd3c056b42fccaaf065e1e3ab296fa16bda1f2f2eaf82ff1322adcea6d9d6a9f82c2318cea15d98
7
- data.tar.gz: a7b6dacca6775374b089cc9022462c470d8103d63792c7e7668ccd3e082446b0429a2d54d0e3392694c0e25ea25139916d11bc9f0080659faea6e7eaa0e41541
6
+ metadata.gz: ec076a1ffc49293809ebb2c66445ca70b1e016c82be03f4bf6803a6482b18d014711caca4112f7875f8a76cf85b27d1381cb8ffd2a749f7c49b21f801f298af6
7
+ data.tar.gz: 24378ad367f6ff96edaa88a902c946d5d2f38f71e69d1745cc7d769b0cb1d70dec4752e5825774506985c47202ed15835268b3ad08b1d5d255f6dbfb34b24e44
data/.gitignore CHANGED
@@ -15,4 +15,3 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
- .idea
data/CHANGELOG.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  ## Not released
4
4
 
5
+ ## 0.20.1
6
+ - Revert "ActiveForce .first performance enhancement (#73)" (https://github.com/Beyond-Finance/active_force/pull/76)
7
+
5
8
  ## 0.20.0
6
9
 
7
10
  - Change `.first` to not query the API if records have already been retrieved (https://github.com/Beyond-Finance/active_force/pull/73)
@@ -78,15 +78,7 @@ module ActiveForce
78
78
  end
79
79
 
80
80
  def first
81
- if @records
82
- clone_and_set_instance_variables(
83
- size: 1,
84
- records: [@records.first],
85
- decorated_records: [@decorated_records&.first]
86
- )
87
- else
88
- limit(1)
89
- end
81
+ limit 1
90
82
  end
91
83
 
92
84
  def last(limit = 1)
@@ -134,9 +126,9 @@ module ActiveForce
134
126
 
135
127
  def clone_and_set_instance_variables instance_variable_hash={}
136
128
  clone = self.clone
137
- { decorated_records: nil, records: nil }
138
- .merge(instance_variable_hash)
139
- .each { |k,v| clone.instance_variable_set("@#{k.to_s}", v) }
129
+ clone.instance_variable_set(:@decorated_records, nil)
130
+ clone.instance_variable_set(:@records, nil)
131
+ instance_variable_hash.each { |k,v| clone.instance_variable_set("@#{k.to_s}", v) }
140
132
  clone
141
133
  end
142
134
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveForce
4
- VERSION = '0.20.0'
4
+ VERSION = '0.20.1'
5
5
  end
@@ -165,22 +165,6 @@ describe ActiveForce::Query do
165
165
  expect(query.to_s).to eq "SELECT Id, name, etc FROM table_name"
166
166
  expect(new_query.to_s).to eq 'SELECT Id, name, etc FROM table_name LIMIT 1'
167
167
  end
168
-
169
- it "does not query if records have already been fetched" do
170
- query = ActiveForce::Query.new 'table_name'
171
- query.instance_variable_set(:@records, %w[foo bar])
172
- query.instance_variable_set(:@decorated_records, %w[foo bar])
173
- expect(query).not_to receive(:limit)
174
- expect(query).to receive(:clone_and_set_instance_variables).with(size: 1, records: ['foo'], decorated_records: ['foo'])
175
- query.first
176
- end
177
-
178
- it 'queries the api if it has not been queried yet' do
179
- query = ActiveForce::Query.new 'table_name'
180
- query.instance_variable_set(:@records, nil)
181
- expect(query).to receive(:limit)
182
- query.first
183
- end
184
168
  end
185
169
 
186
170
  describe '.last' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_force
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.0
4
+ version: 0.20.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Espinaco
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2023-11-27 00:00:00.000000000 Z
14
+ date: 2023-11-29 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activemodel