cellar 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cellar.rb +11 -10
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 549bf01d6e8d969ae15c0a3a683c562a372a6916e2b73a4d98b4b215471cbc6d
4
- data.tar.gz: 0df9839f7a98c0659100e9c431168ccaa27dd4c18e978d9e74a3d1996a95bbc4
3
+ metadata.gz: '026638c27435f7720d851a92b6a7ce66f98c34e069bacc17de95274f21cc26f3'
4
+ data.tar.gz: d30f5ce499e525bacf3670c9c9c2778be417d731289e48707110737e6aef4785
5
5
  SHA512:
6
- metadata.gz: 854e6884861eaa8d3b94cd82ae618e61b791fe64ec11d6aa1d97c1bd7938ff2f722607293428b47270866b376f9d2d23329891ac5252190cfe043aa546700362
7
- data.tar.gz: a8ab03f030093ac6d20da412fb60480b558c23f0227b4145533bf3439dd9e1a5eb9483436025e1446f3e4e38e8bddd97de1b224310339f3b70d0c566e69064de
6
+ metadata.gz: c164d9f764a11ed5a9323c6bf7a35f13bb734794e4d54235328a93aa3cda5306dfdf74e2cf95f70cea9483fbe827fb6e252bda79b88275c915eccdefce15a1b0
7
+ data.tar.gz: c16459edab8f3ee5d4dfba2ec3622b0dcfd409b5c175b77f811a3af1dc3d65d01ff6e3edf71126d219a80da0fe228eff87f6e07b19ecc1726b86111a34bb7c40
data/lib/cellar.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  # cellar - Ruby gem to deal with cells of data in rows and columns
3
3
  #
4
4
  # Author: Steve Shreeve (steve.shreeve@gmail.com)
5
- # Date: October 2, 2024
5
+ # Date: October 8, 2024
6
6
  #
7
7
  # TODO:
8
8
  # • Should we failover to empty strings like this: (value || "")
@@ -24,7 +24,7 @@ class Object
24
24
  end
25
25
 
26
26
  class Cellar
27
- VERSION="0.1.0"
27
+ VERSION="0.1.1"
28
28
 
29
29
  attr_reader :fields
30
30
  attr_reader :values
@@ -108,11 +108,7 @@ class Cellar
108
108
  when Array then @values.values_at(*index)
109
109
  else @values[index]
110
110
  end
111
- if Array === value
112
- values.concat(value)
113
- else
114
- values.push(value)
115
- end
111
+ Array === value ? values.concat(value) : values.push(value)
116
112
  end
117
113
  end
118
114
  end
@@ -192,9 +188,14 @@ class Cellar
192
188
  def <<(data)
193
189
  @rows ||= []
194
190
  @row = row = @rows.size
195
- @rows << @values = []
196
- raise "unable to << #{data.class} objects" unless self.class === data.class
197
- self[*data.fields] = data.values
191
+ if self.class === data.class
192
+ @rows << @values = []
193
+ self[*data.fields] = data.values
194
+ elsif data.is_a?(Array) && !data.first.is_a?(Array)
195
+ @rows << data
196
+ else
197
+ raise "unable to << your object"
198
+ end
198
199
  if @index
199
200
  block = @index if @index.is_a?(Proc)
200
201
  field = @index unless block
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cellar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Shreeve
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-03 00:00:00.000000000 Z
11
+ date: 2024-10-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby gem to deal with cells of data in rows and columns
14
14
  email: steve.shreeve@gmail.com
@@ -39,7 +39,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  requirements: []
42
- rubygems_version: 3.5.19
42
+ rubygems_version: 3.5.21
43
43
  signing_key:
44
44
  specification_version: 4
45
45
  summary: A Ruby gem to deal with cells of data in rows and columns