cellar 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cellar.rb +11 -10
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '026638c27435f7720d851a92b6a7ce66f98c34e069bacc17de95274f21cc26f3'
|
4
|
+
data.tar.gz: d30f5ce499e525bacf3670c9c9c2778be417d731289e48707110737e6aef4785
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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.
|
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
|
-
|
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
|
-
|
196
|
-
|
197
|
-
|
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.
|
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-
|
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.
|
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
|