data-table 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: '0460569bde89f23e217c746e8a389733bf116696'
4
- data.tar.gz: 29c4b0d8de0f82967dff15baa783011a94e74a68
2
+ SHA256:
3
+ metadata.gz: c386a8363980289b78c55b567a8605680275a8f51444fa86be2da2872581a7dd
4
+ data.tar.gz: 9778187132a67c142491b5da51027b631cd906375e2827c7f82b61474be21e82
5
5
  SHA512:
6
- metadata.gz: d3330d311d3a62f0c42a431bdc19c307a283e3cdf4504c30371e311ad3b5330ad1c7d5ac96218dadfa25f6b3fc60efdbabc26137e1b470a8aa10cbc9b6e070fe
7
- data.tar.gz: a817743f3b98df6fbed75e32172d969da426b33941bf6d4ab06909afa296d8d12cb337541b111c6dfd944074eb8983b9314330e2abbc9a77f34fc5cef034c0f6
6
+ metadata.gz: e65192931fd42ebfabfa2cdf7cfd55309080e5fa4af9ffbb2ed9d2fbc99a24f837513b5e09ed9ea2c4f8dc1f9f76176118ad45b7c47838dc87ca9722507575f1
7
+ data.tar.gz: 55952adf452a7df4b7829ccd68c9e152cf644057dd588d7979ff284dc8c78a6cc99ad77e4bc5d53a093a139d0fbcb6eccdf9bfcae20ccb23b428df0f39a5ca03
@@ -1,4 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.3.3
4
- - 2.4.0
3
+ - 2.5
4
+ - 2.6
5
+ - 2.7
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Veracross
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # DataTable
2
- [![Build Status](https://secure.travis-ci.org/veracross/data-table.png)](http://travis-ci.org/veracross/data-table)
3
- [![Code Climate](https://codeclimate.com/github/veracross/data-table.png)](https://codeclimate.com/github/veracross/data-table)
2
+ [![Build Status](https://secure.travis-ci.org/veracross/data-table.svg)](http://travis-ci.org/veracross/data-table)
3
+ [![Code Climate](https://codeclimate.com/github/veracross/data-table.svg)](https://codeclimate.com/github/veracross/data-table)
4
4
 
5
5
  DataTable renders collections (an array of hashes or ActiveRecord models) as HTML tables.
6
6
 
@@ -133,12 +133,3 @@ You can also combine subtotals & totals in the same table.
133
133
 
134
134
  ## Credits
135
135
  Nearly all of the code for this was written by @smerickson, and later gemified by @sixfeetover.
136
-
137
- ## License
138
- Copyright (c) 2012-2013 Jeff Fraser (Veracross LLC) jfraser@breuer.com
139
-
140
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
141
-
142
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
143
-
144
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -4,7 +4,7 @@ require 'data-table/version'
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'data-table'
6
6
  s.version = DataTable::VERSION
7
- s.licenses = ['Nonstandard']
7
+ s.licenses = ['MIT']
8
8
  s.authors = ['Steve Erickson', 'Jeff Fraser']
9
9
  s.email = ['sixfeetover@gmail.com']
10
10
  s.homepage = 'https://github.com/veracross/data-table'
@@ -13,8 +13,6 @@ Gem::Specification.new do |s|
13
13
  turning an array of hashes or ActiveRecord objects into an
14
14
  HTML table.)
15
15
 
16
- s.rubyforge_project = 'data-table'
17
-
18
16
  s.add_development_dependency 'rake', '~> 12'
19
17
  s.add_development_dependency 'rspec', '~> 3'
20
18
  s.add_development_dependency 'guard', '~> 2'
@@ -423,6 +423,8 @@ module DataTable
423
423
  end
424
424
 
425
425
  def calculate_avg(collection, column_name)
426
+ return 0 if collection.empty?
427
+
426
428
  sum = calculate_sum(collection, column_name)
427
429
  sum / collection.size
428
430
  end
@@ -1,3 +1,3 @@
1
1
  module DataTable
2
- VERSION = '2.0.2'.freeze
2
+ VERSION = '2.0.3'.freeze
3
3
  end
@@ -138,6 +138,13 @@ describe DataTable::Table do
138
138
  expect(data_table.render).to \
139
139
  eq(%{<table id='' class='data_table ' cellspacing='0' cellpadding='0'><caption></caption><thead><tr></tr></thead><tr><td class='empty_data_table' colspan='0'>#{text}</td></tr></table>})
140
140
  end
141
+
142
+ it "avoids dividing by zero" do
143
+ data_table.column :power_level
144
+ data_table.total :power_level, :avg, 0
145
+ data_table.calculate_totals!
146
+ expect(data_table.total_calculations).to eq([{:power_level=>0}])
147
+ end
141
148
  end
142
149
 
143
150
  context 'with a more complicated setup' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data-table
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Erickson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-02-19 00:00:00.000000000 Z
12
+ date: 2020-06-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -82,6 +82,7 @@ files:
82
82
  - ".travis.yml"
83
83
  - Gemfile
84
84
  - Guardfile
85
+ - LICENSE
85
86
  - README.md
86
87
  - Rakefile
87
88
  - assigments_table.html
@@ -100,7 +101,7 @@ files:
100
101
  - spec/table_spec.rb
101
102
  homepage: https://github.com/veracross/data-table
102
103
  licenses:
103
- - Nonstandard
104
+ - MIT
104
105
  metadata: {}
105
106
  post_install_message:
106
107
  rdoc_options: []
@@ -117,8 +118,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
118
  - !ruby/object:Gem::Version
118
119
  version: '0'
119
120
  requirements: []
120
- rubyforge_project: data-table
121
- rubygems_version: 2.6.14
121
+ rubyforge_project:
122
+ rubygems_version: 2.7.6
122
123
  signing_key:
123
124
  specification_version: 4
124
125
  summary: Turn arrays of hashes or models in to an HTML table.