• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

foodcoops / foodsoft / 20799923604

07 Jan 2026 11:27PM UTC coverage: 42.78% (-24.3%) from 67.127%
20799923604

push

github

Ray Oei
Bump version to upcoming release as to remove confusion

3087 of 7216 relevant lines covered (42.78%)

11.86 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

36.36
/lib/render_csv.rb
1
require 'csv'
1✔
2

3
class RenderCsv
1✔
4
  include ActionView::Helpers::NumberHelper
1✔
5

6
  def initialize(object, options = {})
1✔
7
    @object = object
×
8
    @options = options
×
9
    # defaults to please Microsoft Excel ...
10
    @options[:col_sep] ||= FoodsoftConfig[:csv_col_sep] || ';'
×
11
    @options[:row_sep] ||= FoodsoftConfig[:csv_row_sep] if FoodsoftConfig[:csv_row_sep]
×
12
    @options[:encoding] ||= FoodsoftConfig[:csv_encoding] || 'ISO-8859-15'
×
13
  end
14

15
  def to_csv
1✔
16
    options = @options.select { |k| %w[col_sep row_sep].include? k.to_s }
×
17
    ret = CSV.generate(**options) do |csv|
×
18
      if h = header
×
19
        csv << h
×
20
      end
21
      data { |d| csv << d }
×
22
    end
23
    ret.encode(@options[:encoding], invalid: :replace, undef: :replace)
×
24
  end
25

26
  def header
1✔
27
    nil
×
28
  end
29

30
  def data
1✔
31
    yield []
×
32
  end
33

34
  # XXX disable unit to avoid encoding problems, both in unit and whitespace. Also allows computations in spreadsheet.
35
  def number_to_currency(number, options = {})
1✔
36
    super(number, options.merge({ unit: '' }))
×
37
  end
38
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc