true_table 0.2.2 → 0.2.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
2
  SHA256:
3
- metadata.gz: 842b30f634d0113dac1917cacac6b6cf4265a3bb50b37361aa8ae4f36bd4fec6
4
- data.tar.gz: b15972166d48d756538b22e4074f3700d862460f0e5412ce12463261998bb3da
3
+ metadata.gz: 1ec9c37621fb36832b5492cc2b467541ad646056fa245ed701c30a94c900028b
4
+ data.tar.gz: 265b809a637e10431299f01f8a209bd038909c6d35bad8843d66763fe3fbcf23
5
5
  SHA512:
6
- metadata.gz: 502b4c1018f441800f298a45b0cc0bfe61ae1e6f528e2178839492e2d08206d85e0672cbc0f849e47f3f4d91433fcc97f060406a8bad949453b862983cc1a31b
7
- data.tar.gz: ea29b5abe5a3f090db4932ba64daa42d89bc8f9413ec5c8db225ce521bfd662443e619726269e4f7bba2d53c35620c093553b7b138e3bd577a6046f87a351d45
6
+ metadata.gz: e7ef3be0f82f07c73d9dfeec1cdedc15f79badcd6099de58f0292bda033a80ae242dee794d0e991b68e4bbb4d700d7115af677c03af55965389b47e1fb88c61b
7
+ data.tar.gz: 4db2c8cfefc89afe2b2820c6e77221b90c36e227b53b700d60ae07b9b873d7b1f77490b341fe88c6d421e63997ecb0743589d3fea3b9bf395e6e7f0faaf6e8ce
@@ -1,3 +1,3 @@
1
1
  class TrueTable < Array
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3'
3
3
  end
data/lib/true_table.rb CHANGED
@@ -263,9 +263,14 @@ class TrueTable < Array
263
263
  end
264
264
 
265
265
  # Returns a hash representation of the table using the values of the
266
- # first column as hash keys
266
+ # first column as hash keys. If a block is given, the results of the block
267
+ # on each element of the array will be used as key => value pair.
267
268
  def to_h
268
- super { |row| [row.values.first, row] }
269
+ if block_given?
270
+ super
271
+ else
272
+ super { |row| [row.values.first, row] }
273
+ end
269
274
  end
270
275
 
271
276
  # Returns only values, without any headers (array of arrays)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: true_table
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-09 00:00:00.000000000 Z
11
+ date: 2023-06-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Simple and intuitive tabular data type
14
14
  email: db@dannyben.com
@@ -32,14 +32,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - ">="
34
34
  - !ruby/object:Gem::Version
35
- version: 2.7.0
35
+ version: '3.0'
36
36
  required_rubygems_version: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  requirements: []
42
- rubygems_version: 3.3.26
42
+ rubygems_version: 3.4.13
43
43
  signing_key:
44
44
  specification_version: 4
45
45
  summary: Simple and intuitive tabular data type