cellar 0.1.4 → 0.1.5

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 +15 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b58422d5246d4a2b03c7aa4af26fe7ba44651310e3309fbd7951f591e0471fdd
4
- data.tar.gz: 4a2ffd2ddff0233d6952ad56e009c8a71fdb434a8dd72afc38ccf0ded3b46925
3
+ metadata.gz: be9c519146063e4b17e8736dfd6d58f968411ef172c2c7ba4bb6f9f2669f7ebc
4
+ data.tar.gz: a030af0aaa876017a8ec86960aff3fb3f10d0265b8750b6a7f2fb8e14260f5ce
5
5
  SHA512:
6
- metadata.gz: af77ee166027269439035e19218f253a24a9d7f5c5c0c3686049e8c5f1cd3df06918f4482823a603c017211f773a319deec18a46f6bfd237241af3725e8045d7
7
- data.tar.gz: acec6a238c3c94c8a52b74e80d9e0500340538e687a3db345cc94afcfe9e6d59f1b2dcae1cbae846cadf3ddb4f80cc638a369ee5169352236178e011415380f9
6
+ metadata.gz: 2d6004af8953418d4b3e76cc96fd7ed3e7f6b26cef82f11eb0b5f2476aef4249b63dad569eecfeb31618115606b204ce41fdb58b6b4187ef1521a2b89007321c
7
+ data.tar.gz: a1b75505baec7086b318b2d88f5bea5a2bb80aa0aec53373a065f545867e72b7f3551bde3a841cfc47941142474da932753b9343a95219655583cd21e5e70d31
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 8, 2024
5
+ # Date: October 9, 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.4"
27
+ VERSION="0.1.5"
28
28
 
29
29
  attr_reader :fields
30
30
  attr_reader :values
@@ -62,6 +62,19 @@ class Cellar
62
62
  index
63
63
  end
64
64
 
65
+ def rename_field(field, other)
66
+ field = field.to_s
67
+ index = index(field) or raise "unable to rename the #{field.inspect} field"
68
+ @finder.delete(field.downcase.gsub(/\W/,'_'))
69
+ @finder.delete(field)
70
+ other = other.to_s
71
+ fields[index] = other
72
+ @finder[other.downcase.gsub(/\W/,'_')] ||= index
73
+ @finder[other] ||= index
74
+ @widest = fields.map(&:size).max
75
+ index
76
+ end
77
+
65
78
  def index(field)
66
79
  case field
67
80
  when String, Symbol
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cellar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Shreeve