decisive 0.8.0 → 0.8.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
  SHA256:
3
- metadata.gz: 396540579e82830745c22839f173f3dcf7886929cef16c023bd85fe2e8eff1e9
4
- data.tar.gz: 49ed399702320635522c2640a52bc9b65b0563311371a0e2591dafce2b5a8865
3
+ metadata.gz: 0b38c58e34d219f9261afb9e253086ac9b6119c5b99ee402c940190e366f77c9
4
+ data.tar.gz: 681cc003a82807f8a2ab9993f009a1791a14ed3eab7737d9b4547daeb2c03d1a
5
5
  SHA512:
6
- metadata.gz: 716dce8f3d55a83fed5494f9b033e2a59406758d2a948f023308758535e97075dc7a5c4e3bfe047602e6849dbeec567fc1b6939bc184c2b434528918710ca98f
7
- data.tar.gz: ad89e1e17edf6fc83d6b44cdf78451d456cda767d62dde058129b06c352d43c03093c411a8fc08195eb165e1179be9b68947d1d552dacd4c37cc593ca832d8d2
6
+ metadata.gz: c019470bf1cb254b454849a58063fcfd66ca758e246cd352df3b200dc209b649221ce93bd028fb74455b77fcc42b7d597abadd2bf6c537d9fb7eb8e9abdf8cc6
7
+ data.tar.gz: 88d114b63a742e467cf3c07b13fe69be4f3d8c7a1abb59433c91f0b00b6f7332e4e9e81869b7432f2b2c8069eaa39db49355a896525043720890ef1ebdce2f3a
@@ -40,10 +40,10 @@ module Decisive
40
40
  sheet = xls.add_worksheet(sanitize_name(worksheet.name)).tap do |sheet|
41
41
  Renderer.new(worksheet.records, worksheet.block).each.with_index do |row, row_index|
42
42
  row.each.with_index do |cell, cell_index|
43
- if cell[0] == "="
43
+ if cell.to_s[0] == "="
44
44
  sheet.add_cell row_index, cell_index, nil, cell[1..]
45
45
  else
46
- sheet.add_cell row_index, cell_index, cell
46
+ sheet.add_cell row_index, cell_index, cell.to_s
47
47
  end
48
48
  end
49
49
  end
@@ -23,8 +23,11 @@ module Decisive
23
23
  end
24
24
 
25
25
  def hashes
26
- @hashes ||= records.map do |record|
27
- Row.new(record, block).to_hash
26
+ @hashes ||= begin
27
+ method = records.respond_to?(:find_each) ? :find_each : :each
28
+ records.send(method).map do |record|
29
+ Row.new(record, block).to_hash
30
+ end
28
31
  end
29
32
  end
30
33
 
@@ -22,7 +22,8 @@ module Decisive
22
22
  def each
23
23
  yield header
24
24
 
25
- records.map do |record|
25
+ method = records.respond_to?(:find_each) ? :find_each : :each
26
+ records.send(method) do |record|
26
27
  row = columns.map do |column|
27
28
  column.block.call(record).to_s
28
29
  end
@@ -20,7 +20,7 @@ module Decisive
20
20
  if context.csv?
21
21
  response.headers["Content-Type"] = "text/csv"
22
22
 
23
- if controller.is_a?(ActionController::Live)
23
+ if @stream
24
24
  begin
25
25
  context.each do |row|
26
26
  response.stream.write row.to_csv(force_quotes: true)
@@ -55,6 +55,7 @@ module Decisive
55
55
 
56
56
  module DSL
57
57
  def csv records, filename:, stream: true, &block
58
+ @stream = stream
58
59
  if stream
59
60
  raise StreamingNotEnabledByControllerError unless controller.is_a?(ActionController::Live)
60
61
  raise StreamIncompatibleBlockArgumentError if block.arity != 0
@@ -1,3 +1,3 @@
1
1
  module Decisive
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decisive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-01 00:00:00.000000000 Z
11
+ date: 2022-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview